avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] avr-gcc and char strings


From: Simon Cook
Subject: Re: [avr-gcc-list] avr-gcc and char strings
Date: Thu, 4 Dec 2014 12:12:48 +0000

HI Andreas,

Using "-j .text" would only keep the .text section, as your string is in the .data section, the actual contents would have been removed and you would expect your string to be just noise (as you saw). "-R .eeprom" would copy all sections apart from .eeprom which would mean that your .text and .data would remain intact and your program work as expected. Judging by your assembly file I don't see any section change to .eeprom so this may have actually done anything.

In general, I would expect using neither -j nor -R would in most cases produce a working file, but there may be some cases where it is useful to know which of these to use. When you need them, -j is for when only a list of known sections are needed, and -R is for keeping everything except a given section.

Hope this helps,
Simon

On Thu, Dec 4, 2014 at 11:36 AM, Andreas Höschler <address@hidden> wrote:
Hi Paweł,

$(PROJECT).hex: $(PROJECT).out
$(OBJCOPY) -j .text -O ihex $(PROJECT).out $(PROJECT).hex

I would say that here is the problem, change this to:
$(OBJCOPY) -R .eeprom -O ihex $(PROJECT).out $(PROJECT).hex


That was it!!!! 

Thanks so much! You probably can't imagine how happy I am that this problem is finally resolved.

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



_______________________________________________
AVR-GCC-list mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]