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

Write multiple compile time constants into UICR

Hi,

I'm trying to write multiple compile time constants into the UICR (from the boot loader project). Currently I'm writing the boot loader addresses (start address & params page) and the REGOUT0 voltage.

If I only write the addresses or the REGOUT0 value everything works fine, but if I try to write them both, then the block of registers in-between are all filled with zero's. This basically blocks out the debugger.

I've tried various settings in the flash_placement.xml, such as the 'fill' attribute, creating additional ProgramSection's and creating MemorySegment's for each register. None work, that is, they all write the correct values but make all other registers '0'.

How can I write separate registers in the UICR and leave the unwritten ones untouched?

My best guess is this MemorySegment configuration:

  <MemorySegment name="UICR" start="0x10001000" size="0x308">

      <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" />

      <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" />

      <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_regout0" start="0x10001304" size="4"/>

  </MemorySegment>

I set the regout0 value as: 

const uint32_t REGOUT0 __attribute__((section(".uicr_regout0"))) = UICR_REGOUT0_VOUT_3V3;

How can I properly write the UICR with compile time constants, such that the remaining registers remain untouched?

Thanks in advance.

Kind regards,

Remco Poelstra

Parents
  • such that the remaining registers remain untouched?

    Split your one memory segment into two. Just creating two program sections is not enough.

    You might also need to change the linker script/settings accordingly.

  • I now have:

      <MemorySegment name="uicr_bootloader_start_address" start="0x10001014" size="0x4">
        <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" />
      </MemorySegment>
      <MemorySegment name="uicr_mbr_params_page" start="0x10001018" size="0x4">
        <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" />
      </MemorySegment>
      <MemorySegment name="UICR" start="0x10001304" size="0x4">
          <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_regout0" start="0x10001304" size="4"/>
      </MemorySegment>

    But this shows the same behaviour.

Reply
  • I now have:

      <MemorySegment name="uicr_bootloader_start_address" start="0x10001014" size="0x4">
        <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" />
      </MemorySegment>
      <MemorySegment name="uicr_mbr_params_page" start="0x10001018" size="0x4">
        <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" />
      </MemorySegment>
      <MemorySegment name="UICR" start="0x10001304" size="0x4">
          <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_regout0" start="0x10001304" size="4"/>
      </MemorySegment>

    But this shows the same behaviour.

Children
No Data
Related