Bake JavaScript into firmware

Posted on
  • Is there any way to bake JavaScript into the firmware so it gets flashed with the firmware? I mean a JavaScript that gets executed after startup of the chip just like if I would have transferred it using the IDE?

  • @CanyonCasa I could be totally wrong here, but from the way @urbiman said "bake javascript into the firmware" leads me to believe he wants to compile a binary of Epruino with some javascript embedded so when he flashes it to a chip it already has the code on it and doesn't need to then be programmed by the WebIDE. Though I could be wrong.

  • @Ducky you are completely right, this is exactly what I would like to achieve. Any hints?

  • Sorry for the misunderstanding. I don't know how or if possible, but I would suggest looking at Espruino tools (i.e. npm install espruino). I just recently started using the command line. If you can't do it directly you can probably add on a processor or plugin to get there.

  • Upload your code via the ide, and test. Then you can use a command line tool to save the save area of eprom to a file - which board are you using as the method would be different for each board.

    Also - the saved code might not work on a new version of the firmware, as the addresses of functions can change - so any oninit() might not work correctly with an updated firmware.

  • Thanks @Wilberforce , can you maybe point me to a list or other source where I can find the area where the code is stored?

  • As @Wilberforce says, I'd suggest just getting it working, using save() or E.setBootCode(), then reading out the complete contents flash memory. You can then write that to any new devices - of course how you do that depends on the device you're using :)

    If you're compiling yourself you can compile in JS code to get executed pretty easily too, but it's realistically more painful than just reading what's in flash memory

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bake JavaScript into firmware

Posted by Avatar for urbiman @urbiman

Actions