[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: Re: [avr-chat] Embedding a 'foreign' file in my object code]
From: |
Erik Christiansen |
Subject: |
Re: [Fwd: Re: [avr-chat] Embedding a 'foreign' file in my object code] |
Date: |
Mon, 29 Mar 2010 22:59:56 +1100 |
User-agent: |
Mutt/1.5.15+20070412 (2007-04-11) |
On Mon, Mar 29, 2010 at 10:35:20AM +0200, Robert von Knobloch wrote:
> I know this is not avr bur would appreciate it if anyone could point
> me in the right direction.
I'm not sure that there's a "right" way, but here are several ways to
add a binary section:
o avr-objcopy -I binary -O elf32-avr foo.bin foo.o # As you've tried.
# Tell ld to use the bin as-is. If ld recognises the binary format.:
o ld -b binary dti_V100.bit ...
o gas's .incbin directive
o echo | as -o file.o
objcopy --add-section my_section_name=file.bin file.o
The contents of the new section are taken from the file.bin.
The size of the section will be the size of the file.
And though this takes the RAG trophy, I have on a commercial project
successfully used cat to whack some binary data on the end of the
executable:
o cat $(srcdir)/dti_V100.bit >> $(objdir)/pri_dti.bin
(This butted up, starting in the next byte after the last in the
last section (.text), and a start address was provided in the
linker script line: _fpga_data = _etext; )
Admittedly, in every case I've used a custom linker script, to provide
full control, and make it easier to fix problems.
Concerning the problems you're experiencing, I have more questions than
answers at this stage:
o Given a -verbose option, does ld present any additional clues in
the map file?
o The command-line input "-Wl,--section-start=.testuut7=0x6b00" is
poorly respected, with .testuut7.1 starting at 0x117e. My ancient
grey cells said "overlays or subsections" when I saw the suffix
number, but I can't find any supporting doco.
It might be worth trying another method. (OK, I'm biased. I've
never trusted talking to ld via gcc, because it might do something
which its authors consider "helpful".)
If you're OK with sending the map file and "objdump -h" output off-list,
I'll see if another perspective helps find your gremlins.
Erik
--
Meskimen's Law:
There's never time to do it right, but always time to do it over.