[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    Re: embedded system ld script issues
From:       Sergei Organov <osv () topconrd ! ru>
Date:       2004-04-28 7:45:36
Message-ID: 87vfjkh7fj.fsf () osv ! topconrd ! ru
[Download RAW message or body]

Bryce Schober <bryce.schober@dynonavionics.com> writes:
> I'm trying to write my own ld script for use in an embedded system,
> but I'm having a hard time with a couple of things. (I'm pretty much a
> newbie with ld)
> 
> First, what does the memory help (malloc, etc) need from the ld
> script?

Usually malloc needs some symbols describing starting address and size
of the memory area to be used by malloc to be defined. How those
symbols should be called is entirely defined by your malloc
implementation or an embedded OS if you are using some. 

> 
> Second, how can I define a memory map (where sections of code / data
> should go) in one place, to be used by source and in linkage? I have
> been using a .h header file which #defines several constants, but it
> seems that those aren't visible symbols in the ld script.

You can abuse C preprocessor to be able to include your header(s) into
the linker files. The idea is to run your linker command file through
preprocessor before using it as an input file for the linker. Suppose
you've written file 'linker.cmd' containing #include and other C
preprocessor directives. You then can generate 'linker.lnk' command file for
the linker using, e.g.,

gcc -E -P -traditional -undef -x assembler-with-cpp linker.cmd > linker.lnk

-- 
Sergei.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic