This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


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

Re: LINKING CODE to specific addresses.


chris.r.lipchik@att.net wrote:
> 
> I'm having trouble getting started on creating
> code sections and linking code at specific addresses.
> 
> I want the code contained in a single source file (either
> C or assembly) to be located at address 0x20000.  The
> remaining code, the application S/W, needs to start
> immediately after the code in the single source file
> mentioned above.  The address of ROM in my uP is 0x00000
> to 0x3FFFF.
> 
> Do I use the Configuration Tool to do this or do I need
> to manually edit a file.

For doing what you describe, you would need to edit the linker script. In
eCos, the linker script is constructed from various linker script
fragments, and information from the Memory Layout Tool. So to achieve what
you want you probably want to edit the linker script fragment for your
target, add a new "section" to contain the object code in question e.g.

#define SECTION_mysection(_region_, _vma_, _lma_) \
.mysection _vma_ : _lma_ { myspecialobject.o(.text) } > _region_

where myspecialobject.o is the object contain the special code.

Then in the MLT, give mysection the address you want (or even just hardcode
it into the .mysection description above).

You didn't give your target so I can't give more specifics than this, but
this should help you get going.

Read the GNU linker (ld) info files for more documentation on linker script
syntax.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine

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