This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Store data in flash with NRF52832 and MBED and GCC

Hi,

I'm trying to use an existing NRF51822 mbed codebase on a new NRF52832 product and am having some issues.

First of all, it seems that I can't use mbedlib, but need to update to mbed-os because BLE on NRF52832 isn't implemented for the old libraries. No problem.

I got things building with mbed-os with the rtos disabled using the .mbedignore file. However, my pstorage-based flash data storage isn't working. The callback never gets called.

From reading on forums and digging around in the source it seems that things have been switched internally to fstorage. Again, no problem. I didn't really want to update my code, but no big deal.

However, I can't get the FS_REGISTER_CFG macro to compile. I'm getting an error: "sorry, unimplemented: non-trivial designated initializers not supported".

I tried a number of ways to work around it but none of them have worked so far.

Is there some way to get this working with this toolchain? Or some way to continue to use pstorage? Would I be better off to just ditch mbed entirely?

Thanks!

Parents
  • You need to initialize the FS_REGISTER_CFG as follows:

    FS_REGISTER_CFG(fs_config_t fs_config) =
    {
        .p_start_addr = NULL,
        .p_end_addr   = NULL,
        .callback  = fs_evt_handler, // Function for event callbacks.
        .num_pages = NUM_PAGES,      // Number of physical flash pages required.
        .priority  = 0xFE            // Priority for flash usage.
    };
    

    It will compile cleanly then. Just remember that you need to have the SofDevice enabled (call ble.init()) otherwise the event callback will never be called (and your write_flag will stay set).

Reply
  • You need to initialize the FS_REGISTER_CFG as follows:

    FS_REGISTER_CFG(fs_config_t fs_config) =
    {
        .p_start_addr = NULL,
        .p_end_addr   = NULL,
        .callback  = fs_evt_handler, // Function for event callbacks.
        .num_pages = NUM_PAGES,      // Number of physical flash pages required.
        .priority  = 0xFE            // Priority for flash usage.
    };
    

    It will compile cleanly then. Just remember that you need to have the SofDevice enabled (call ble.init()) otherwise the event callback will never be called (and your write_flag will stay set).

Children
No Data
Related