Shop OBEX P1 Docs P2 Docs Learn Events
A Propeller-WebTool Framework for Compiled Languages? - Page 21 — Parallax Forums

A Propeller-WebTool Framework for Compiled Languages?

1151617181921»

Comments

  • msrobotsmsrobots Posts: 3,704
    edited 2014-05-08 17:57
    @Michel

    well, If you need something to do here a ordered list...

    a)
    PropTool has something called Identify Hardware, Iterating thru all serial ports and checking if it finds a propeller connected to it.
    Should return a list of strings. load RAM and burn EEPROM could then use the string as parameter for PorpellerLoad to select the Propeller to be loaded instead of using the first one.

    b)
    Some sort of access to serial ports to create a simple Serial Terminal Web Page.
    Somewhere in the beginning of this thread @Jazzed had some link to github? where he had some JavaScript Terminal. @Heater mentioned a link to another one.

    c)
    alike b) but in some weird way.
    PropellerLoad has some terminal option, using stdin/stdout? can we map that somehow to the webworker currently calling your propeller load action?
    - output stdout line by line via log()
    - provide input to stdin via Msg from htm to webworker?

    d)
    alike c) but more weird
    provide access to some sort of shell (command.com/bash/whatever should be installed on target machine).
    redirecting stdin/err/out from the system thru java to the webworker and then to the editor and back.

    this would even allow to run PropGCC if installed on the target system. Or any other cmdline tool.

    you did mention the word challenge, didn't you?


    Me? - I still fight with JavaScript. Some code allows me to do a 'use strict', other does not. I still can not figure out why. My hope is that the Jslint support in the editor will give me some clues now.

    JavaScript has some interesting concepts, not supported at all by my daily workhorse C#. So I need to wrap my head around it to stop myself from trying to program C# in JavaScript but use the features of the language.

    I did that before and do not try anymore to use COBOL features in C#. Except after doing some COBOL side jobs. Then I am back into it...


    Seriously I would be fine with a)

    You already provide a list of com ports with the get request to /webapp/propeller.action as far as I remember, Are those just com ports connected to a propeller, or are this all available comports?
    Adding a parameter to select a com port to /webapp/propeller.action should not be so complicated. Alas you have win/mac/Linux with different naming conventions. But propellerload seems to handle this.

    But this may not be enough of a challenge to you for a weekend.

    maybe b) is.

    And b) is part of that original plan of @jazzed, who started this thread. See post#1.

    c) and d) are just for teasing. But d) would allow me to run GNU COBOL (ex OpenCobol) from within the browser...

    Anyways. If you are bored somehow over the weekend you have some ideas now ...

    Enjoy!

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-05-08 21:30
    msrobots,
    I still fight with JavaScript. Some code allows me to do a 'use strict', other does not. I still can not figure out why.
    Can you post some examples of code that is giving you trouble there? I may have already done the fighting with your problems and be able to see what the issues are.

    My hope is that the Jslint support in the editor will give me some clues now.
    Which editor are you using? Recently I have been using Sublime Text editor http://www.sublimetext.com/ when you install the Jslint plugin it highlights all jslint errors with big red dots at the beginning of the lines and puts red squigglies under the error position. It does all that as you type.

    I can't live without that any more. You can use Sublime forever for free but we paid up for some licences. First time I have actually been happy about paying for a piece of software since last century.
  • Heater.Heater. Posts: 21,230
    edited 2014-05-08 21:35
    I'd like a VT100 terminal emulation running in the browser talking to the Propeller via a websocket connection to the server.

    If I had the time I'd be playing with this:

    https://github.com/chjj/tty.js/

    and or this
    https://github.com/chjj/term.js
    One is based on the other.
  • idbruceidbruce Posts: 6,197
    edited 2014-05-09 00:45
    From what I read (several pages), this is a nice collaborative effort.

    Considering that I am not into all the neat electronic gizmos, such as Ras, what is the key benefit to having a remote (web based) compiler as compared to local (PC)?
  • Heater.Heater. Posts: 21,230
    edited 2014-05-09 01:05
    Good question Bruce.

    I think the point is you don't need a PC or laptop with any special IDE or other software installed on it. Whatever machine you happen to be in front of, any where in the world you find it, can run a browser and allow you to write Spin code and load it to some remote Propeller system for testing or even live usage.

    How cool is that?

    A lot of this impetus came from some requests from Parallax as to how to enable a class room full of iPad users the possibility of editing Spin code and programming some robot or whatever.

    From a developer perspective, why mess around creating and maintaining executables of your compilers and IDEs and other tools for upteen different platforms, Windows, Mac, Linux, Raspberry Pi etc etc. Just provide a web based solution and anyone can use with any machine or OS that has a browser.

    Bottom line is, traditional applications like IDE's are becoming obsolete.
  • idbruceidbruce Posts: 6,197
    edited 2014-05-09 01:09
    Heater

    Thanks for the explanation.

    I can now see how that would be beneficial.
  • msrobotsmsrobots Posts: 3,704
    edited 2014-05-09 01:51
    @Heater.
    Heater. wrote: »
    msrobots,
    Can you post some examples of code that is giving you trouble there? I may have already done the fighting with your problems and be able to see what the issues are.

    see source of editor19.htm,... last 3 functions for example...
    Heater. wrote: »
    Which editor are you using? ...

    Editor19.htm

    I eat my own bread.

    works quite nice now using Michel L.'s server.

    see post #600 for latest source

    Enjoy!

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-05-09 02:07
    OK, I'll try and find a moment to catch up with Editor19.
    I eat my own bread.
    That is damn cool if you have jslint integrated in there. I really have to check this out.
  • Michel LMichel L Posts: 141
    edited 2014-05-09 02:56
    Mike,

    most of it I already planned to do for BlocklyProp. So, I'll be working on it on sunday.

    As far as I know the listed com ports are all the available ports. It's what I get from PropellerLoad. I don't know if it checks if they are connected to a propeller.
    The way to configure a com port when loading a program is partially defined. It will only be a little work to finish that.

    The terminal might not be finished in one day as I have to set up websockets. But I'll probably give you serial access to the propeller and also a command console as you asked so nicely.
    I don't think I'll use the serial system from the PropellerLoad executable as that would mean writing the serial system twice. One for a direct connection after you've loaded your program into the prop, and one to create ad-hoc serial connections.

    For BlocklyProp I'm thinking about adding Prop-gcc, Allowing you to compile the Prop-c programs the same way as a Spin program. Should I add that capability to the propeller-web-loader project?

    Michel
  • Heater.Heater. Posts: 21,230
    edited 2014-05-09 06:10
    msrobots,

    Attached is a linted version of the javascript extracted from Editor19.htm, from "Heater. rocks!" downwards :)

    There are still 29 errors.

    Most of them are complaints about using "javascript:" URLs in hrefs. It's best to set onclick handlers instead and set the hrefs to "#".

    There is a couple of wonky uses of constructors that I have not figured out how to fix yet.

    There are a couple of errors in my code, in regexps, that I will have to look at.

    Sadly I hit the jsformat button in Sublime before I removed some last remaining script tags which has cause it to insert some spaces in strings used in the last couple of functions. So for example "GET" become "GET " and so on.
  • msrobotsmsrobots Posts: 3,704
    edited 2014-05-09 18:19
    @Michel,

    thank you for supporting my list. I was already thinking that BlockyProp will need some the same things.

    As of PropGCC - that would be the icing on the cake. I am not using C much, but the current editor supports already syntax highlighting and simple code completion for Spin/Pasm and C, C++.

    As for integrating the whole shebang into the project? Do we need that?

    If you can build some reasonable to handle redirect of stdin/stdout and stderr from a command prompt we could call ANY installed compiler on that system...

    PropBasic here we come...

    as for the serial terminal - I also see websockets as useful there. It is just that my poor spinneret has none and I will need to find some way around...
    So go ahead with websockets if you can do that. Any Serial Terminal is better than none as of now.

    And don't hurry. I still work on integrating your webrequests into Editor20.htm. WIP.

    Simple serial access sounds very interesting to me. I am rewriting some spinneret code of mine to match your /webapp/xxx.action? schema. So the editor will behave the same on spinneret and your java server.

    Remember - Its all about having fun with it!


    @Heater,

    thanks. I repaired the unneeded spaces and some other minor things. It is back in editor20.htm, assimilated again and working fine.

    jslint (via jshint from your Crockford Guy) and csslint (by stubbornella) will by now just work on .js or .css files respectively. I was not able to integrate this into the html-mixed mode, yet. WIP.

    You should have told me about stubbornella. Not just about that Crockford Guy. She is way more pretty than him...

    Enjoy!

    Mike
  • Michel LMichel L Posts: 141
    edited 2014-05-11 14:40
    Mike,

    I've been having fun today, I've managed to do 2 things from your list. Although the second one may need some finishing work)

    The first: you can now add an extra argument when loading code into the propeller. The argument is called 'comPort'. It's untested, so, let me know if you find bugs when you implement it.

    The second one was real fun: using websockets (a new part I had to learn) and jSSC (java-simple-serial-connector, also a lib I've never used) I added serial communication to the application.
    Using the links Heater provided I looked at what was the easiest to implement and chose term.js (https://github.com/chjj/term.js), It's the only one I found that didn't require node.js.

    There were some quirks to work out but I've got it working. I also added a couple of functions to better match the propeller serial terminal. That part is not yet complete I think, but I've been able to run the 'Parallax Serial Terminal Demo'. Just add a little waitcnt to give yourself time to open the console.

    I've packaged the propeller web loader (still with editor version 18) and added a serialtest.html that will open a serial connection (currently hardcoded to COM4). Just have a look at the contents on how to integrate it in your application. It's quite easy:
    • Open a websocket connection
    • Create the terminal object
    • Add callback-functions to both to put output from the websocket into the terminal and opposite
    • Open the terminal in a specified browser element

    When the connection is open and the user has selected the COM port send: '+++ open port xxxx' through the connection, where xxxx is the com port name.

    Michel
  • msrobotsmsrobots Posts: 3,704
    edited 2014-05-11 20:14
    Michel, your Belgian Wizard,

    I just got off work and will look at this. Need some food first.

    Thanks.

    Mike
  • John MintonJohn Minton Posts: 23
    edited 2014-05-19 03:13
    I know that you can write a program in ANSI C or similar language, compile those functions to a DLL file. You can modify the PHP configuration file to include that DLL file - This would allow PHP to make calls directly to that DLL file and run it's code. So I always thought you could use Javascript to create an editor, and when the code is ready you submit it to PHP where it will then be compiled and flashed to the propeller. Or if the code was compiled, you could write some code in the propeller itself to load compiled code to the either ram or eeprom. I'm not certain about how the propeller updates ram or eeprom, but I know that PHP could potentially make command calls, or calls to DLL functions, to pass code to be compiled and loaded to the propeller.
  • msrobotsmsrobots Posts: 3,704
    edited 2014-05-19 16:53
    Hi John,

    yes. There are many ways to skin a cat.

    @David provided a WIFI solution with the S6B Module Parallax sells. This requires a resident boot loader on the propeller to read the incoming data and writ to the upper eeprom.

    @Heater 'transpiled' the OpenSpin C source to JavaScript to run it from the browser. But getting access to the serial ports seems to be more complicated. So even after 'transpiling' PropelllerLoad to JavaScript the loader wont work for security reasons.

    @Michel L. chimed in and provided a Java Server, doing about what you are describing above and giving access to serial Ports and PropellerLoad.

    Certainly this may be possible with PHP also. But nobody did it, yet.

    Me? I am trying to integrate all of this in the HTML/JavaScript - based Editor/IDE I am working on as my spare time allows. (I do not have much of it lately)

    So I am lagging behind the Belgium Wizard, still trying to catch up. On his BlockyProp Thread @Michel L. is already working on integration of PropGCC into his JavaServer.

    Why we are doing this? I do not really know. For me its just FUN.

    Enjoy!

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-07-25 13:59
    I don't like to raise false hopes but I'm just a bit excited about this.

    I have just managed to build the Propeller loader from propgcc using Emscripten. I now have a Propeller loader compiled to LLVM bitcode.

    That means we are a couple of steps away from having a Javascript Propeller loader that can be used in the Chrome browser as a Chrome app or extension or whatever they call it.

    We know that we can drive serial ports from Chrome apps, I have done that with the Espruino IDE.

    Hopefully msrobots can use this in his browser based Propeller IDE which can easily be turned into a Chrome app.

    Still needs a bit more work....
  • Heater.Heater. Posts: 21,230
    edited 2014-07-25 14:00
    By the way, msrobots, where are you up to with your IDE?
    It's been very quite here for a while.
  • msrobotsmsrobots Posts: 3,704
    edited 2014-07-25 16:26
    @Heater,

    well - besides keeping my main job running (using C#) I am deep, deep in COBOL Land. No time for propeller fun.

    Once in a while I check my spinnerets - both working nicely without problems. The latest Version?

    I go and check my uploaded Attachments ... attached here again.

    As far as I remember everything works as advertised. So I started working on the spinneret side of things again, since the editor/compiler was working.

    By now you can program a prop via SB6 WIFY and David's loader. Or program a prop using @Michel L's Java based loader. Both are implemented as webworker so you can change them or add another...

    Since my Goal is to run this completely from a spinneret I shrunk down the spinneret-msrobots Firmware code and was able to add a Version of @Chips "PropellerLoad in Spin". The needed modifications to load a file from SD card where already done by the famous @Mike G. I just needed to adapt them a little bit to fit.

    I was happily searching my toolbox for the Daughter Board Adapter when I answered the phone and somehow my past grabbed me and pulled me back.

    So keeping my fulltime daily job running smooth AND reviewing a large COBOL project leaves no space in my Brain for Spin, PASM or JavaScript.

    Summary:

    The project is on hold until further notice. The attached files are the latest Versions and working properly.

    To implement your JavaScript based loader just look at the webworker for BlockyProp. Copy and change...

    Enjoy!

    Mike
  • mindrobots wrote: »
    The .js components can probably be minified once they are finalized into a release level, that should make them smaller.

    I just minified the .js using this - it went from 1699kb down to 640kb.

    I wanted to test the big source versus the minified source on my PC so I copied Heater.'s .html and .js down to my PC but when I run it locally, openspin.js gives me this error;
    11:35:33.866 file:///C:/MyCode/javascript/openspin.js
    11:35:33.908 NS_ERROR_DOM_BAD_URI: Access to restricted URI denied
    
    from source line 46 - are there some helper .js files (or others) that are generated from emscripten that I might be missing?

    I want to have the two different .js files generate some non-trivial Spin to see if they both work.

    This is currently being done on Windows7 under Firefox - this combination works fine with your test site.

    thanks, it's useful.
  • Heater.Heater. Posts: 21,230
    Awesome piece of work. Not something I would ever use but awesome none the less.

    Sadly the Spin compiler in the browser, that was the subject of this thread when started by Jazzed all that time ago, frizzled out. Both msrobots and I seem to have been distracted by the demands of life and whatever and nobody else wanted to carry the flag.

    Which is a shame because all the parts we need were shown to work at some point. The Spin compiler in JS in the browser, the syntax highlighting editor, and I believe there is a working propeller loader in JS somewhere.

    Put that all together and you have a web based Spin IDE that can work as a Chrome extension or an Electron app.

    Oddly I met Jazzed in San Jose a little while ago and we never mentioned this effort.

Sign In or Register to comment.