phoddie / runmod Goto Github PK
View Code? Open in Web Editor NEWDynamically install JavaScript modules on a microcontroller
Dynamically install JavaScript modules on a microcontroller
I noticed that in the listed Built-In Modules (https://github.com/phoddie/runmod#host--built-in-modules) there doesn't appear to be graphics support.
Is that an upcoming feature (or one I overlooked), or outside the current scope for runmod?
I noticed that the http server appears to have been removed in favor of websockets. I can't seem to get my moddable zero visible on the network (says probe claimed runmod
) so that I can install a mod. Previously I was expecting to use simple browser requests ie runmod.local/config/setName/mynewname
, but now I'm having trouble verifying runmod on the network (can't ping, doesnt show up in any mDNS discovery), and I noticed there are some hardcoded paths in the html/
files.
Just curious if it is a transition state and I ought to wait a few days!
Wi-Fi connected to "HOME-4448"
IP address 10.0.0.2
/Users/nickreed/Projects/moddable/examples/experimental/runmod/main.js (37) # Break: require: module "mod" not found!
exception loading mod
host ready at runmod.local
probe for runmod
probe 1
probe 2
probe 3
probe claimed runmod
I'd like to re-implement installation of mods using http, but the current Websocket logic is opaque on how mods are installed. Where in the main.js or main.c is logic for installing a mod, or any of the remote commands infrastructure?
Currently I'm stuck on loading my built mods; there isn't a simple cURL command for uploading my .xsa file to the mzero running runmod, and using mcrun (on mac) has no apparent way to specify the URL needed for installing the mod (or is missing the ws logic). It fails using esptool (note that esptool.py is hardcoded in the mcrun/make.esp.mk file, but diff in mcconfig/make.esp.mk)
can you lead to some videos or starting material ( may be written or authored by someone else for some other purpose)
I hope that you don't mind a question by way of an issue. ๐๏ธ
I'm having difficulty finding the important bit of how the module is actually loaded. Maybe I'm understanding that xsbug is actually doing the heavy lifting of that? I'm not certain.
I would like to write a "helloworld" of sorts that is a proof of concept of loading byte code dynamically. Let's say I have a simply xsa file such as your helloworld mod. I'd like to do this pseudocode:
// I'll take the XSA file and list the bytes that make up the file. I'll just put its bytes here myself
// to keep this standalone program simple.
let xsaContent = Uint8Array.of(0x00, 0x00, ...).buffer;
// Probably other things are needed to get things ready...
// Now, load the module
let mod = loadModule(xsaContent);
// There may be other things necessary here...
// Run the module
mod.execute();
// Yay, I can see that the module ran as I see output!
We are excited to explore Moddable XS! We need the ability to run byte code dynamically. We've gotten dynamic execution with eval()
working, but would prefer to execute byte code to keep memory usage smaller. I bet that my little program may need to be written in C and use the various Moddable XS functions?
This issue is for discussion of using runmod
with WebUSB.
I pushed changes to runmod
today that provide the same functionality over USB as is available using WebSockets. The documentation has been updated with the relevant details throughout. The xsbug.js example has been updated with WebUSB support including separate new XsbugUSB
and XsbugWebSocket
classes to manage the two connection types.
I'm working on getting the piu/balls example running as a mod, but struggling to get the balls.png
Texture loaded. The mod breaks on throw new URIError("Texture " + it + " not found!");
I'm guessing that the Texture is expecting a url, but the image isn't included when building the mod from source (or the path changes, or the context is runmod
and not the actual mod)?
This also happens when trying the scroller
example: the require
breaks on importing the scripts (example works fine when running w/o runmod, or when bringing the scroller classes into the mod.js script)
Wi-Fi connected to "HOME-123"
IP address 10.0.0.4
host ready
/Users/nickreed/Projects/moddable/examples/experimental/runmod/main.js (182) # Break: require: module "scroller" not found!
I'm also unclear as to where main.act
is used by the example.
As discussed in Moddable-OpenSource/moddable#132 I am opening an issue here.
I just had a minute to test the integration of the new WebSocket-Debugger into the WebIDE. Looking well so far I started by just piping in the device log into the log area:
What would be great is a way to detect when the mod was uploaded and run. I am currently querying /mod/install
but it returns as soon as the upload was completed.
Another problem is the mixed-content problem regarding https/http on resources hosted on the device itself. Chrome is blocking these requests and you need to manual allow loading the execution. This is problematic for uploading and connecting to the unsecured websocket connection.
Are there patch files for using runmod on the simulator on a mac?
Following the build steps results in an error:
$ cd runmod
$ mcconfig -d -m -p mac ssid=xyz
...
# cc modResolve.m.o
# cc modsntp.c.o
# cc modwifi.c.o
# cc moddnsparser.c.o
# cc modPreference.c.o
# cc main.c.o
# cc modBase64.c.o
# cc modLogical.c.o
# cc modCrypt.c.o
# cc rfc1321.c.o
# cc rc.c.o
# cc fips180.c.o
# cc fips46.c.o
# cc chacha.c.o
# cc ghash.c.o
# cc fips197.c.o
In file included from /Users/nickreed/Projects/moddable/examples/experimental/runmod/main.c:16:
/Users/nickreed/Projects/moddable/xs/includes/xsesp.h:31:10: fatal error: 'malloc.h' file not found
#include "malloc.h"
^~~~~~~~~~
1 error generated.
make: *** [/Users/nickreed/Projects/moddable/build/tmp/mac/debug/mc/runmod/main.c.o] Error 1
make: *** Waiting for unfinished jobs....
This issue is for discussion of the XS and Moddable SDK tools for wasm.
Today we pushed changes to bring just about all the Moddable SDK tools to wasm. They include a new mcrun
tool to build mods from manifests, just as mcconfig
is used to builds hosts from manifests. In particular, mcrun
supports adding and transforming resources into the mod archive binary.
A brief introductory document is here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.