linker script!!!

hi all, i am trying to collect some data and store in the memory.I want this data to be continuous.Can i write my own section like (.text,.sdata,.bss,etc..) in the linker script??and then assign a pointer which points to this section and store the data using this pointer???I have never written a linker script before.Please give me some suggestions if i want to write such a section in linker script.What does ALIGN(8) or ALIGN(4) mean? thanx

Reply to
kittyawake
Loading thread data ...

I have done this for a microblaze system and this is what I've found for the linker script:

FOOAREA (W): ORIGIN = 0x80000000, LENGTH = 0x200

. = ALIGN(8); .fooregs : { *(.fooregs) } > FOOAREA

In the software you can use this as follows:

static __foo_regs__ UINT foo_registers[64]; static volatile UINT * const foo_register = (UINT *) foo_registers;

The fooarea is not initialised at startup, but AFAIK it must be possible to do this (you have to define this in the linkerfile where the area is declared). The align keyword will indicate at what boundary variables in this area are laid (here at 8 bytes aligned addresses).

Frank

Reply to
Frank van Eijkelenburg

ALIGN(n) means move the current address pointer (called '.' in gnu linker terminology) to the next address that is n-byte aligned - so ALIGN(4) means the next word aligned address.

More broadly, the two sources I recommend are the Gnu linker documentation:

formatting link

and the following Xilinx app note:

formatting link

Link scripts are cryptic, but not actually difficult. You need to just take your time, read the documentation carefully and be prepared to experiment. You should also learn how to use the objdump tool (either mb-objdump or ppc-eabi-objdump, depending on which processor you are using). It will give you a lot of info about your object files, including the sections and symbols, and where they are located.

Hope this helps,

John

Reply to
John Williams

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.