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

Programmatically accessing flash_placement.xml

Hi 

I am writing a bootloader and am trying to get the start locations of the different memory segments e.g. the FLASH start segment from the flash_placement file.

On a different manufacturer's micro on a Rowley IDE I used:

  int ramEnd = (int)(&__FLASH_segment_start__ );

But this returns 0x0 using Segger Embedded on a nrf52832

Please can you give me an example for Segger Embedded Studio

Thank you

Parents
  • Hi,

    The flash_placement files provided with the SDK examples are written so that FLASH segment covers the entire address range from 0x0 to 0x80000. This is defined by the FLASH_PH_*  placement macros under common linker configurations.  

    I should work if you change the FLASH_PH_ to only cover the bootloader's address range, but I think it might be better to define your own linker symbols in the xml file. That way you don't have to change the default configuration. 

    <!DOCTYPE Linker_Placement_File>
    <Root name="Flash Section Placement">
    <MemorySegment name="FLASH" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
    <ProgramSection load="no" name=".reserved_flash" start="$(FLASH_PH_START)" size="$(FLASH_START)-$(FLASH_PH_START)" />
    <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START)" address_symbol="__app_flash_start__" />

     

     

Reply
  • Hi,

    The flash_placement files provided with the SDK examples are written so that FLASH segment covers the entire address range from 0x0 to 0x80000. This is defined by the FLASH_PH_*  placement macros under common linker configurations.  

    I should work if you change the FLASH_PH_ to only cover the bootloader's address range, but I think it might be better to define your own linker symbols in the xml file. That way you don't have to change the default configuration. 

    <!DOCTYPE Linker_Placement_File>
    <Root name="Flash Section Placement">
    <MemorySegment name="FLASH" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
    <ProgramSection load="no" name=".reserved_flash" start="$(FLASH_PH_START)" size="$(FLASH_START)-$(FLASH_PH_START)" />
    <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START)" address_symbol="__app_flash_start__" />

     

     

Children
No Data
Related