[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-gcc and char strings
From: |
Richard Weickelt |
Subject: |
Re: [avr-gcc-list] avr-gcc and char strings |
Date: |
Thu, 04 Dec 2014 13:04:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
> I would love to understand the difference between "-j .text" and "-R
> .eeprom". I googled for avr-objcopy and all I found was
>
> -j sectionname --only-section=sectionname Copy only the named section
> from the input file to the output file. This option may be given
> more than once. Note that using this [-R
> sectionname|--remove-section=sectionname This does not really explains it
> to me! :-( Can I always use "-R .eeprom" and am done or should I
> understand what these options mean and use them from case to case?
> Thanks, Andreas
You might want to read
http://www.nongnu.org/avr-libc/user-manual/mem_sections.html and about the
ELF format, sections and segments in general. I can recommend the book
"Linkers and Loaders" by John Levine but there is various other information
in the web.
Your global string array is not located in the .text section but .data. This
section gets flashed into the AVR as well (hint: PROGBITS, see avr-readelf
-S <EXECUTABLE>) but has to be "loaded" into the RAM during application
startup.
If You throw away the .data section with "objdump -j .text", then Your
program will of course copy data from an empty flash region into the RAM.
Re: [avr-gcc-list] avr-gcc and char strings, Georg-Johann Lay, 2014/12/15