Need to use external linker script file!
Hi everybody.
I need to build a project for ARM (NXP LPC2478) using and external script file or, as an alternative, authoring two corresponding memory_map and section_placement xml files.
I tried to use -T linker option, but it seems that crossworks either ignore such directive if there aren't section_placement and memory_map files specified on project properties or tries to use two different -T options on same "ld" command line (with obvious consequences): both external and internal (i.e. generated from xml files) ones.
My linker script is very simple:
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
SDRAM (wx) : ORIGIN = 0xA0F00000, LENGTH = 0x000FFFFC
}
SECTIONS
{
. = ALIGN(4);
.text :
{
*(.text)
}
. = ALIGN(4);
.rodata :
{
*(.rodata )
}
. = ALIGN(4);
.data :
{
*(.data)
}
. = ALIGN(4);
.bss :
{
__bss_start__ = .;
*(.bss)
__bss_end__ = .;
}
}
end = .; /* define a global symbol marking the end of application RAM */
Just for completeness, it has to be used by a makefile equivalent to:
OUTFILE=RLPExample
LINKERSCRIPT = RLP_LinkScript.lds
INCL=./include
CC =arm-none-eabi-gcc
LD =arm-none-eabi-gcc
CCFLAGS= -g -mlittle-endian -mcpu=arm9 -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin
LDFLAGS =-nostartfiles -Wl,--Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc
LDFLAGS+=-T $(LINKERSCRIPT)
OBJS+= RLPExample1.o
rebuild: clean all del_o
all: $(OBJS)
$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS)
RLPExample1.o: RLPExample.c
$(CC) -c $(CCFLAGS) RLPExample.c -o RLPExample1.o
clean:
-rm ./Output/*.elf ./Output/*.map
del_o:
-rm *.o
del_map:
-rm ./Output/*.map
Could anybody provide me with a project template or suggest any solutions?
Thanks!!!
-
To use your own linker script:
- Add the linker script file to the project by right clicking on system/source files folder in project explorer and selecting "Add Existing File...".
- Set the file type of the linker script file to "Linker Script" by right clicking on the file in the project explorer, selecting "Properties", setting the "Configuration" to "Common" in the dropdown in the top right hand corner of the properties dialog and then setting the "File Options > File Type" project property to "Linker Script".
Please sign in to leave a comment.
Comments
1 comment