+ Reply to Thread
Page 1 of 31 1234511 ... LastLast
Results 1 to 20 of 619

Thread: A Propeller-WebTool Framework for Compiled Languages?

  1. #1

    Default A Propeller-WebTool Framework for Compiled Languages?


    This is something I've considered for a while since Ken's post about programming via iPad (or other light-weight devices like my Android phone).

    I'm interested in exploring the idea of porting the Propeller-Tool (or other "compiled") Propeller development system entirely to the web browser context. The requirements of the system would be to function almost identically to the Propeller Tool. For lack of a better name, I would call this a Propeller-WebTool.

    While it the concept may be oriented toward a web browser, it is theoretically possible to use this framework with any Propeller module having an SD Card and a serial port.


    A Propeller-WebTool System


    What would be a Propeller-WebTool development system? Major components:

    1. A compiler. A Javascript program that will take user's source and convert to binary code.
    2. An editor. An Javascript interface for editing user's sources (need load/store ability).
    3. A loader. A Javascript program that will send compiled binary code to the propeller through a special EEPROM loader.
    4. A terminal. A Javascript program that will allow connecting to the propeller.
    5. A Network Enabled Propeller Device. The target device for programming.

    That list is essentially the same as what we have today except the last item. Addressing each item in turn as required ....


    1. A compiler.


    The compiler is high on the list of complexities and costs. Please note that this thread is about "compiled" languages (like SPIN, C, PropBasic) moderators will receive requests for off topic posts.

    For this particular concept, having the compiler run in the client's web-browser would be ideal especially because of the cheap and light-weight wireless (Bluetooth, Wifi, or Xbee) devices that can provide serial connectivity to the Propeller chip.

    In another thread I asked Heater to translate openspin to Javascript since he mentioned having nothing to do. Within a matter of hours he produced some results using the Emscripten engine (I haven't used Emscripten, so I wasn't sure how to proceed).

    I have some questions:

    1. Can I run the javascript in a web browser?
    Apparently yes, but how do I interact with it?

    2. Will it run in all web browsers? Apparently not Internet Explorer:
    "Assertion failed: Cannot fallback to non-typed array case: Code is too specialized."
    Can that be fixed?

    3. Can the resulting code be modified to use a buffer (DOM textarea) as input for compile?
    TBD.

    4. Assuming the compiler can be adopted, can a Javascript propeller loader be created using a Wifi serial port?
    TBD.

    5. Can other language compilers be ported?
    TBD.


    2. An Editor


    There is a web-enabled HTML/Javascript editor for SPIN programs already provided by a forum member. I haven't used it, so I don't know what it's capabilities are. Does the author or anyone have a link?

    There is also the Adafruit supported WebIDE. Can that be configured for Spin syntax?

    Source code Load/Store support: The easiest implementation for the user of load/store is to have the source saved on the target device. That is the network device that is hosting the HTML/Javascript for the Propeller-WebTool.

    For example, in the case of RPi it is easy because everything can go into the RPi SDCard file-system. In the case of other devices the on-board Propeller SDCard would be used for user's Propeller-WebTool storage.


    3. A Loader


    A loader would need to be written. It could be part of the compiler, but it would not be a standard Propeller loader. The current Propeller loader is not tolerant of delays that would be caused by network issues. While determinism is great, in this respect insisting on it is actually a problem.

    The loader needs to be "2 sided." That is, on the web-browser "client side", a transfer mechanism should be worked out that is compatible with the Propeller target "host side" protocol. The client/host protocol must be tolerant of network delays. We have lots of these kind of details already worked out in the Propeller-GCC loader's XMM serial_load protocol.


    4. A Terminal


    A terminal would be required for "debug output" or just general message input/output on the target Propeller Device. It is not clear what code might be available to act as a serial port web terminal. The protocol application layer used must be very light-weight. The terminal program should attempt to automatically choose the device to use.


    5. A Network Enabled Propeller Device


    A target Propeller device should be network enabled. This could be achieved using Bluetooth, Wifi, Xbee, or another device like Rasberry PI. The Propeller lower 32KB EEPROM would contain a boot-loader program (upper 32KB should be available for the user). The boot program would talk to the serial port to handle programming packets. This program would reside entirely in a COG and allow overwriting all of HUB RAM. One difficulty involves resetting the device because not all network virtual serial port devices have a control signal that can be used for remote reset.


    Final thoughts.


    Someone might say that this is all solved with the RPi or other super cheap Linux box. Well it is, but the only thing different really is that the compiler itself would run on the host system in the case of RPi. The other elements discussed are web-enabled supplements. And theoretically could work with any Propeller with SD Card attached.

  2. #2

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Quote Originally Posted by jazzed
    There is a web-enabled HTML/Javascript editor for SPIN programs already provided by a forum member. I haven't used it, so I don't know what it's capabilities are. Does the author or anyone have a link?
    I don't know if this is the one you're thinking about:
    Here's the forum thread:
    -Phil

  3. #3

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Quote Originally Posted by Phil Pilgrim (PhiPi) View Post
    I don't know if this is the one you're thinking about:Here's the forum thread:-Phil

    I was thinking of this:

    http://forums.parallax.com/showthrea...=1#post1035739

    http://forums.parallax.com/showthrea...=1#post1187091


    Reviewing the notes though, it seems like it does not meet my criteria for clent-side only support in all browsers.

    I did notice some javascript syntax highlighting regex code here somewhere ... wish i had bookmarked it.

  4. #4

    Default Re: A Propeller-WebTool Framework for Compiled Languages?


    Phil, it seems like what you have presented has the best chance for editor success.

    Have you ever heard of XMLHttpRequest? That can be used to send/receive information to a propeller bootloader that is attached to a network virtual serial port.

    There is no need for any server side processing support.

    Actually there is a need, but the commands can be handled by the propeller bootloader.

    As long as the server has the propeller device attached, we can send/receive data to propeller.
    Last edited by jazzed; 12-28-2013 at 12:21 AM.

  5. #5

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Quote Originally Posted by jazzed
    Have you ever heard of XMLHttpRequest?
    I've experimented with it but have never really inhaled.

    -Phil

  6. #6

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    I use XMLHttpRequest a lot... It's also referred to as AJAX. These days I use an abstracted version in the jQuery library. I suggest you look into jQuery as it handles cross browser JavaScript compatibility quirks.

    What questions do you have?

  7. #7

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    1. A compiler.
    --------------
    Can I run the javascript in a web browser?
    Yes, I'm very sure we can get the Open Souce Spin Compiler to run in the browser. As Jazzed says one can "compile" C and C++ to Javascript with emscipten, This sounds crazy what with JS being "a stupid slow interpreted" language. But it works very well and the resulting code runs at usable speed.
    ..but how do I interact with it?
    You end up with a JS function that can be called to get running at main() it takes the normal arguments.

    Emscipten provides the usual standard C libraries so no C code should need changing to run in the browser and have access to stdio and a file system.

    It's probably up to us to privide functions that upload/download files from a server or enable access to local files, There are lots of emscripten demos that show how this can be done here: https://github.com/kripken/emscripten/wiki
    Will it run in all web browsers? Apparently not Internet Explorer:
    Cross browser compatibility should be good. It's only JS after all. I have no idea about the particular error. I suspect such bugs will get sorted with time. Try the demos in IE. They even have Qt GUI demos!
    Can the resulting code be modified to use a buffer (DOM textarea) as input for compile?
    See above. No changes required. It's best not to change the original source so as to avoid maintenance problems. Just hook the JS fread and fwrite to wherever your data is. Modern HTML5 browsers have a file system API and local storage to play with. Or have the files in the cloud.
    Assuming the compiler can be adopted, can a Javascript propeller loader be created using a Wifi serial port?
    You can go directly to a serial port in Chrome OS! Not possible in browsers normally.

    Otherwise that seems a bit tricky. You can upload the binaries using the normal HTTP requests or websockets so what ever is connected to the Prop needs to be able to handle that.

    As a start I would make a simple server in node.js that accepts the binaries from the browser, programs the Prop and relays results back to the browser. That node.js can also relay serial terminal communications when the Prop is running.
    Can other language compilers be ported?
    Sticking my neck out I will say yes! With some confidence:

    Emscripten's front end is Clang. Clang produces LLVM "bit code" which is then translated to JS.

    The Catalina C compiler is compiled with Clang when it runs on the Mac. Ergo it should be possible to "emscripten" it!

    Not sure about propgcc, What is that compiled with on the Mac?

    Just for fun here attached fft_bench emscriptenized for the browser. Just unpack it and point your browser at the fftbench.html
    Attached Files Attached Files

  8. #8

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    2. An Editor

    There is the Cloud9 IDE: https://github.com/ajaxorg/cloud9/ Which is hosted for free at http:// https://c9.ioif you want to try it out.

    Or just use the ACE editor which has customizable syntax highlighting (It is the editor component of C9) http:// http://ace.c9.io

    Source code Load/Store support:

    Save files on a server using HTTP requests or via web socket messages, websockets will be needed for terminal communication with the Prop when it runs anyway.

    Or store files local, using HTML5 local storage APIs,

    How about Github integeration?

  9. #9

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    4. A Terminal


    In the browser you need term.js https://github.com/chjj/term.js


    term.js is a very nice VT100 terminal component for the browser It can communicate via websockets back to a server process which is connected
    to the Propeller via serial.


    A first run at this might be simple a node.js server handling the web socket connection on one side and the serial port communications on the other. It would also be responsible for accepting binaries and firing up a loader to program the Prop. The whole web sockets thing is very easy to deal with in
    node.js.

  10. #10

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Final thoughts.
    Sounds like it's all done.

    Apart from the actual "doing it" part of course


  11. #11

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Steve,

    This is a great thread and a super start to writing up the problem and a start on solutions.

    I agree with Heater. on most of this (ouch! Sorry man if that hurts your forum cred! )

    #1-#4 are all doable now except for gluing all the pieces together.

    #5 is going to always be the trickiest with the P1 (and probably the P2).

    Mike G did some early spinneret work with being able to download new images via the ethernet connection so that is doable. The bluetooth is being done with certain non-compiled languages as you know. I'd like to see if the new Xbee WiFi module Ken is playing with has some capabilities we can exploit for remote loading. We need to get some of those to play with!

    The trick is always going to be the low level wrapper that needs to be put around the code to be loaded and/or the small footprint network arware boot loader that needs to be developed/enhanced/maintained for the selected technologies. The P2 might make this a little easier with it's monitor program and larger memory capabilities.

    Outside of Chrome OS, I don't think you will be able to directly talk to a Propeller. I don't know if the OTG features on many Android tablets can be exploited to provide the booting/loading functions but then you are needing a little glue in the form of an Android app and limit your solution to Android tablets. The RasPi route has its drawbacks (but probably the least expensive solution).

    I'll certainly be following along and willing to play along whenever I get past my current distraction.
    MOV OUTA, PEACE

    ... Rick


    I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!

    "Forth is FUN!"

    Introduction to TACHYON Forth


    PropFORTH Wiki

  12. #12

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Jazzed,

    ..but how do I interact with it?
    I just found this nice presentation that shows how to call from C/C++ to JavaScript and vice versa. http://kripken.github.io/mloc_emscri...lk/qcon.html#/

    I haven't figured out what goes on with file I/O yet but if the worst comes to the worst we can always write our own fread/fwrite etc.

  13. #13

  14. #14

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Yay it works!

    The Open Source Spin Compiler does indeed run in the browser when converted to JS, Turns out we have to adjust the total memory allowed for the C memory space.
    I set TOTAL_MEMORY to 64 Mega Bytes (up from 16MB) in the emscripten settings and bingo it comes to life.

    Here it is: http://a.linuxsecured.net/openspin.html

    Point your browser at that and you should see the openspin sign on message. If you open your browsers JS console you should see openspin's usage instructions.

    Now, how to get command line args and files in and out of there...

  15. #15

    Default Re: A Propeller-WebTool Framework for Compiled Languages?


    Lots more to think about here.

    Heater, MikeG, Phil, and Rick: thanks for all the input so far. I hope we're building a team here ... at least core contributors are showing up.

    Heater, Wow Cool.

    MikeG, how hard would it be to write a bootloader on propeller that could also serve pages from the SD Card to the serial port?

    Phil, you've done so much already with code-warrior. It seems there is still much to do with respect to wrapping that into a web-app.

    Rick, if you're available, your wonderful word-smithy could be very helpful.

    I think Parallax could help here too since what we are discussing ultimately serves them.

    Two generic hardware connectivity cases seem most important (are there others?). 1) network connected devices, and 2) USB serial devices (most common case). Both cases have their own problems, but can be overcome. In 1) network connection, we need to carry the extra cost of external hardware and a bootloader. In 2) serial, we need to find a common way to connect - I've mentioned virtual serial port before, but the details need to be worked out.

    I've looked around at various Wifi modules. The one that seems most likely to meet the need is the Digi International XBee Wifi (I ordered this one also available here). Why? It has many regulatory approvals as a stand-alone unit, it has modern ad-hoc connectivity, it has strong documentation of API and other features.

    Parallax has an existing relationship with Digi, and hopefully some beneficial arrangements can be made ... assuming a qualifying solution.

    Much more to do....

  16. #16

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Quote Originally Posted by Heater. View Post
    Yay it works!

    The Open Source Spin Compiler does indeed run in the browser when converted to JS, Turns out we have to adjust the total memory allowed for the C memory space.
    I set TOTAL_MEMORY to 64 Mega Bytes (up from 16MB) in the emscripten settings and bingo it comes to life.

    Here it is: http://a.linuxsecured.net/openspin.html

    Point your browser at that and you should see the openspin sign on message. If you open your browsers JS console you should see openspin's usage instructions.

    Now, how to get command line args and files in and out of there...

    Sweet! Congrats!

  17. #17

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Yay, It also compiles stuff!

    Check http://a.linuxsecured.net/openspin.html again.

  18. #18

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Quote Originally Posted by Heater. View Post
    Yay, It also compiles stuff!

    Check http://a.linuxsecured.net/openspin.html again.
    Haha! I just hit the link with my iPhone and it compiled it! :0)

    There do appear to be some browser issues - I tried before on my cheap Android tablet and got the same error Steve got a few posts back. We'll need more testing and see if we need to limit browsers or can fix it for the trouble makers!

    We'll done, Heater.!!
    MOV OUTA, PEACE

    ... Rick


    I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!

    "Forth is FUN!"

    Introduction to TACHYON Forth


    PropFORTH Wiki

  19. #19

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    And...it does actually produce and eeprom file. If you visit again and open your browser JS console there should be something like this in there:

    Object {dev: 1, ino: 16, mode: 33279, nlink: 1, uid: 0}
    • atime: Sat Dec 28 2013 22:55:26 GMT+0200 (EET)
      blksize: 4096
      blocks: 8
      ctime: Sat Dec 28 2013 22:55:26 GMT+0200 (EET)
      dev: 1
      gid: 0
      ino: 16
      mode: 33279
      mtime: Sat Dec 28 2013 22:55:26 GMT+0200 (EET)
      nlink: 1
      rdev: 0
      size: 32768
      uid: 0

    That's a stat the 32768 byte eeprom file floating around in the browsers memory some place.

  20. #20

    Default Re: A Propeller-WebTool Framework for Compiled Languages?

    Thanks for the kind thoughtful message.....couldn't settle for an "um" or "uh"?

    By the way, it worked on my Samsung Android tablet running official Chrome!
    MOV OUTA, PEACE

    ... Rick


    I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!

    "Forth is FUN!"

    Introduction to TACHYON Forth


    PropFORTH Wiki

+ Reply to Thread

Similar Threads

  1. Graphical languages on the Propeller
    By Dr_Acula in forum Propeller 1 Multicore Microcontroller
    Replies: 11
    Last Post: 08-17-2012, 08:05 AM
  2. More Propeller Languages
    By Humanoido in forum Propeller 1 Multicore Microcontroller
    Replies: 16
    Last Post: 08-06-2012, 09:01 PM
  3. Propeller Languages
    By Prettybird in forum Propeller 1 Multicore Microcontroller
    Replies: 8
    Last Post: 05-31-2010, 06:20 AM
  4. Propeller robot framework
    By Timmoore in forum Robotics
    Replies: 13
    Last Post: 07-22-2009, 02:02 AM
  5. Propeller Languages
    By Humanoido in forum Propeller 1 Multicore Microcontroller
    Replies: 6
    Last Post: 05-17-2009, 01:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts