Flashing firmware without erasing factory data

Hi there

I'm working on nRF5340 chip and looking for a way to preserve the factory data that is saved in factory_data region. I tried playing around with the factory data related configs in Kconfig file, the closest config about preserve the factory data is CHIP_FACTORY_DATA_WRITE_PROTECT. However it seems not working with my configuration:

mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0x8200
size: 0xeee00
factory_data:
address: 0xf7000
size: 0x1000
region: flash_primary
settings_storage:
address: 0xf8000
size: 0x8000
region: flash_primary

The FPROTECT_BLOCK_SIZE for zephyr is 0x4000 and for multiprotocol_rpmsg is 0x800.

When using the flash option in VS Code(not the Erase and Flash to Board), the factory data region is not preserved after the flash. The factory data flash process is separated from app/nwk FW flash, so I can't call FPROTECT in the app firmware to lock the region 0x3000 before the factory data region. I'm hoping to find a way to preserve the factory data from flashing action from both VS code interface and command line interface.

Would moving factory data onto external flash work? Can I store the factory data to external flash by updating the factory_data region to "region: external_flash" and the address I'd like it to be on external flash?

Thanks,

Yuelin

Parents Reply Children
  • Hi Maria,

    I didn't see the document you referred discussing preserve flashed factory data after the initial flash, or any parameter to skip erasing the factory data region in subsequential firmware flashes.

    Is there a way to preserve factory data from being erased from subsequential firmware flashes? How can I ensure --sectorerase param doesn't erase the factory data region? I went through the nrfjprog page:Nordic Semiconductor Infocenter but didn't find any option to skip erasing factory data region.

    Playing around with CONFIG_CHIP_FACTORY_DATA_BUILD seems not changing the region to be erased before flashing as well.

    Thanks,

    Yuelin

  • In the preparation of factory data section you are creating a separate partition in pm_static.yml called factory_data which will be preserved during firmware updates. I do not think you can protect part of flash memory (which is not UICR or FICR) from sectorerase when using nrfjprog. It is possible to cut access to debugger overall but not part of memory. 

  • Hi Susheel, 

    Thank you for the response. When you say during firmware updates, do you mean via DFU? So for JTAG flash there's no way to preserve factory data, but for updating via MCUBoot, the factory data can be preserved. Is that correct?

    In terms of utilizing UICR or FICR, is there any page management API/logic other than directly write/read on an address?

    Thanks,

    Yuelin

Related