SPARC linker command files

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Nov 29 13:20:37 UTC 2013


Hello,

most SPARC BSPs use current the following linker provided symbols to specify 
the memory layout:

_PROM_SIZE = DEFINED (_PROM_SIZE) ? _PROM_SIZE : 2M;
_PROM_START = DEFINED (_PROM_START) ? _PROM_START : 0x00000000;

_RAM_SIZE = DEFINED (_RAM_SIZE) ? _RAM_SIZE : 4M;
_RAM_START = DEFINED (_RAM_START) ? _RAM_START : 0x40000000;

So it is possible to define them as command line parameters.  There are two 
problems with this approach.

Firstly start address must be consistent with the memory area definition.  Due 
to this reason the NGMP linker command file looks like this:

_PROM_SIZE = DEFINED (_PROM_SIZE) ? _PROM_SIZE : 0;
_RAM_SIZE = DEFINED (_RAM_SIZE) ? _RAM_SIZE : 64M;

MEMORY {
   rom     : ORIGIN = 0xC0000000, LENGTH = 256M
   ram     : ORIGIN = 0x00000000, LENGTH = 2048M
   sram    : ORIGIN = 0xD0000000, LENGTH = 256M
}

_PROM_START = ORIGIN (rom);
_RAM_START = ORIGIN (ram);

INCLUDE linkcmds.base

Secondly the size symbols don't allow region overflow checks by the linker.

A better approach would be to remove the ability to define these symbols on the 
command line and use a memory map definition via memory regions only.  For the 
NGMP as an example this would look like:

MEMORY {
   rom     : ORIGIN = 0xC0000000, LENGTH = 8M
   ram     : ORIGIN = 0x00000000, LENGTH = 64M
}

INCLUDE linkcmds.base

This change makes it necessary to adopt user Makefiles to this new approach.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list