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

How to know it started first time after flash firmware.

I'm actually writing some data to the flash. I'm using pstorage api interface.

But whenever I flash the new firmware, I get some garbage data. in my main function I would like to know that, after flashing a new firmware, it started for the first time, so I clear the garbage data, and want to make sure it is not result of a reset or a manual reset etc.

Thanks

Parents
  • Hi mobi,

    I called it flags, but it could be anything that you set in flash.

    I am not fully understand what you meant by "waste data". If you want to erase/modify something on flash, you would need to erase the whole page (1024 byte). To write data to an address in flash when programming, you should use attribute and set the address and the value you want to write to flash. You can refer on how we do it in file bootloader_settings_arm.c in the dfu bootloader example in the nRF51 SDK.

    For example here we write BOOTLOADER_REGION_START value to NRF_UICR_BOOT_START_ADDRESS address:

    uint32_t m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOT_START_ADDRESS))) = BOOTLOADER_REGION_START;
    
Reply
  • Hi mobi,

    I called it flags, but it could be anything that you set in flash.

    I am not fully understand what you meant by "waste data". If you want to erase/modify something on flash, you would need to erase the whole page (1024 byte). To write data to an address in flash when programming, you should use attribute and set the address and the value you want to write to flash. You can refer on how we do it in file bootloader_settings_arm.c in the dfu bootloader example in the nRF51 SDK.

    For example here we write BOOTLOADER_REGION_START value to NRF_UICR_BOOT_START_ADDRESS address:

    uint32_t m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOT_START_ADDRESS))) = BOOTLOADER_REGION_START;
    
Children
No Data
Related