What do you mean by: and even whether you use external flash memory
You should be able to specify an object for flash as the last argument. If we have flash modules that implement read/write/getPage/erasePage (I think there was one?) then you can just use them.
are you putting the eeprom area by default just after the flashed code/data
STM32F4 has only a few pages, so there isn't any choice in the matter. It uses the page starting at 384kB - the one that the chip isn't supposed to have (but that exists anyway) - all the rest are used. I thought it said in the docs.
... and by using a page that the STM32 shouldn't have, it doesn't get overwritten by the bootloader :)
specify where the eeprom area should start?
That's the optional first argument of the module? I don't think it needs to go in the firmware...
CRC
Hmm... maybe - I wonder what the chances of it being wrong are? The flash memory seems very reliable - so much so I have now turned off verify when flashing as it just wastes time :)
Single page / two pages
It'd be nice to use a second page, but on STM32F4 there aren't enough pages, and on the F1 the pages are 1024 or 2048k, so storing the contents for that in RAM isn't a big deal (although yes, if it got interrupted while writing a page you'd lose stuff)
It depends what you've written to the EEPROM what memory gets used. You could obviously fill a 128kB page with data and it wouldn't rewrite, but if you just wrote values at maybe 100 addresses and changed them enough to fill up memory, rewriting would not be an issue.
I'll get rid of the readAll argument... That was a copy/paste bug :)
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.
You should be able to specify an object for flash as the last argument. If we have flash modules that implement read/write/getPage/erasePage (I think there was one?) then you can just use them.
STM32F4 has only a few pages, so there isn't any choice in the matter. It uses the page starting at 384kB - the one that the chip isn't supposed to have (but that exists anyway) - all the rest are used. I thought it said in the docs.
... and by using a page that the STM32 shouldn't have, it doesn't get overwritten by the bootloader :)
That's the optional first argument of the module? I don't think it needs to go in the firmware...
Hmm... maybe - I wonder what the chances of it being wrong are? The flash memory seems very reliable - so much so I have now turned off verify when flashing as it just wastes time :)
It'd be nice to use a second page, but on STM32F4 there aren't enough pages, and on the F1 the pages are 1024 or 2048k, so storing the contents for that in RAM isn't a big deal (although yes, if it got interrupted while writing a page you'd lose stuff)
It depends what you've written to the EEPROM what memory gets used. You could obviously fill a 128kB page with data and it wouldn't rewrite, but if you just wrote values at maybe 100 addresses and changed them enough to fill up memory, rewriting would not be an issue.
I'll get rid of the readAll argument... That was a copy/paste bug :)