How to determine .data LMA for ARM Flash program?

May 26, 2008 0 Replies

hello all:



i am currently developing software for STR710 MCU.



for Flash-based ELF programs, i have avoided using a linker script by using the -Ttext and -Tdata LD flags.



i did not like using a linker script because:



- its quite complicated



- i do not know which is the best linker script to customize



- i dont know where to place some sections from the default script



- i feel that contents of linker scripts can change with LD versions



i use -Ttext 0x40000000 -Tdata 0x20000000.



however, this sets both the LMA and VMA of the .data to 0x20000000.



so, to move the .data LMA to Flash, i look at the end of .text (say 0x40000428) in the section headers, and then use arm-elf-objcopy to change the LMA of .data to 0x40000428 using the objcopy flag:



--change-section-lma .data=0x40000428



with this trick, i can create wonderful Flash programs without using a linker script.



HOWEVER, i still have to manually go and read the ELF section headers using arm-elf-readelf -h to determine the end of .text in Flash.



is there a way to avoid this?



is there a single command line option that i can specify to place .data LMA when building the ELF?



thank you for your help.



have a wonderful Memorial Day weekend,



Aaron



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required