Reserve some spaces in a partition

Hello,

I'm using the nrf connect SDK v2.5.0.

For historical reasons (devices working with the nrf5 stack at my clients), I would like to reserve part of the bytes located in my "app" partition:


app:
address: 0x27000
end_address: 0xE4000
region: flash_primary
size: 0xBD000

Actually I want addresses 0xD0000 to 0xD1000 to not contain any application data.

To explain why, it's because I plan to update the application of the devices running at my customers (devices running with a modified bootloader of the nrf5 sdk) to an application that is based on the nrf connect SDK. And the addresses 0xD0000 to 0xD1000 are modified by this old bootloader, so I have to find a way so that the bootloader does not overwrite the new application that I have loaded on the old devices.

Thank you

Parents
  • Hi,

    I see that you want the empty/not to be used region to be located roughly in the middle of your application space. Is this for the NCS based application or nRF5 based application? Will this empty partition be filled with something when you do DFU from nRF5 to NCS? 

    Will the application fit within 0x27000 -> 0xd0000 or do you intend to split it into multiple regions?

    Initial thoughts is that you can define the partition with a custom name, or to my understanding you could even define it as an empty partition in the static pm. This will in turn not be used by NCS unless you specify that this area is to be used in the app itself.

    Kind regards,
    Andreas

  • Hi,

    Yes it's for the NCS based application (afterwards I will update a device that has an nrf5 SDK bootloader with this application based on the NRF SDK).

    In devices that are in the field (with the nrf5 sdk), the application goes from address 0x27000 to 0xE0000.
    So I would like to be able to do the same thing so as not to waste space for my new applications. I just want the addresses 0xd0000 to 0xd1000 not to be used by the linker to put application code there.

    If I change my pm_static.yml to the app covers the other partition like this:

    app:
      address: 0x27000
      region: flash_primary
      size: 0xB9000
    storage_data:
      address: 0xD0000
      region: flash_primary
      size: 0x1000


    I have this error at the compilation time:
    Partition manager failed: Incorrect amount of gaps found in static configuration. There must be exactly one gap in the static configuration to support placing the dynamic partitions (such as 'app'). Gaps found (2):0x27000-0xd0000 0xd1000-0xe0000 The most common solution to this problem is to fill the smallest of these gaps with statically defined partition(s) until there is only one gap left. Alternatively re-order the already defined static partitions so that only one gap remains.


    Isn't there a way to ask the linker not to write at these addresses?

Reply
  • Hi,

    Yes it's for the NCS based application (afterwards I will update a device that has an nrf5 SDK bootloader with this application based on the NRF SDK).

    In devices that are in the field (with the nrf5 sdk), the application goes from address 0x27000 to 0xE0000.
    So I would like to be able to do the same thing so as not to waste space for my new applications. I just want the addresses 0xd0000 to 0xd1000 not to be used by the linker to put application code there.

    If I change my pm_static.yml to the app covers the other partition like this:

    app:
      address: 0x27000
      region: flash_primary
      size: 0xB9000
    storage_data:
      address: 0xD0000
      region: flash_primary
      size: 0x1000


    I have this error at the compilation time:
    Partition manager failed: Incorrect amount of gaps found in static configuration. There must be exactly one gap in the static configuration to support placing the dynamic partitions (such as 'app'). Gaps found (2):0x27000-0xd0000 0xd1000-0xe0000 The most common solution to this problem is to fill the smallest of these gaps with statically defined partition(s) until there is only one gap left. Alternatively re-order the already defined static partitions so that only one gap remains.


    Isn't there a way to ask the linker not to write at these addresses?

Children
  • Hi,

    I will continue helping in this case. You are not forgotten.

    From nRF5 memory layout:

    Here, the Bootloader settings are located at the start of the memory address. Is this the data you are reffering to?

  • Hello,

    No what I want is to prevent the linker from putting code in an area of the "app" partition.

    I'm using the nrf connect SDK and I created my partitions with the pm_static.yml file. My "app" partition starts at address 0x27000 and goes to address 0xE0000 but I would like the linker not to put any code between address 0xD0000 and address 0xD1000.

  • Doing that is theoretically possible, but with the partition manager, it may be hard to achieve.

    Therefore I first want to check if this is an XY Problem. For me to see if there is a better solution to your challenge, can you describe the memory layout of your nRF5 application?

  • In my devices (NRF52840) that are in the field (bootloader and application based on the nrf5 SDK), here is their memory layout:

    • mbr: 0x0 -> 0x1000
    • softdevice: 0x1000 -> 0x27000
    • app: 0x27000 -> 0xE4000
    • bootloader: 0xE4000 -> 0xF0000
    • / : 0xF0000 -> 0xFE000
    • MBR params page: 0xFE000 -> 0xFF000
    • bootloader settings page: 0xFF000 -> 0x1000000

    And, in the flash_placement.xml file, I added this memory segment (at the end of "app"):

      <MemorySegment name="ot_flash_data" start="0xe0000" size="0x4000">
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".ot_flash_data" address_symbol="__start_ot_flash_data" end_symbol="__stop_ot_flash_data" start = "0xe0000" size="0x4000" />
      </MemorySegment>

    The problem I have is that my predecessor (bootloader) wrote important values between address 0xD0000 and address 0xD1000 so to avoid the bootloader overwriting part of the application, I would need my new applications based on the nrf SDK not to write code to these addresses.


    I know it would be possible for me to redevelop a bootloader that will write to other more suitable addresses but that will then force my clients to have to update their bootloader and application for it to work (very expensive). So if it's possible to only update the app, I would prefer.

Related