Zephyr - Executing "flash_erase" with the last flash page causes a system reboot

Hi all,

What's happening?

System reboots when "flash_erase" is called with parameters offset 0x1f000 and size 0x1000

Setup:

  • NCS v2.0.0
  • nRF52832 with 512K flash
  • Flash partitions:

/delete-node/ &slot1_partition;

/delete-node/ &scratch_partition;

/delete-node/ &storage_partition;

&flash0 {

    partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;

        boot_partition: partition@0 {
            label = "mcuboot";
            reg = <0x00000000 0xC000>;
        };
        slot0_partition: partition@c000 {
            label = "image-0";
            reg = <0x0000C000 0x33000>;
        };
        slot1_partition: partition@3f000 {
            label = "image-1";
            reg = <0x0003F000 0x33000>;
        };
        scratch_partition: partition@72000 {
            label = "image-scratch";
            reg = <0x00072000 0xA000>;
        };
        storage_partition: partition@7c000 {
            label = "storage";
            reg = <0x0007C000 0x00001000>;
        };
        mem_partition: partition@7d000 {
            label = "mem";
            reg = <0x0007D000 0x00001000>;
        };
        eeprom_partition: partition@7e000 {
            label = "eeprom";
            reg = <0x0007E000 0x00001000>;
        };
        secure_partition: partition@7f000 {
            label = "secure";
            reg = <0x0007F000 0x00001000>;
        };
    };
};
 

 

  • project configuration
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_SOC_FLASH_NRF=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y

Code:

#define DRV_SECURE_START_ADDR					FLASH_AREA_OFFSET(phsecure)
#define	DRV_SECURE_FLASH_SIZE					FLASH_AREA_SIZE(phsecure)



static const struct device *secureDev;


void test (void)
{
    //
    //  Test function
    //
    
	secureDev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));

	if ( true == device_is_ready(secureDev) )
	{
		printk("Secure start addr: %08X and size %d", DRV_SECURE_START_ADDR, DRV_SECURE_FLASH_SIZE);
		
        //  Erase secure area
        
        flash_erase(secureDev, DRV_SECURE_START_ADDR, DRV_SECURE_FLASH_SIZE);
        
        //  Do anything ....
        
	}
	
}

Debugging step by step, I've seen that the system reboots when MULTITHREADING_LOCK_RELEASE(); is called inside the function "nrf_flash_sync_exe". 

Does anyone have an idea of what is happening?

Thank you

 

this function is called inside the function 

Parents Reply Children
No Data
Related