After being away for a year it's nice to see all the progress on Espruino!
I did struggle for quite some time to update my stuff and to get my code working again under V2.01, so I thought I'd write up a quick how-to so I remember the next time I try to do something :-) Maybe it also helps someone else 'cause very little of this is spelled out anywhere that I could find (the best info is at http://www.espruino.com/Saving but that page is not linked to from any other page on http://www.espruino.com!)
Requirements:
I have a bunch of apps that are fairly large and must run from flash.
I use local modules.
The apps must run auto-run at boot time.
I prefer CLI over the IDE.
I couldn't do an OTA update from pre-V2 of Espruino to V2.x due to a changed flash layout (512 vs 1024KB partitions). I have esp-12e modules with 4MB flash, so I installed the official espressif tool https://github.com/espressif/esptool/ and flashed using:
In the IDE I had to set the options SAVE_TO_FLASH to 1 and MODULE_AS_FUNCTION to true. But I don't want to use the IDE...
So I installed the espruino cli:
Install node.js version 8 (old!), I'm using Linux and untarred the binary archive from the node.js site in /home/sw/node-v8 (non-std location, use any dir you like)
Install espruino using /home/sw/node-v8/bin/npm install espruino
In order to ensure that I can run the cli using node-v8, I created a little shell script I call espruino-v8:
To flash an application I have the main file in a projects subdirectory and the modules in a modules subdirectory. I simply require(...) the module in the main file. The flashing command is:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
After being away for a year it's nice to see all the progress on Espruino!
I did struggle for quite some time to update my stuff and to get my code working again under V2.01, so I thought I'd write up a quick how-to so I remember the next time I try to do something :-) Maybe it also helps someone else 'cause very little of this is spelled out anywhere that I could find (the best info is at http://www.espruino.com/Saving but that page is not linked to from any other page on http://www.espruino.com!)
Requirements:
I couldn't do an OTA update from pre-V2 of Espruino to V2.x due to a changed flash layout (512 vs 1024KB partitions). I have esp-12e modules with 4MB flash, so I installed the official espressif tool https://github.com/espressif/esptool/ and flashed using:
In the IDE I had to set the options SAVE_TO_FLASH to 1 and MODULE_AS_FUNCTION to true. But I don't want to use the IDE...
So I installed the espruino cli:
/home/sw/node-v8
(non-std location, use any dir you like)/home/sw/node-v8/bin/npm install espruino
In order to ensure that I can run the cli using node-v8, I created a little shell script I call
espruino-v8
:To flash an application I have the main file in a
projects
subdirectory and the modules in amodules
subdirectory. I simplyrequire(...)
the module in the main file. The flashing command is:The -w option means that espruino stays connected and shows me the console output.
The application uses an
onInit()
to start and that gets invoked automatically at the end of the upload.