Is there any way to bundle a script with the Espruino update file?
Ideally without clearing the entire storage with each update.
You mean the DFU ZIP file? The Espruino command-line tools do allow you to create a hex file direct from the source code, and you can then merge that with the Espruino hex file and upload that.
It's much easier to do the updates via SWD (using a physical connection) though - otherwise you'll have to sign the hex file and recreate the final DFU zip, which is a bit of a pain.
If you just want to upload firmware to Pucks, check out the Programmer app for Bangle.js: https://banglejs.com/apps/?id=espruinoprog
You can run it on a watch, and the watch will automatically connect and upload code to any device it sees. That is probably faster (and easier to test) than the Bluetooth DFU method.
The script file for my project depends on a custom build of espruino, so I was wondering if there was a way I could just include the boot code with the espruino update itself and get both in one shot
The puck.js Bluetooth update zip
you can include your own library with init code, see e.g one for microbit https://github.com/espruino/Espruino/blob/master/libs/microbit/jswrap_microbit.c#L144 or banglejs https://github.com/espruino/Espruino/blob/master/libs/banglejs/jswrap_bangle.c#L3202
This will however run on every boot, not once per DFU update. You could however create some marker file in the storage after first run so it is not run again.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem