I want to upload a file (big binary) to extranal Flash at a specific start address (0x0000...) in Web Ide, and i don't want do this with File Storage.
Can i use these apis just like require("Flash").write(data, addr) and E.pipe(source, destination, options)？Will this work?
E.pipe(source, destination, options)
Can some one give how to do it?
What device are you using? Bangle.js, or something else?
Honestly I'm not sure you're going to have much luck trying to force the Web IDE in to uploading a file - the file upload there is designed to use Storage.
The best solution is:
Base 64 Flash Write
And you should be sorted!
If you want to automate it, it should be reasonably easy to mash the File Converter code together with the Web Bluetooth example at http://www.espruino.com/Web+Bluetooth to make a website that will upload directly
Thanks for your feedback.
I'll do as suggested,and I'm playing with a fitness tracker based board nrf52832
Which tracker? BTW beware that you also need to erase the memory before writing,the file converter generated code does not do it for you.
Here is another example that rewrites bootloader in DK08 smartwatch https://github.com/fanoush/ds-d6/blob/master/espruino/DFU/DK08/DK08-bootloader.txt
I'm sorry, i'm late! @fanoush Thx for your reminder, i had a LENOVO HX03, and spent some time to learn stuff, flash, page, pipe etc... and tested your dsd6 init file ;-) worked fine, lots of help!
And i found a problem will brick my device when i used the following code on Webide's left sides:
index.js:92927 ---> "require(\"Flash\").read(1,'0x60400000')"
index.js:92927 >>> Sent
index.js:92927 BT> SEND ERROR: NotSupportedError: GATT operation failed for unknown reason.
index.js:92927 BT> Disconnected (gattserverdisconnected)
As the address '0x60400000' is not exist, may be ??
Fortunately, the lower battery ;-) you know.
There is nothing at that address, see https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/memory.html?cp=4_2_0_7#memory , that's why Espruino now uses 0x60000000 as offset to map external SPI flash there. However HX03 does not have any external SPI flash(?)
As for reading single value from memory memory there is also peek8,16,32
Also worth noting you should just use require("Flash").read(1,0x60400000) and not require("Flash").read(1,'0x60400000') - so you don't need the quotes.
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