safe to use NVM space?

I see in the example code there is

#define FLASH_PAGE_SYS_ATTR (BLE_FLASH_PAGE_END - 3)                    /**< Flash page used for bond manager system attribute information. */
#define FLASH_PAGE_BOND (BLE_FLASH_PAGE_END - 1)                    /**< Flash page used for bond manager bonding information. */

Does that mean "(BLE_FLASH_PAGE_END - 4)" is safe to use for my own NVM storage?

Do I need to adjust my IROM length in Keil's project build configuration?

Thanks

  • Any flash area that is not used by your application is safe to use. You can calculate which area is safe by looking at the sizing output from Keil at the end of compilation, and doing the math, but there isn't any magic way to find such area.

    By adjusting the the IROM size in Keil, you will get errors from compilation if your app tries to extend into this area, so that's something I'd normally recommend you to do.

  • Your code has another hidden area that I didn't know about, apparently "(BLE_FLASH_PAGE_END - 2)" is reserved for logging error exceptions. I'd rather see one page where all of this is documented, or a better method being used, such as a linker file symbol and attributes.

  • I agree that it could have made sense to use other ways to place this data in flash, but I wouldn't expect this to change soon. As far as I've understood, your suggestion would have required the use of what Keil calls a scatter file, and that is only supported by the professional version of the ARM-MDK. We also want to support the evaluation version, so this is unfortunately not an option, even though I agree that it could have been a cleaner way to do it.

Related