Shop OBEX P1 Docs P2 Docs Learn Events
Open Propeller Project #7: Programming Propellers from a Chromebook — Parallax Forums

Open Propeller Project #7: Programming Propellers from a Chromebook

Ken GraceyKen Gracey Posts: 7,386
edited 2014-11-28 10:47 in Propeller 1
OPP-Chromebook.png

Open Propeller Project #7: Programming a Propeller from Chromebook
Using SimpleIDE (C) and Propeller IDE (Spin)

Schools are getting flooded with iPads and Chromebooks right now. The Propeller iPad iOS program download efforts are underway and shall soon be released with a complete SimpleIDE and WiFi programming interface thanks to several forum members, jazzed and ByteWorks, but we haven't made any progress with Chromebooks. Parallax educational customers desperately need to be able to program our products from a Chromebook.

This is another challenge for our growing audience of tool developers, hopefully including somebody that has some kind of experience working within the Chromebook operating systems. In short, customers would benefit from having SImpleIDE and PropellerIDE run on a Chromebook. The solution should be entirely open and free, with capability to be improved upon by anybody.

We don't know if this is a simple request or one of complexity, but we'll start right here - with another Open Propeller Project!

Who's in for this one?

Ken Gracey
600 x 250 - 134K
«134

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-09-02 16:15
    Ken,

    This is mostly done already. Not using SimpleIDE or PropellerIDE as such but using code built from openspin and a whole new in-browser editor.

    Have a read through the now very long thread on the Propeller Web Tool Framework for Compiled Languages:
    http://forums.parallax.com/showthread.php/152711-A-Propeller-WebTool-Framework-for-Compiled-Languages

    In short what happened was:

    1) Jazzed threw down the challenge to me to get openspin converted to JavaScript and running in the browser.

    2) I did that. And built a simple web page that could load and compile a single Spin file as proof of concept. Main point was to get the compiler running as a separate "web worker" process so that it did not hang up the user interface of the web page.

    3) msrobots got a Spin syntax highlighed editor working in the browser based on the famous CodeMirror JS editor. IT can also syntax highlight a thousand other languages including C/C++ and COBOL!

    4) msrobots did a lot of work getting the editor integrated with my openspin.js compiler. It can load files from your local machine to compiler or fetch them from a project in "the cloud". It all works a treat.

    5) We all stopped work on that :)

    Next steps I see are:

    i) Wrap all that as a Google Chrome App or extension. Whatever they call it. Then it can be "installed" and run without the "cloud" part and gets to have more privileges on the local machine. I did actually get that working at one point. Actually bundling a bunch of HTML and JS up into a Chrome App is very easy.

    ii) Convert the loader from propgcc from C++ to Javascript with Emscripten. I did try that once as well. It translated OK but needs a work.

    ii) As a Chrome app the "propeller-load.js" can now use serial ports on the local machine and program the Props ober USB/Serial adapters.

    iii) I was planning on borrowing the serial port handling code from the Espruino project. The Espruino boards are programmed from an IDE that runs as a Chrom App so this is all a proven concept. See here:
    https://github.com/espruino/EspruinoWebIDE


    I don't think I have the time to work on this.

    Edit: When I say "mostly done" that means it sort of works and needs a ton more work to make it look good and fix up the user interface aspects and so on.

    Sadly there is no C/C++ support in all of this. How one would get propgcc running on a Chrome book is beyond me. However the compilation work could be sent up to compile servers in the "cloud". Slow but effective.

    The magic thing about creating a Chrome App like that is that it will also run in the Chrome Browser on any PC, Windows, Mac, Linux. All covered.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-02 16:42
    Heater. wrote: »
    ii) Convert the loader from propgcc to C++ to Javascript with Emscripten. I did try that once as well. It translated OK but needs a work.
    Translate propeller-load to C++? Can't Emscripten compile C into JavaScript?
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-02 16:42
    Ken Gracey wrote: »
    OPP-Chromebook.png

    Open Propeller Project #7: Programming a Propeller from Chromebook
    Using SimpleIDE (C) and Propeller IDE (Spin)

    Schools are getting flooded with iPads and Chromebooks right now. The Propeller iPad iOS program download efforts are underway and shall soon be released with a complete SimpleIDE and WiFi programming interface thanks to several forum members, jazzed and ByteWorks, but we haven't made any progress with Chromebooks. Parallax educational customers desperately need to be able to program our products from a Chromebook.

    This is another challenge for our growing audience of tool developers, hopefully including somebody that has some kind of experience working within the Chromebook operating systems. In short, customers would benefit from having SImpleIDE and PropellerIDE run on a Chromebook. The solution should be entirely open and free, with capability to be improved upon by anybody.

    We don't know if this is a simple request or one of complexity, but we'll start right here - with another Open Propeller Project!

    Who's in for this one?

    Ken Gracey
    I guess this would be a good excuse to buy a ChromeBook. :-)
  • Heater.Heater. Posts: 21,230
    edited 2014-09-02 16:52
    David,

    Well spotted. Yes, Emscripten compiles C/C++ into LLVM bit code using clang and then generates JavaScript from the bit code. I did at least get the first part of that to work at one point.

    propeller-load will of course need some tweaking so as to be able to make use of the serial ports via the Chrome App serial port API. Or rather via the serial port objects borrowed from the Espruino project.

    One might wonder if JS is fast enough to meet whatever timing requirements loading a Prop has. I suspect it will work.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-02 16:56
    Heater. wrote: »
    David,

    Well spotted. Yes, Emscripten compiles C/C++ into LLVM bit code using clang and then generates JavaScript from the bit code. I did at least get the first part of that to work at one point.

    propeller-load will of course need some tweaking so as to be able to make use of the serial ports via the Chrome App serial port API. Or rather via the serial port objects borrowed from the Espruino project.

    One might wonder if JS is fast enough to meet whatever timing requirements loading a Prop has. I suspect it will work.
    I wonder if it will depend on the speed of the ChromeBook? I imagine they have pretty wimpy processors since they cost so little. I guess I need to get into browser-based apps. It seems like that's the way things are going these days. My only real problem with the concept is that I don't really want to have to depend on an internet connection for all of my work. Often the wifi connection in my hotel is very slow or not working at all. I'd like that not to stop me from programming my Propeller board. Can you write a Chrome app that will run without an internet connection?
  • Heater.Heater. Posts: 21,230
    edited 2014-09-02 17:23
    David,
    Can you write a Chrome app that will run without an internet connection?
    Sure.

    Chrome apps are just HTML and JavaScript bundled into a package. That package, "extensions" in the Chrome browser, can be fetched from the Google webstore or installed into the browser from a local file.

    Such apps or extensions have a lot more access to your local machine, like file storage and serial ports etc. So they can be used totally locally with no internet connection. Check out the Esprunio web IDE for a great example.

    In your chome browser go to the menu->tools->extentions and hit the "Get More Extentions" link at the bottom of the page. Enter espruino into the search box. Install what you find.

    If the Propeller web IDE could look like that I would be happy.

    By the way. Did I mention that someone has Blockly, the graphical coding tool, running in the browser. Forget the chaps name now.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-02 17:28
    Heater. wrote: »
    David,

    Sure.

    Chrome apps are just HTML and JavaScript bundled into a package. That package, "extensions" in the Chrome browser, can be fetched from the Google webstore or installed into the browser from a local file.

    Such apps or extensions have a lot more access to your local machine, like file storage and serial ports etc. So they can be used totally locally with no internet connection. Check out the Esprunio web IDE for a great example.

    In your chome browser go to the menu->tools->extentions and hit the "Get More Extentions" link at the bottom of the page. Enter espruino into the search box. Install what you find.

    If the Propeller web IDE could look like that I would be happy.

    By the way. Did I mention that someone has Blockly, the graphical coding tool, running in the browser. Forget the chaps name now.
    This all sounds very interesting but I guess it's actually off topic since Ken specifically said that this was to be a port of SimpleIDE and/or PropellerIDE to the Chromebook. Oh well...
  • Heater.Heater. Posts: 21,230
    edited 2014-09-02 17:38
    I very much doubt that Ken is going to get what he wants here.

    SimpleIDE and PropellerIDE are written in C++ and use the Qt libs. As far as I know ChromeOS won't be running that any time soon. Correct me if I'm wrong anybody.

    It's is actually possible to compile Qt apps into JavaScript. You will find examples if you ask google. However the end result is very slow and clunky.

    It just makes sense to create a new IDE in JS. The Editor19 that msrobots made already looks a lot like PropellerIDE. Needs someone with HTML, CSS and JS skills to polish it.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-02 17:48
    Well, I'd be interested in working on a browser-based app for Chromebook as long as it has a mode that allows it to work offline. I'll take a look at Editor19 to see if there is anything I could contribute. I tried running it and it looks pretty nice already. It would be a shame of no one ever finished it. Whether it qualifies for this Open Propeller Project or not Ken can decide. Do you know if there is a way to write ChromeOS apps without using an actual Chromebook? Is there an emulator?
  • msrobotsmsrobots Posts: 3,704
    edited 2014-09-02 17:56
    Ken,

    @Heater. describes all of this quit accurate. As usual.

    The EditorXX.htm and support files are pure HTML,CSS and JavaScript. But it was not me who started it. It was @PhiPi again. He created the first Version with SPIN/PASM highlighting in CodeMirror2. It wasn't me!

    I just converted it to use CodeMirror3 and - well - had some time, at that time, to play with HTML5 and CSS3 and JavaScript. WHY I did that? Not sure. It just was fun to do and I needed some Editor for my Spinneret-Project.

    My primary goal was to use the Spinneret as a PropPlug with embedded IDE and file system on SD. This goal is almost reached, I just need to free some more longs on the spinneret and then I can load another Propeller from the Spinneret.

    But @Heater distracted me. I had to dive into this JavaScript. Not what I usually use in a browser for C# web-applications, NO, JavaScript as a full fledge language. WOW.

    So I tried to rebuild the PropellerTool as HTML5 web page as close as possible with CodeMirror3 as Editor.

    But no access to serial ports on local computer. Or not so easy. It is a security thing. A webpage in your browser SHOULD NOT be able to access your local serial ports at will. You agree?

    Next @David chimed in with his SB6 trick to load a propeller. I implemented support for that in the Web Editor and David and Jazzed? got it running. I do not own one S6B to test. But it should work.

    Next @Michel L. distracted me by building some JAVA server to be combined with the Editor using JAVA to run propellerload? as executable and present this action as web service in his JAVA webserver.

    All of this works well, but there is no current development. @Michel L.'s Posts vanished also. Seemed to be no interest and we all moved on.

    You know for yourself that people like @me, @Heater. and others (most?) here in the forum have some short attention span regarding projects. Too much other stuff to explore...

    what I currently have is:

    EditorXX.zip containing just html,css and javascript files. Should work on ANY webserver. Even Spinneret.

    Michel L.'s JAVA server. Does not need webserver, is one.

    Enjoy!

    Mike

    Uups... forgot attachments ...
  • jazzedjazzed Posts: 11,803
    edited 2014-09-02 19:09
    David Betz wrote: »
    Well, I'd be interested in working on a browser-based app for Chromebook as long as it has a mode that allows it to work offline.


    This was one of the original requirements. It still works IIRC.


    As I mentioned before, the next application I write will be a web-app (something that runs in a browser and served either from the web or a simple server running on the PC). I'm abandoning the Qt version of the Annoide project because I can't see fooling with another app that has to run on 4 more platforms in addition to desktop soup.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-02 19:19
    msrobots wrote: »
    But no access to serial ports on local computer. Or not so easy. It is a security thing. A webpage in your browser SHOULD NOT be able to access your local serial ports at will. You agree?


    The next trick is to use a simple modem to load programs using audio from the web-application. I've made some progress in this area.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2014-09-02 21:06
    OK, I understand where we are now. Thank you for the clarity and completely spelling it out for our as the details are scattered across other threads. In seems that in short, we have Spin + ASM working in some format from a browser, just like we do with the PropBlockly work from Michel. Neither of which is a port of the Parallax Qt tools maintained by jazzed [not a requirement].

    We're interested in moving this effort to the next level with a more formal, complete interface. While tools don't have to all look the same (like PropellerIDE or SimpleIDE) when running on a browser, it helps to duplicate the look as much as possible to improve the familiarity at first look. I don't want to list a bunch of requirements here to influence any particular approach to solving the problem.

    We would like to formalize this Open Propeller Project and try to motivate a contributor or two. Perhaps we support Spin first, then C (even though we don't seem to know how we'd get C support without rooting the system).

    I realize we're asking for a lot here, but we're also not asking for it to be done for free. This work can be paid for with a monthly budget or on a volunteer basis.

    I'll let this thread bake for a day or two and come back periodically to see if we could move it to the next level. In the meantime I'll also run the examples above to see if I could get them to function.

    Ken Gracey
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 00:55
    jazzed,
    The next trick is to use a simple modem to load programs using audio from the web-application. I've made some progress in this area.
    This is really cool and I for sure would love to see it done.

    However it is not required for a Chrome App. There is a serial port API for Chrome Apps. We should use that.

    That API is a bit complex, has changed over time and may change again. So it might be better to use an existing wrapper object. Like the serial port handling code in the Espruino project.

    With that in place any Chrome browser user on any platform that runs Chrome can install the Propeller Chrome App as a browser extension. The easiest way in the world to create and distribute a cross-platform application.

    @ken,

    Msrobots EditorXX.html will make your head explode! He has managed to put all the HTML, CSS and JavaScript into a single file. Including the CodeMirror editor, syntax highlighter and other stuff. It really needs pulling apart into it's original files.

    We need somebody who is a wiz at building single page web apps the modern way.

    No offence msrobots, no offence intended. You did a amazing piece of work there. It's just not tenable to keep it like that.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 01:09
    Ken,

    Sadly the offer of remuneration does not help here. Time and energy are very limited for me. And to be honest creating a nice web application of any kind gives me a sever headache. All that HTML and CSS is just horrible to deal with. Using any kind of JS library or frame work to handle that is also a pain. Firstly you have to choose from among the thousands of them that are out there!

    Unless you make me an offer I can't refuse of course. A desk at Parallax, green card, salary, caviar, dancing girls....:)

    Keeping operation of the thing similar to the Propeller Tool sounds like a good start. My feeling is that we should not be so insistent on an exact clone looking interface. I like the minimalist style of the Esruino web IDE.

    On the other hand plain and simple like the github pages is cool as well.

    I'll try and find time to dig out my notes and scripts for compiling open spin to JS.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-03 04:09
    Heater. wrote: »
    With that in place any Chrome browser user on any platform that runs Chrome can install the Propeller Chrome App as a browser extension. The easiest way in the world to create and distribute a cross-platform application.
    So you're saying that a Chrome app for a ChromeBook is no different than a Chrome browser extension that will run on any platform that supports the Chrome browser? That's helpful. It means development doesn't require an actual ChromeBook at all.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 04:28
    David,
    So you're saying that a Chrome app for a ChromeBook is no different than a Chrome browser extension that will run on any platform that supports the Chrome browser?

    Yep. That is what I'm saying.

    Of course I may be wrong having never used a chrome book but I have yet to find any reason why not. Chrome books and Chrome browsers get their apps and extensions from the same google webstore.

    I have yet to grok the difference between "apps" and "extensions" but the answer is here https://developer.chrome.com/webstore/apps_vs_extensions

    As far as I can tell the menu item in the Chrome browser called "extensions" handles apps just as well. Like the Espruino IDE.


    Edit: I guess there may be some extra APIs provided in Chrome books. Who knows?. For our purposes it does not matter.

  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-03 04:41
    Heater. wrote: »
    Unless you make me an offer I can't refuse of course. A desk at Parallax, green card, salary, caviar, dancing girls....:)
    That all might be possible except caviar will be replaced by walnuts and dancing girls by dancing robots. Will that be okay? :-)
  • jazzedjazzed Posts: 11,803
    edited 2014-09-03 07:45
    A web-app should be able to run in any available browser for the job, and limiting to chrome is ok, but that's also committing to one solution which seems no different from only supporting Windows in some ways.

    There is no "serial port" on a most Apple or Android mobile devices. They all have a headphone jack though, and there are audio APIs. A modem would cost less than $20 as a kit, and if you don't mind using a EEPROM loader, it could all be done with Propeller and a few spare parts.

    All smart phones and most other devices have WiFi, so that makes Jeff's WiFi demo attractive, but that was written with Delphi, and until ports of that exist we are still where we were at the beginning of the year.

    The only generally available solutions are those requiring extra or specific hardware. And the only demonstrated working WiFi add-on under $40 is the XBee S6B. The only generally available solution for the XBee WiFi today is the EEPROM loader that David Betz wrote (I contributed, but it's mostly David's work).
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-03 07:50
    jazzed wrote: »
    A web-app should be able to run in any available browser for the job, and limiting to chrome is ok, but that's also committing to one solution which seems no different from only supporting Windows in some ways.

    There is no "serial port" on a most Apple or Android mobile devices. They all have a headphone jack though, and there are audio APIs. A modem would cost less than $20 as a kit, and if you don't mind using a 64KB EEPROM, it could all be done with Propeller and a few spare parts.

    All smart phones and most other devices have WiFi, so that makes Jeff's WiFi demo attractive, but that was written with Delphi, and until ports of that exist we are still where we were at the beginning of the year.

    The only generally available solutions are those requiring extra or specific hardware. And the only WiFi add-on under $40 is the XBee S6B. The only generally available solution for the XBee WiFi today is the EEPROM loader that David Betz wrote (I contributed, but it's mostly David's work).
    If we were to go with the S6B loader that you and I worked on, I'd like first to look at Jeff's code to see if it would be useful in increasing the load speed. I never tried anything other than the default 9600 baud for talking to the Xbee module and I used TCP rather than UDP.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 08:16
    jazzed,
    A web-app should be able to run in any available browser for the job...
    I totally agree. That is the whole point of wanting a web app.
    ...and limiting to chrome is ok, but that's also committing to one solution which seems no different from only supporting Windows in some ways.
    Ah, but that the cunning part of the plan. We don't limit ourselves to Chrome by doing this.


    A chrome app is basically an HTML5 web app but with access to a few more APIs for local resources and wrapped up with a manifest and whatever. The same code base can be used as a regular web app by any browser.


    Except of course for access to that all important serial port. No worries, there is no reason alternative Propeller communications media cannot be used.
    The only generally available solutions are those requiring extra or specific hardware. And the only demonstrated working WiFi add-on under $40 is the XBee S6B
    Not quite. Cluso, Loopy, and I have been programming Propellers connected to the serial ports of WIFI routers. Those little ethernet to WIFI adapters you can get for 20 dollars. It's a bit of a hack but shows promis for the future. The propeller-loader from propgcc compiles and runs on those roiuters just fine. Or you can use a USB/serial adapter with some of those routers.

    I was kind of imagining that such a router could also serve up the web app.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-03 08:28
    Interesting.

    I guess Propeller will always be dependent on external programming solutions. The situation is not much different for all the other micros out there though.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 08:48
    Jazzed.

    Yeah. I don't understand what is going on any more.

    On the one hand we lost our serial and parallel ports. Replaced by that God forsaken USB thing. More and more the computers we are sold don't let us do what we want. We can't run what we like, we can't connect to what we like and so on. How come my Galaxy S has no easy way to connect anything to it for example?

    On the other hand a web page can download all kind of junk from anywhere on the net it likes to. When I go to XYZ.com all of a sudden by computer is full of stuff from Facebook, twitter, google, God knows who advertising and tracking people.

    Seems anyone can get in and out of my machines except me!
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2014-09-03 09:31
    Heater. wrote: »
    Ken,

    Sadly the offer of remuneration does not help here. Time and energy are very limited for me. And to be honest creating a nice web application of any kind gives me a sever headache. All that HTML and CSS is just horrible to deal with. Using any kind of JS library or frame work to handle that is also a pain. Firstly you have to choose from among the thousands of them that are out there!

    Unless you make me an offer I can't refuse of course. A desk at Parallax, green card, salary, caviar, dancing girls....:)

    It can be hard to leave the social northern utopia in which you live, but perhaps moving south a bit could be to your benefit. You're about to enter the dark, long winter.
    Heater. wrote: »
    Keeping operation of the thing similar to the Propeller Tool sounds like a good start. My feeling is that we should not be so insistent on an exact clone looking interface. I like the minimalist style of the Esruino web IDE.

    I've seen a number of business applications that run from a browser which resemble their PC/Mac software counterparts quite well. It stands to reason that anything done on a browser should be more minimalist since there's sometimes a latency between button clicks, menu searches, etc.

    This morning we were approached by several schools who have "all Chromebooks" now. It turns out that Placer County (where Parallax is located) is putting them in every school. We're hearing of stories like this one every day http://www.auburnjournal.com/article/360-chromebooks-going-placer-high-sophomores. What's really encouraging is that these same students are growing up not knowing or caring about Microsoft products. The same is happening at Parallax as we move to Google docs. For whatever unknown evils they may dish out in the future I'm happy not to pay the Microsoft licensing fees as we used to do.

    Back to the topic. Need Chromebook support for Propeller. Will likely need to widen it to include the BASIC Stamp, too.

    Ken Gracey
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-03 09:35
    Ken Gracey wrote: »
    Back to the topic. Need Chromebook support for Propeller. Will likely need to widen it to include the BASIC Stamp, too.

    Ken Gracey
    I'm interested because I'd like to learn more about developing HTML5 apps anyway. Have to finish the DEFCON badge port to C++ but after that I can work on this if you're interested.
  • Don MDon M Posts: 1,647
    edited 2014-09-03 09:55
    jazzed wrote: »
    There is no "serial port" on a most Apple or Android mobile devices.

    Regarding the Android devices yes there is- in the form of a USB OTG. Just plug in a USB to serial adapter and away you go. That allows us to use adapters already available without creating something new.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 10:02
    Don M.

    That is cool. Sadly I don't think it works on my old Samsung Galaxy S.

    Worse than that Android does not run Chrome Apps (Correct me if I am wrong) To make use of that you need to write an Android app. Yet another stupid platform to support.

    How the hell is it possible we have been creating operating systems and languages for almost a century now and you still cannot write a frikken simple program like a Propeller loader that works everywhere?
  • jazzedjazzed Posts: 11,803
    edited 2014-09-03 11:43
    Hmm, I did say "most ... devices" ;-)

    My Android tab has USB OTG, and I've never been able to make it work with the FTDI chip. Maybe some pointers?

    Heater. wrote: »
    How ... is it possible we have been creating operating systems and languages for almost a century now and you still cannot write a frikken simple program like a Propeller loader that works everywhere?

    I blame Paul Anka and "Comme d'habitude":

    "... I traveled each and every highway. And more, much more than this, I did it my way."
  • Heater.Heater. Posts: 21,230
    edited 2014-09-03 12:09
    Jazzed,

    Wow, I had to check that. The lyrics to the original "Comme d'habitude" by Claude Fran
  • Martin_HMartin_H Posts: 4,051
    edited 2014-09-03 12:24
    Heater. wrote: »
    How the hell is it possible we have been creating operating systems and languages for almost a century now and you still cannot write a frikken simple program like a Propeller loader that works everywhere?

    This is vendor lock in and it is by design.
Sign In or Register to comment.