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

SES attribute data

Hi, 

I'm new to Segger Embedded Studio developmemt.  And now I met a problem  similar to Placing data at a specific memory address with Segger Embedded Studio

I need to put constant firmware information in specify address(softdevice size + offset(0x2000))  to allow PC software readout fixed infomation, 

#if defined (__CC_ARM )												
const app_infor_t appl_info __attribute__((at((uint32_t)APP_FW_INFO_START_ADDRESS))) = 
{
	.magic = APP_FW_MAGIC_CODE, 
	.fw_version = FW_REVISION, 
	.fw_size = APP_FW_SIZE, 
	.hw_version = APP_FW_HW_VER,
	.sd_version = APP_FW_SD_VERSION, 
	.sd_fw_id = APP_FW_SD_FW_ID,
	.date = APP_FW_DATE,
	.time = APP_FW_TIME,
};
#elif defined( __GNUC__ ) || defined ( __SES_ARM )
const app_infor_t appl_info __attribute__((section(".firmware_info_page"))) = 
{
	.magic = APP_FW_MAGIC_CODE, 
	.fw_version = FW_REVISION, 
	.fw_size = APP_FW_SIZE, 
	.hw_version = APP_FW_HW_VER,
	.sd_version = APP_FW_SD_VERSION, 
	.sd_fw_id = APP_FW_SD_FW_ID,
	.date = APP_FW_DATE,
	.time = APP_FW_TIME,
};
#else

#endif 

As I follow the answer of  Placing data at a specific memory address with Segger Embedded Studio .  AfterAdding description to flash_placement.xml

<!DOCTYPE Linker_Placement_File>
  <Root name="Flash Section Placement">
  <MemorySegment name="FLASH" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
  [...]
  </MemorySegment>
  <MemorySegment name="RAM" start="$(RAM_PH_START)" size="$(RAM_PH_SIZE)">
  [..]
  </MemorySegment>

  <MemorySegment name="firmware_info_page" start="0x00028000" size="0x100">
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".firmware_info_page" address_symbol="__start_firmware_info_page" end_symbol="__stop_firmware_info_page" start = "0x00028000" size="0x100" />
  </MemorySegment>
</Root>

Rebuild project, but I can't see the fixed information contain in HEX files.

So the question is how to realise the function in Segger Embedded Studio ? Any help that is appreciate!

Parents
  • Hi!

    First of all, could you tell me which SDK you are working with?

    Also, what is your project settings used for the FLASH_START and RAM_START?

    Cheers,
    Joakim

  • Hi, Joakim

    I'm using SDK15.0.0.

    FLASH_START = 0x26000, RAM_START=0x20004BC0.

    I look up the manual of SES and found that the section is assign from low to high address. Now I change flash_placement.xml as 

    <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)" />
    <ProgramSection alignment="4" load="Yes" name=".init" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".firmware_info_page" start="0x28000" />
    <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
    <ProgramSection alignment="4" load="Yes" name=".text" />

    Rebuild, and the output hex:

    :020000022000DC
    ......
    :1062BC00FEE7FEE7FEE7FEE7FEE7FEE7FEE7FEE7AA
    :1062CC00FEE7FEE7FEE7FEE7FEE7FEE7FEE7FEE79A
    :1062DC00FEE7FEE7FEE7FEE7FEE7FEE7FEE7FEE78A
    :0862EC00FEE7FEE7FEE700BF3C
    :10800000DEC091A906000001002005003400000038
    :10801000808D5B00A80000004A756C203230203251
    :0C8020003031380031303A31323A35301E
    :10802C00704700BF00B583B0044B0093044A402353

     It is OK. For now that  problem is  flash address from 0x26300 to 0x28000 is not used, almost 7k bytes flash is deserted.  Do your guys have any solution to figure out in SES? 

    Thank you!!

  • You can't interleave sections, so by forcing the firmware info page to be at 0x28000 and the .text after it, you're creating a gap. Since the .text probably wouldn't fit in that 7k you can't reverse the order (although you could put your read only data in there and some other sections)  

    Your basic problem is your insistence on having this piece of data at Softdevice+0x2000. Why have you picked that as your requirement? That's making it all much harder for you. If you put it right at the end of flash memory that would be easier, or if you put it right after the vectors you'd waste much less memory. There's tons of other options, putting it at the end of the vectors section (which is not actually used for vectors and is always empty), putting it anywhere and sticking a pointer to it in the vectors section, or right after it .. 

    If you are determined it must go at SD + 0x2000 then you'll have to manually move other sections like .init_rodata before it to fill up some of the unused space, as long as they aren't too big .. and that's not a very good solution either. 

    I think revisiting your initial requirement would be a better plan. 

  • Thanks, RK!

    I insist this requirement to ensure output HEX will be a consecutive address, my crypto tool can readout firmware information to generate description file automatically. By placing data at the end of flash is not a good idea, after HEX to Bin file, the final files will contain more useless data, and increase the DFU time unless I modify updating protocol, that will be more works to do.

    Now I back to Keil develop.

    Thanks all the same!

  • Thank you for the input RK. Always appreciated!

Reply Children
No Data
Related