nRF Connect SDK -place variable in flash at predefined location

Hey all together,

I'm using nrf Connect SDK 2.0.0 and want to place a variable in flash at a predefined location. The reason is, that I need to read the information stored in this variable from the resulting hex file.

How can I do this? 

The "settings software module" places it somewhere in the reserved flash segment for user content. Thus I can not use that.

Thx in advance!

BR Hauser

  • Hey Jared,

    got it what you are writing. We are using UICR->Customer register for similar topics on nRF52 series.

    Good to know, how the flash area can be reduced to add "external" hex content. Thank you for that information. That's really helpful to solve the problems where the flash content won't be updated after production.

    In other tasks, we gonna store firmware characterisation information (name, version,...) in such flash segments. These obviously must be updated during later firmware update process. Thus it must be part of the application image.

    My impression is, that Zephyr does not provide such a function (to store data at specific memory addresses within the firmware image) as it would come into conflict with the integrated firmware update process.

    Do your engineers agree on that?

    Thank you and best regards,

    Hauser

  • Hi,

    I forwarded your question to our developers and they said that you can place data at whatever offset you want as long as it's within the slot start and end address with a customer linker section. You can read data from that location in the image when it's running, but you wouldn't be able to read it from another image or from a common area. If you want a common area, then it makes more sense to just use any of the other settings/nvs/lfs sections which would be common to any image compiled for the platform, then you could just update the file/settings on that shared area.

    Here is an example that shows how to alter the linker script and define your own custom section, the use case is a bit different though.

    regards

    Jared 

Related