[SOLVED] Loading ELF file fails in UICR, while loading HEX works on nRF52840

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Loading ELF file fails in UICR, while loading HEX works on nRF52840

    Hi,

    I'm using SES 4.52b with a (custom) nR52840 board.
    SES generates both .elf and .hex files.
    I've defined the following MemorySegment in the flash_placement.xml:

    XML Source Code: flash_placement.xml

    1. <MemorySegment name="UICR" start="0x10001000" size="0x308">
    2. <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_bootloader_start_address" address_symbol="__start_uicr_bootloader_start_address" end_symbol="__stop_uicr_bootloader_start_address" start = "0x10001014" size="0x4" />
    3. <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_mbr_params_page" address_symbol="__start_uicr_mbr_params_page" end_symbol="__stop_uicr_mbr_params_page" start = "0x10001018" size="0x4" />
    4. <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_regout0" start="0x10001304" size="4"/>
    5. </MemorySegment>
    When I now start the debugger (which loads the .elf) the unused sections in this MemorySegment are filled with 0's. When I load the .hex file, the unused sections are properly filled with 0xff.

    Is this a bug in the .elf loader? Or is there a way to make sure the unused sections remain untouched while loading an .elf?

    Thanks in advance.

    Kind regards,

    Remco Poelstra
  • Hello Remco,

    Thank you for your inquiry.
    The reason why one file is filled and one not is that hex files have 0xFF as default fill value.
    For the elf file this can be specified in project option Default Fill Pattern or you can use the fill attribute in the linker script.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,

    Thanks for your answer. I'm very sorry for my late reply, I was waiting for a mail from the system that there was a reply but never received it.

    I've tried both setting the 'default fill pattern' to 0xff as well as adding a 'fill="0xff"' attribute to the MemorySegment in the flash_placement.xml, but the UICR section is still filled with all 0's. Did I set the wrong option?
  • I think I've found the solution.
    I've added a ProgramSection as follows:


    XML Source Code: flash_placement.xml

    1. <ProgramSection alignment="4" keep="yes" load="no" name=".uicr_fill" fill="0xff" size="0x1" />
    This seems to correctly fill the whole area between NRFFW[1] and REGOUT0.

    Kind regards,

    Remco Poelstra
  • Hello Remco,

    Yes that would be the correct approach. You have to specify a section so the fill value takes effect.
    Great to hear that you are up and running again.

    This thread will be marked as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.