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

Open Propeller Project #7: Programming Propellers from a Chromebook

13

Comments

  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-19 19:41
    Heater. wrote: »
    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 finally got around to hooking up my Espruino board and it is quite fun to play with! I notice that they have a graphical programming interface as well as a textual one. I wonder if it would be possible to adapt the Espruino IDE to work with the Propeller? You'd need an interactive language that runs on the Propeller though since the Espruino IDE doesn't include a compiler since that is resident on the Espruino board. There are a number of options for on-board interpreters on the Propeller though.

    Edit: I guess the graphical programming interface is just Blockly which I think people here have already been experimenting with.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-28 09:33
    Parallax,

    You should suggest using RPi to host software for the education program and recommend a remote desktop app like VNC or RDP on Chromebook, Android, and IOS for programming instead of writing a bunch of new software for all the platforms.

    One could write a Javascript app that would run on any device with a web browser and that talks to a special piece of hardware for programming through Wifi, Bluetooth, or Headset modem via audio. Much of the Javascript app work is done including some examples of how to program the propeller. The existing app just needs some graphic love.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-28 09:58
    Jazzed,

    Not a bad idea.

    On the other hand the result of msrobots and my efforts was that we have a Spin IDE in the browser. That IDE also runs as a chrome app. Recently I just figured out and used the Chrome app serial port API, it's not hard. The missing piece is compiling propeller load from propgcc into JavaScript and hooking it up to the chrome serial port API.

    Not sure if I will ever have the time or will to do that but it is certainly doable.
  • David BetzDavid Betz Posts: 14,511
    edited 2014-09-28 11:40
    Heater. wrote: »
    Jazzed,

    Not a bad idea.

    On the other hand the result of msrobots and my efforts was that we have a Spin IDE in the browser. That IDE also runs as a chrome app. Recently I just figured out and used the Chrome app serial port API, it's not hard. The missing piece is compiling propeller load from propgcc into JavaScript and hooking it up to the chrome serial port API.

    Not sure if I will ever have the time or will to do that but it is certainly doable.
    If you don't care about XMM memory models then you can probably write a Propeller loader directly in JavaScript pretty easily. Just translate Steve's ploadlib to JavaScript.
  • Heater.Heater. Posts: 21,230
    edited 2014-09-28 13:13
    David,

    True. Except that at first sight it does not look so easy to translate PLoadLib to JS.

    Firstly there is a lot of bit twiddling going on which is a pain in JS.

    Worse there is problem of the asynchronous nature of the Chrome serial port API. Which means the received bytes get delivered to your code via a call back rather than your program making a blocking read call. Rearranging the control flow to work asynchronously looks tricky.

    I'll have a proper look tomorrow.
  • ValeTValeT Posts: 308
    edited 2014-10-16 17:27
    Could you install Wine on the Chromebook and run it from there?

    I have been working a lot with Wine recently, and am just discovering its possibilities. I don't know if this would work, but its worth a try.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-10-16 17:29
    ValeT wrote: »
    Could you install Wine on the Chromebook and run it from there?

    I have been working a lot with Wine recently, and am just discovering its possibilities. I don't know if this would work, but its worth a try.

    Good try, but I don't think so. It's not a Linux vs Windows issue, but a Desktop vs Browser issue. A Chromebook's OS is Google Chrome - the browser. You can't install anything on it except Chrome plugins :/
  • David BetzDavid Betz Posts: 14,511
    edited 2014-10-16 18:31
    Is the ChromeBook actually going anywhere? It seems like when it first came out it was an inexpensive for a laptop but now I see real Windows laptops at around the same price. Is there still a place for the ChromeBook? I kind of like the idea and wanted to get involved with this project when it was first announced but I wonder if ChromeBook is going to be successful.
  • Heater.Heater. Posts: 21,230
    edited 2014-10-16 21:36
    David,

    Chromebooks seem to have been doing very well - "Chromebooks, notebooks powered by Google's browser-based Chrome OS, pushed their share from 3.3% in 2013 to 4.5% this year, a 36% jump."

    From here: http://www.computerworld.com/article/2687742/mac-and-chromebook-sales-erode-windows-pcs-retail-share.html

    Or "Sales of the laptops, powered by Google's Chrome operating system, are expected to nearly triple to 14.2 million units worldwide by 2017, according to Gartner. The research firm expects global sales to reach 5.2 million this year, up 79 percent from 2013. Last year,"

    From here: http://www.cnet.com/news/chromebook-sales-set-to-nearly-triple-by-2017-gartner-says/


    Most encouraging is this, from the first link, - "The growth of those alternatives came at the expense of Windows PC sales, which dropped about 6%, slipping from a 72.3% share in 2013 to 68.4% in 2014. Total personal computer sales, however, were up almost 3% for the 10 weeks compared to last year..."

    So whist the total market grew Windows share dropped!
  • Martin_HMartin_H Posts: 4,051
    edited 2014-10-17 03:16
    They use Chromebooks at Google docs at my kids' school. It works well since a child can access their work in the class or at home. They often turn in their homework electronically as well. Both of my children have Windows PC's and use them at home to access Googled docs, so the workflow doesn't mandate a Chromebook either.

    @Heater, I've heard Chromebooks make great Linux laptops because all of the hardware is compatible with the Linux kernel. I've thought of picking up a refurbished Acer C720 off eBay for $150 and giving desktop Linux another try.
  • David CarrierDavid Carrier Posts: 294
    edited 2014-10-17 16:02
    To clarify some confusion I have seen in this thread, Chrome OS can run native C/C++ programs. While the user interface elements use HTML and JavaScript, this does not prevent it from running existing C/C++ code. Here is a tutorial for running C++ code.

    I set a Chromebook to developer mode and starting poking around at what it is doing internally. I found that it includes the same FTDI kernel module that is usually included in GNU/Linux distributions. I connected FT232R and FT231X devices to the Chromebook and with both it created a /dev/ttyUSB* device file, so the behind-the-scenes portion of programming a Propeller microcontroller may be as simple as it is in Linux. Barring any issues with permissions or APIs, the most difficult part may very well be the GUI, since Chrome OS won't run normal X applications. There is support for running Qt applications, but I do know know of any Propeller programming projects that have used the Qt engine and I have not seen any similar support for Tk or GTK+.

    Also, we do get requests for individuals and classrooms using Chromebooks at an increasing rate. If their growth trend continues, it may become one of the more common platforms.

    — David Carrier
    Parallax Inc.

    Edit: It looks like there is a published API for serial communications: https://developer.chrome.com/apps/app_serial
  • msrobotsmsrobots Posts: 3,704
    edited 2014-10-17 21:08
    ..but I do know know of any Propeller programming projects that have used the Qt engine and I have not seen any similar support for Tk or GTK+.
    ...

    As far as I understand Simple IDE from Jazzed is using QT.

    Sad you never heard of it.

    mike
  • Heater.Heater. Posts: 21,230
    edited 2014-10-17 21:12
    David,

    Ah yes, I forgot all about native client for Chrome.

    In theory nacl makes it possible run PropellerIDE and SimpleIDE in the the Chrome browser on PC's or on a Chrome book. That is probably the quickest way to get an IDE for the Propeller running on Chrome.

    "native" is not so straight forward here. What you are doing is using clang to compile C/C++ into and intermediate representation (IR). The final compilation to native machine code does not happen until your program is loaded to run on whatever Chrome device. This is how they can support x86, ARM and MIPs architectures.

    Also your code runs in a "sand box" for security and will need to use the Pepper API rather than the "native" POSIX or Windows API you might be used to. Using Qt hides that of course under the Qt API.

    I suspect getting progcc compiled and running for Chrome nacl might be a bit of a challenge! But the opensource spin compiler should be a breeze. Openspin compiles with clang and Emscripten ands runs in the browser already.

    I had a play with the serial port API in Chrome for the first time recently and it works very well. I was hoping to find time to get the loader from propgcc compiled with Emscripten and running in the browser.

    The downside of nacl is that it ties you to Chromebooks or the Chrome browser. I would not want to be developing new code with nacl as the target but as a quick way to get an existing application or library running there it seems just fine.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-19 07:09
    Is there something ready for chromebooks yet? I don't have a chromebook, so I have not been following closely.

    The lady from the school district came by yesterday, she has a couple hundred kids with chrombooks and wants to start them building robots.

    I saw the first thread in this post awhile back, but mis-remembered it (though it was in learn.parallax.com) and assured her we could get something going. Was I talking out the wrong oraface again?
  • Heater.Heater. Posts: 21,230
    edited 2014-10-19 07:41
    braino,
    Was I talking out the wrong oraface again?

    Not really. A lot of work has been done on this. And a lot remains....

    msrobots and I have demonstrated that all the required parts are in place to make a Spin IDE in the browser or as a Chrome app. See here: http://forums.parallax.com/showthread.php/152711-A-Propeller-WebTool-Framework-for-Compiled-Languages?p=1254463&viewfull=1#post1254463


    We have openspin compiled to JavaScript and running in the browser. We have a syntax highlighting editor. msrobots wrapped it all in a working IDE, Editor17.

    As noted above Editor17 is kind of clunky and ugly and is in need of someone with good web UI design skills to make it attractive.

    Building the openspin C++ into JavaScript for the browser is described on my blog here: http://the.linuxd.org/building-openspin-with-enscripten/

    My original experiments in compiling Spin in the browser are here: http://the.linuxd.org/lab/spine.html You have to drive it manually. Hit the buttons "Spawn worker", "Send Files to Worker", "Compile" and "Get Binary" in that order to see it operating in the output panel below.

    Msrobots Editor17 is running here: http://the.linuxd.org/lab/editor17/editor17.html. Sadly his file server seems to be unavailable so building the files listed in the project space on the left does not work now. But if you type Spin code into the Editor it will compile it. Files can also be loaded and save to the local machine.

    What's missing?

    a) Make it look nice.

    b) Fix up the UI and server back end interfacing

    c) For a Chrome App compile the PropellerIDE loaders C++ to JS and hook it up to the Chroms App Serial Port API.

    d) A lot of refactoring of this quickly hacked up experimental code into something presentable.

    It just needs someone to pick up the pieces and run with it. Someone who feels the need. Could that be you?

    I was hoping that Ken would stir up some action on this project so as to get it perfected. It's his thread after all. Both msrobots and I have run out of time for this. Now that the long cold winter nights are closing in I might find myself looking at it again. That should not in any way be relied on.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-19 08:32
    I can do the insructions, we would need somebody smart to programming in C++. And somebody that understands "nice" to make it look nice (my stuff looks great to me but look horrible to earth people).

    Anybody interested in working with me to get to the next step?
  • Heater.Heater. Posts: 21,230
    edited 2014-10-19 10:27
    Braino,

    "...programming C++"?

    Which solution are you going for?

    Seems it may be possible to get PropellerIDE, a C++ program, running in the browser as a "native client application" (nacle). That however restricts you to the Chrome browser and Chrome Books.

    My suggested approach is all JavaScript and works on many browsers. Except the Prop programming over the serial port. That would require a little server to be made if people insist on using other than Chrome.

    A fine example of such a browser based IDE is the Espruino. Do check this out to see what can be done: https://chrome.google.com/webstore/detail/espruino-web-ide/bleoifhkdalbjfbobjackfdifdneehpo?hl=en
  • John KauffmanJohn Kauffman Posts: 653
    edited 2014-10-19 20:45
    David Betz asked above: Is the ChromeBook actually going anywhere?

    I think Chromebook is here to stay because it is something different from laptops, not just cheaper. The alternate it offers is attractive. Google provides free word process, spreadsheets, email, calendar, browser and storage all with perfect sharing. How much more would most people do that requires a desktop / local processing? And all the maintenance is done by Google: updates to OS, updates to apps, virus prevention, back-up, etc. The system allows better hardware: very long battery life, tougher for impacts, easier to cool (and rain-proof), full keyboard, lightweight. There is a java-like scripting language for the apps so they can be customized at a higher/easier level in addition to working with the APIs. So I'd say that even if Win laptops were lower priced the CB would remain an attractive product.

    My niece informs me the coolness factor falls between Win and Mac.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-20 09:07
    Heater. wrote: »
    Braino,

    "...programming C++"?

    Which solution are you going for?

    I'm looking for whatever it was you said. You said C++, that is not me.

    I do documentation, and I follow instructions; I take the instructions the engineers provide, and make them eventually WORK, and sometime translate them into a state where users can use them. After the engineer does 90% of the work, I do the other 90% of the work.

    The stuff you mention in post #76 looks like there's a bunch of stuff there, but not in a state to present to the kids, or the teachers. Taking it from where it is to where it needs to be is beyond what I could do on my own.
  • Heater.Heater. Posts: 21,230
    edited 2014-10-20 09:16
    Braino,

    Ah, yes, confusing. In my preferred approach we take existing C++ code and convert it, automatically, to JS. The actual C++ hopefully needs no change.
    Then it's all wrapped up in JS to hook into the browser GUI.

    Seems we already did 90% of the work getting it to function at all. Now we need a web coder to do the next 90% of the work in making it "nice" and usable. Then you can do the last 90% of the work :)
  • David CarrierDavid Carrier Posts: 294
    edited 2014-10-20 20:33
    msrobot wrote:
    As far as I understand Simple IDE from Jazzed is using QT.

    That's good to hear; I was under the impression that SimpleIDE did not use Qt. This means that someone who is familiar with porting programs to Chrome OS, even if they are not familiar with the Propeller microcontroller, could conceivably port SimpleIDE over with ease. Unfortunately, that's probably not anyone reading this thread. Although it seems that any pronouncement of unlikelihood or impossibility on this forum is always proven wrong. (Now I'm expecting a Chrome OS expert to show up out of nowhere, but this probably means that that expectation will be the one proven wrong.)

    — David Carrier
    Parallax Inc.
  • Heater.Heater. Posts: 21,230
    edited 2014-10-21 02:17
    David Carrier,


    Quite so. Compiling SimpleIDE or PropellerIDE to the Chrome Book is impossible
    .



    There, it's probably done already.
  • __red____red__ Posts: 470
    edited 2014-10-21 23:40
    I've been using openspin and vim in a chroot()'d environment on a chromebook for over a year already. It's just that "chromification" so you don't have to root the box that's the challenge.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-22 16:09
    Anyone have a link to a virtual chromebook we can run in virtualbox? I spent all my money on a fancy desktop to run all the virtual machines, and the school doesn't have any spare laptops at the moment. As you can tell, I have zero idea about chromebook/chrome OS.
  • Martin_HMartin_H Posts: 4,051
    edited 2014-10-22 16:59
    Anyone have a link to a virtual chromebook we can run in virtualbox? I spent all my money on a fancy desktop to run all the virtual machines, and the school doesn't have any spare laptops at the moment. As you can tell, I have zero idea about chromebook/chrome OS.

    http://arnoldthebat.co.uk/wordpress/chromium-os/

    The image can't have virtually box extensions installs so you need a machine with a fair bit and umph to perform well.
  • Heater.Heater. Posts: 21,230
    edited 2014-10-22 20:40
    braino,
    Anyone have a link to a virtual chromebook we can run in virtualbox?
    You don't need one. For the purposes of "Programming Propellers from a Chromebook" the Google Chrome browser you probably have on your PC is the perfect Chrome OS simulator.


    You can load Chrome OS apps into the Chrome browser by selecting "Tools" from the menu, then "Extensions". In there you can enable "developer mode" and then hit the "load unpacked extension" button.


    This of course does not give you an actual Chrome OS image that you can hack on in terms of setting up chroot environments, running native linux code or generally mucking around with the guts. BUt I don't think that's what's we should be up to in reagrd this thread.


    I have msrobots Editor17 Spin IDE running as a Chrome App this way on my PC.


    It does not exactly work yet, won't compile, but I'll post it here when it comes to life.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-23 06:50
    Martin_H wrote: »
    http://arnoldthebat.co.uk/wordpress/chromium-os/

    The image can't have virtually box extensions installs so you need a machine with a fair bit and umph to perform well.

    I heard chromebooks aren't all that fast in the first place, so I am prepared for "slow". All I need is to show that specific steps can be performed in a specific sequence and get the same result every time. We intend to set this up on about 200 chromebooks, if it works.

    I'll give this a try ASAP. Thanks!
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-23 06:57
    Heater. wrote: »
    You don't need one. For the purposes of "Programming Propellers from a Chromebook" the Google Chrome browser you probably have on your PC is the perfect Chrome OS simulator.

    I have learned never to install first time development on the physical system. I've had too many software installs destroy the entire system on both windows and linux. "google is your friend" is often not only incorrect, but also bad advice and a recipe for disaster. Not everybody that posts a "how to" tests properly, or starts with a known state (clean install).

    I will of course use your notes above to get started, but from the safety of a virtual machine. I'm a belt+suspenders kind of guy, at least on the rare occasions when I'm wearing pants.
  • Heater.Heater. Posts: 21,230
    edited 2014-10-23 08:01
    Braino,

    I do share your concerns about security, safety, and unknown/untested software wreaking havoc.

    However in the case of loading extensions into the Chrome browser, the browser already is your virtual machine. Extensions are written in JavaScript. This is hardly any different than loading a web page, like this forum, and having it run JavaScript in your browser. The browser is the sand box in much the same way as VirtualBox is a sand box for native code.

    Well, except of course extensions can also be written in native code (nacl) or portable native code (pnacl). These also run in a sand box within Chrome. They are not runable unless you enable the nacl/pnacl in chrome so I'm not going to worry about that for now.

    Do I trust the Chrome sand box? Perhaps just a little less than the Virtual Box sand box.
  • __red____red__ Posts: 470
    edited 2014-10-25 18:20
    I heard chromebooks aren't all that fast in the first place, so I am prepared for "slow".

    An unmolested chromebook is the fastest browser I have in the house. It is ridiculously fast for its specifications.
Sign In or Register to comment.