-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebIDE for development #116
Comments
Very cool that you have xsc and xsl running in the browser. Delivering byte code to the embedded device is preferred over delivering source code for several reasons. It saves flash by avoiding the need to deploy the parser to the device, and it allows larger scripts to be downloaded (as the parser is contained by free RAM on the embedded device). From XSL you should have a .xsb file (XS binary). That needs to be transferred to the device flash, for example using an HTTP PUT. I assume that's easy from the browser? After that, you'll need a small shell app to install and execute the binary. I can prepare that for you. It isn't very complicated, but I may not have time until the weekend. |
Yeah making a PUT/POST request isn’t the problem. Would be great if you could provide me with an example of how I would startup the VM running the *.xsb file on an ESP. |
Of course. I'll put together a small project. |
@FWeinb Do you have a pointer to your approach to compiling with emscripten? We got something similar working at https://github.com/Agoric/moddable/tree/wasm-spike to get XS to compile to wasm. We would like other eyes and usage on it, getting tests to run within that runtime, and to eventually get it into a pull request, so any info on related projects is welcome. |
@FWeinb - one question: what device target are you using? I was assuming ESP8266 but your comment didn't say. |
@FWeinb - I put together an example for you. It consists of a host application to run on the ESP8266 and three sample mods you can run on it. The only only tools needed are xsc, xsl, and some way to do an HTTP PUT. The details are a bit involved, so I also wrote a document explaining it. All the code and documentation is available here Building and Installing JavaScript Mods. The ability to dynamically install modules compiled to byte code is definitely an advanced feature, one that we are just starting to use. That's why there wasn't an example or documentation already in place. If you run into problems or have questions, please let me know. I've very curious to see this working from the browser. ;) |
@phoddie Sorry for the slow feedback. I was sick during the weekend, could not look into it. Will have a look at it this weekend. |
@phoddie Do I really need to compile these two files using an C-Compiler to then use Would it be possible to extract If that is the case I could write a simplified version of |
There's no need to run GCC to build JavaScript byte code binaries. The instructions posted here show the |
@phoddie sorry total missed that, thanks a lot. |
@phoddie In main.js:89-return {body: "done\n"}
+return {headers: ['Access-Control-Allow-Origin', '*', 'Access-Control-Allow-Methods', 'GET, PUT'], body: "done\n"}; I made a little video showing it in action (click to open on vimeo): To run it yourself go here.
Going forward I think it would be best to write a tool that simplifies the |
@FWeinb - that is awesome indeed. Congratulations! I will apply your HTTP header changes to the
In watching your video and running the previous version of your page, performance doesn't seem to be a concern. Changes to Would be you be wiling to share your code and build scripts? I'd like to be able to reproduce your build to be able to experiment further. Once we have some first-hand experience with XS on WAssm we will be in a better position to contribute to discussion of optimization. |
@phoddie I will need to clean this up a lot. I have no idea of the codebase and just wrapped stuff in But here is the basic idea I had:
One problem for building I hope I can clean this up tomorrow so you can have a look at what I did. |
@FWeinb - Thanks, I look forward to checking it out. Getting started with XS is a good challenge. ;) There's a lot there. You are off to a good start. We're happy to help find a way to make the wasm target maintainable moving forward. |
@FWeinb - thanks for the PRs. The changes do indeed look very small and straightforward. I'll have a chance to try them on the weekend. |
@phoddie Thanks! I worked on this a little more and wasn't satisfied with having to compile Another problem is that the During this weekend I build what I called I know that having another tool will be a maintenance burden but I think that having a leaner more specialised tool for compiling will greatly improve the usefulness of the wasm port. |
@FWeinb - I spent some time on the emscripten build from your PR. It gets part way and then fails with what appears to be a Java version error. I tried with Java 9 an Java 8, but the error was the same. Any clues?
Your latest WebIDE is a very nice step forward. It makes good sense to avoid having multiple copies of the wasm runtime, and to be able to share a file system between them. The question is how to do that in a way that we can support for the long term. That's not a small consideration, so it will take some time to sort out. We are, of course, interested in supporting a wasm build. You have unlocked a lot of potential with that. But first, we need to be able to build this here too so we can explore options too. |
@FWeinb - Figured out the Java problem. That gets further. Both xsc and xsl debug builds appear to succeed (there are xsc.js, xsc.wasm, xsl.js, and xsl.wasm files in the bin/wasm/debug). I will try running those tomorrow. However, the release build fails. Any ideas?
|
@phoddie Sorry for all these problems. I just updated to the latest version of Optimising these bundles will be done when building a web app using tools like |
@FWeinb - This feels like getting started with a new embedded target: getting the build set-up is half the battle. Removing |
@phoddie Just remembered. I had to add |
I updated the WebIDE to look more like a traditional IDE. You can load a gists and all modifications are persisted in the browser. This is far from perfect but we are getting there. Implementing Github OAuth should allow for saving/forking gists. Finishing the log area and integrate the compiler warnings into the code editor to highlight the errors etc. is on my todolist This is a very quick prototype, everything was build during |
@FWeinb this is awesome, nice work! Any chance you'd be willing to share the code for the WebIDE? I'm interested in experimenting with it as a tool for some upcoming workshops. |
@lprader thanks for your interest. I don’t feel good releasing this code before there is support to build the needed tooling implemented here. My recent PR was closed and I don’t know how long it will take to get a wasm build from this repo. I know this is will introduce a maintenance burden onto this project. Maybe @phoddie can help here? Sorry but I don’t have the time to maintain a separate fork of this repository in addition to developing the WebIDE. |
As discussed in #102 it would be great to have the ability to change/create/extend the script that is running on the device using some kind of WebIDE. It was suggested there that it would be possible to compile the JS code on the device itself.
I experimented with a different solution but don't know how useful it would be. I successfully compiled
xsc
/xsl
using emscripten and am able to compile JS in the browser now. I did not look into the whole architecture of this project, my initial idea is to transfer the generated buffer to the device and then execute them there.That is the point where I am currently stuck I don't know how I would go and execute the payload compiled by the browser.
Any pointers to how/if this could work?
The text was updated successfully, but these errors were encountered: