Re: How to create a ROM library using GNU gcc and ld?
- From: Arlet Ottens <usenet+5@xxxxxxxxxx>
- Date: Mon, 31 Mar 2008 22:11:49 +0200
wyse03br@xxxxxxxxxxxx wrote:
On Mar 31, 3:35 pm, Arlet Ottens <usene...@xxxxxxxxxx> wrote:This strategy doesn't work so well, because some symbols areDon't use gcc for the partial link.
introduced twice (apparently by CRT0):
/lib/gcc-lib/ppc-elf/3.3.2/crtsavres.o(.text+0x1cc): In function
`_restgpr_31_x':
: multiple definition of `_restgpr_31_x'
a.aux(.text+0x1578): first defined here
collect2: ld returned 1 exit status
First use gcc to convert .c file into .o file, then call ld manually to
do partial link (without linker script). Something like this:
% ppc-elf-gcc -g -c lib.c -DROM # creates lib.o file
% ppc-elf-ld -g -r -o a.aux lib.o -lm # add library code
Then build the rest of your project, adding a.aux file to final link stage.
I would call it rom.o instead of a.aux, but that's a personal preference.
Thanks for the info, it makes sense. I did something slightly
different, but the overall result seems to be the same:
% ppc-elf-gcc -g lib.c -lm -Wl,-r -DROM -o rom.out
% ppc-elf-gcc -c lib.c -o lib.o
% ppc-elf-ld lib.o rom.out -T lib.lnk -o lib.out
I think this puts the crt code in ROM as well, including your entry point. This startup code then calls main() which resides in RAM, creating a dependency between your ROM library and the main application. Linking the same ROM code to another application may then not work as expected.
The way I suggested it, the crt code shoult end up in RAM, and can be different for each application.
.
- References:
- How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- Re: How to create a ROM library using GNU gcc and ld?
- From: Arlet
- Re: How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- Re: How to create a ROM library using GNU gcc and ld?
- From: Arlet Ottens
- Re: How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- How to create a ROM library using GNU gcc and ld?
- Prev by Date: Re: Feasible to implement a router on a system on a chip?
- Next by Date: Re: creation of DMA Transfer error
- Previous by thread: Re: How to create a ROM library using GNU gcc and ld?
- Next by thread: FSK/ASK on PLCC?
- Index(es):