Open Propeller Project #7: Programming Propellers from a Chromebook
Ken Gracey
Posts: 7,392
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
Comments
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.
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.
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.
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.
@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 ...
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.
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.
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
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.
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.
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.
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).
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. 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.
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.
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!
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.
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
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.
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?
My Android tab has USB OTG, and I've never been able to make it work with the FTDI chip. Maybe some pointers?
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."
Wow, I had to check that. The lyrics to the original "Comme d'habitude" by Claude Fran
This is vendor lock in and it is by design.