From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: chris.r.lipchik@att.net Cc: ecos-discuss@sourceware.cygnus.com Subject: Re: [ECOS] LINKING CODE to specific addresses. Date: Wed, 24 Jan 2001 10:59:00 -0000 Message-id: <3A6F262B.7D0C8E69@redhat.com> References: <20010124011049.NZJL1480.mtiwmhc24.worldnet.att.net@webmail.worldnet.att.net> X-SW-Source: 2001-01/msg00406.html 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