* Linker script question
@ 2010-03-04 8:20 Johannes Bauer
2010-03-05 15:43 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Bauer @ 2010-03-04 8:20 UTC (permalink / raw)
To: gcc-help
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:
MEMORY
{
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,
Johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Linker script question
2010-03-04 8:20 Linker script question Johannes Bauer
@ 2010-03-05 15:43 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2010-03-05 15:43 UTC (permalink / raw)
To: Johannes Bauer; +Cc: gcc-help
Johannes Bauer <JB.Imm@gmx.de> writes:
> I have a question regarding linker scripts.
Note that linker scripts are a feature of the linker (obviously) and
the linker is not part of gcc. The linker is part of the GNU
binutils; see http://sourceware.org/binutils/ .
> 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__;
As far as I know this is not possible. I would recommend generating
the linker script through some sort of preprocessor.
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-05 15:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 8:20 Linker script question Johannes Bauer
2010-03-05 15:43 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).