This is the mail archive of the mailing list for the GCC 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]

Linker script question

Dear all,

I have a question regarding linker scripts. For a certain embedded MCU I have 256k of Flash memory and 96k of RAM available:

	FLASH (rx)	: ORIGIN = 0x00000000, LENGTH = 256k
	SRAM (rwx)	: ORIGIN = 0x20000000, LENGTH = 96k

In the section definition I'd like to define a symbol which signifies the end of the SRAM range, i.e.:

__ramend = 96k + __data_start__;

(where __data_start__ is laid out so it is starting at 0x2000000, i.e. the beginning of the RAM section).

The way I'm doing this currently is by duplicating the "96k" value explicitly. However, for easy maintenance it would be nice to have only one symbol to change (as many devices in the same family behave exactly the same and only the sizes of the memory differs).

I've tried to pass the ramsize to the linker using a define, but this worked neither for the MEMORY definition nor for the __ramend definition contained within SECTION.

Is there a way to refer to the previously defined LENGTH and ORIGIN attributes within the SECTION definition, for example like (pseudo syntax):

__ramend = MEMORY_LENGTH(SRAM) + __data_start__;

Kind regards,

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