Problems with accessing storage_partition with nRF5340

Hi,

I have a working application where at some point, I erase some part of the flash with following code :

#define FLASH_STORAGE_PARTITION_DEVICE 		FIXED_PARTITION_DEVICE(storage_partition)

static const struct device *sFlashDev = FLASH_STORAGE_PARTITION_DEVICE;

[...]

flash_erase(sFlashDev, (u32)aPageAddr + (i * FLASH_PAGE_SIZE), FLASH_PAGE_SIZE).
 

On nRF52  aPageAddr is:                                                                                      

                          

(not sure why other variables are optimized out while I have -Og flag set and CMake build set to 'Debug')

On nRR5340 :                                                                              

            

On nRF52 it works fine, but on nRF5340, sFlashDev is process as 0x0, which is similar to Problems with accessing storage_partition in an MCUBoot-enabled application under Zephyr - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)
That make sense because as I use CONFIG_BT, I have 2 cores and partition manager handles the process. So I added a pm_static.yml : 

But it doesn't solve the issue. What am I missing? Thank you for your help

Parents Reply
  • Hhi, thank you for your answer

    Is there any reason why you are not using a library to handle persistent storage but instead writing directly to flash yourself?

    This code is part of an already existent code I would like to not touch for now.

    I don't use MCUboot.

    What I did to solve the issue is to remove the build configuration, and build it again. It seems that the pm_static.yml wasn't taken into account. Whenever I change this file, I need to remove the build config and start again. I tested by introducing random characters in the yml file and as long as I don't start over, it will compile. Only when I remove the build config and re-add the build config, the build fails. Now my correct pm_static.yml is taken into account and it's fine.

Children
No Data
Related