Tool/software: Code Composer Studio
Hi, I'm working on a CC1310-based design where the firmware needs to ability to erase the entire flash, including itself.
I can see from the SimpleLink CC13x0 SDK version 2.20 in driverlib.elf and driverlib.c that there is a FlashBankErase function, but there's no corresponding entry in the ROM API table for it. Is there a recommended way to do a true mass-erase using existing TI APIs?
I could do a sector-by-sector erase using the TIRTOS NVS driver, but this seems like it would run into problems:
- If I erase all of flash, that includes the NVS driver code (or one of its dependencies), which will eventually cause it to crash
- Even if I avoid issue 1 by copying the driver code to RAM or placing it in a protected sector of flash, there is still the possibility of losing power in the middle of the erase and having some sectors unerased. This could lead to bricking the device and/or leaking information.
- I could put in a minimal bootloader that just ensures that the application is fully valid or fully erased before transferring control to the ROM bootloader. This is kind of messy because it requires modifying the CCFG sector because there is no way for firmware to start the ROM bootloader itself.
- I could put in a full secondary bootloader with internal encryption keys, etc, but that is a substantial engineering investment for a very infrequent use case.
My preferred solution would be to set some internal register that triggers a hardware mass-erase on the next reset, similar to the request described by the CHIP_ERASE_DIS_N bit in the ERASE_CONF CCFG register.