jshSaveToFlash takes what's in RAM, compresses it, and writes it into flash memory (which pages are used depend on the board). jshLoadFromFlash just does the opposite.
jshFlashContainsCode actually just checks for a 'magic word' in memory that shows that the flash has been written.
However you're best off implementing at a lower level and then flash memory access is available via the Flash module if required - see the STM32 implementation. I think the NRF chips have fixed page sizes? If so you're probably looking in the STM32F1 section of the ifdef, it should be pretty similar.
Info about what the functions should do is here - let me know if you're not sure though.
Finally, Espruino needs to know where the free pages are. It's just an entry in BOARD.pyhere that tells it.
flash_available is for the firmware size test that runs after compilation. If the pages used are right at the end of flash (they probably should be on the NRFs?) then that size is just the amount of flash minus the space used for storing code, like this
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.
jshSaveToFlash takes what's in RAM, compresses it, and writes it into flash memory (which pages are used depend on the board). jshLoadFromFlash just does the opposite.
jshFlashContainsCode actually just checks for a 'magic word' in memory that shows that the flash has been written.
However you're best off implementing at a lower level and then flash memory access is available via the
Flash
module if required - see the STM32 implementation. I think the NRF chips have fixed page sizes? If so you're probably looking in the STM32F1 section of the ifdef, it should be pretty similar.Info about what the functions should do is here - let me know if you're not sure though.
Finally, Espruino needs to know where the free pages are. It's just an entry in
BOARD.py
here that tells it.flash_available
is for the firmware size test that runs after compilation. If the pages used are right at the end of flash (they probably should be on the NRFs?) then that size is just the amount of flash minus the space used for storing code, like this