This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Section layout with ld script for flash based ARM system : what'swrong?


Hi,

Does somebody could give me some advice to organize memory sections with an ld script for a flash/RAM based system?

Everything is dled in flash at startup. ASM routines take care of copying RAM functions from flash to RAM and zero-ing .bss sections.

The problems is that we want to include code of certain objects files in the RAM zone so we have to declare them first. Otherwise, the * takes precedence and they are wrongly located.

The problem that arises is that I have lots of "Relocation truncated to fit" errors and I do not understand why.

As it is in fact ADS->GNU conversion, I wonder about how to convert the ARE statement. Suppose we have the [AREA BOOT, CODE] statement to translate.
Should I replace it with a [.section "BOOT", "x"] or with [.section "BOOT"\n .text].
I chose the second solution. If I switch to the first one, then I have "Literal defined across section boundary" error (If I remember well)



Could somebody help?


Thanks a lot for your reply.

Vincent

*********************************************************************************
Here is my script (which is a translation of ADS scatter file btw)
*********************************************************************************
MEMORY {
	IRAM (!R)		: ORIGIN = 0x00000000, LENGTH = 0x1800
	IRAMDATA (!R) 		: ORIGIN = 0x00001800, LENGTH = 0xF000
	CODE (RX) 		: ORIGIN = 0x01000080, LENGTH = 0x007FF80	
}

SECTIONS {

/* GNU : The entry point of our application. This label is located in boot.o */
ENTRY(entry_point)

/* GNU :
Beware of * wildcard used to look for a file whatever folder it is in. You may include
more than one file if you use a wildcard and have two files ending with the same pattern.
*/

.iram_text : AT(Code_End)
{

Load$$IRAM$$Base = . ; /* Load address of the region */
Image$$IRAM$$Base = . ; /* Execution address of the region */


		*except.o (.text .rodata)
		*irqisr.o (.text .rodata)
		*irqctrl.o (.text .rodata)
		*HW_BT_iip.o (.text .rodata)
		*os_context_arm.o (.text .rodata)
		*os_int_prim.o (.text .rodata)
		*nvdslowlevel.o (.text .rodata)
		*/uart2.o (.text .rodata)
		*/usb.o (.text .rodata)
		*USB_int.o (.text .rodata)
		*sleepfromram.o (.text .rodata)

		Image$$IRAM$$Length	= . - Image$$IRAM$$Base ;
		Iram_Text_End		= .			;
	} > IRAM

	
	/*
	60 Kbytes has been allocated in this execution region for read/write
	and zero-initialised variables.
	*/
	.data : AT(Iram_Text_End)
	{
	
		Load$$IRAMDATA$$Base		= .	;
		Image$$IRAMDATA$$Base		= .	;

		*lm_memory_manager.o (.data)
		*.o (.data)
	
		Iram_Data_End			= .					;
		Image$$IRAMDATA$$Length		= Iram_Data_End - Load$$IRAMDATA$$Base	;

} > IRAMDATA


.bss : AT(Iram_Data_End) { Image$$IRAMDATA$$ZI$$Base = . ; *lm_memory_manager.o (.bss) *.o (.bss) Iram_Bss_End = . ; Image$$IRAMDATA$$ZI$$Length = Iram_Bss_End - Image$$IRAMDATA$$ZI$$Base ;

} > IRAMDATA

	/* GNU : ld needs to know where the first byte of available heap memory is.
	Usually located at the end of the .bss section ? */
	end = .	;

	.text :
	{
		*/boot.o (.text .rodata) /* Make sure the code for booting is first in flash*/
		*.o (.text .rodata)
		Code_End = .	;
	} > CODE

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]