[En-Nut-Discussion] [Understand compilation process] avr-objcopy -R .eeprom
Ernst Stippl
ernst at stippl.org
Fri Feb 23 07:51:11 CET 2007
Hi!
It's the table on page 37 of the Ethernut Software Manual Revision: 2.4.
This table is set up un eeprom at address 0x0040, and there is a kind of
identifier for Nut/OS at address 0x0000. The values are written there by
Ethernut's software.
Name Type Default Description
size Byte value 31 Total size of the configuration structure.
Used to check validity.
name Character eth0 Name of the network interface. Maximum
size is
array 8 characters.
mac Byte array 000698000000 6 bytes unique MAC address.
ip_addr IP address 0.0.0.0 Last used IP address.
ip_mask IP address 255.255.255.0 Configured IP mask.
gateway IP address 0.0.0.0 Default gateway IP.
cip_addr IP address 0.0.0.0 Configured IP address.
the keyword EEMEM isn't used in Nut/OS... ... because the values stored in
the eeprom are written to it by the sw itself, not loaded into the eeprom
during the flashing process.
I had to initialize the eeprom for an application and used a primitive
methode: I compiled the values to be stored in eeprom as a single c-source
and defined the varianles as "const". Note: there were no pointers, only
data! Thru trial and error (loking up .map and .hex files) I found out at
which address the variables started in flash and added a dummy var infront
of this to allocate the variables I needed to address 0x0100. In the the
resulting hex file i chopped of the first 8 (or 16) lines representing the
contents a t address 0 to 0xff.
and then I uploaded this file spcifying "eeprom" as the target. not very
sophisticated, but it worked.
I think you are right, i did not use makeburn but:
uisp -dprog=stk500 -dserial=/dev/ttyS0 -dspeed=115200 -dpart=atmega128
--segment=eeprom --erase --upload if=eeprom\diag.hex
uisp -dprog=stk500 -dserial=/dev/ttyS0 -dspeed=115200 -dpart=atmega128
--segment=flash --upload if=object\diag.hex
The 2 diag.hex files had of course different content: one was the "special"
eeprom file image and only the second was the "normal" gcc-compliled object
program.
regards
Ernst
-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Rodrigue
Gesendet: Mittwoch, 21. Februar 2007 20:40
An: en-nut-discussion at egnite.de
Betreff: Re: [En-Nut-Discussion] [Understand compilation process]
avr-objcopy -R .eeprom
Sorry but I didn't find anywhere the memory layout in Ethernut's software
manual. Howerver, there is a document about this subject on Ethernut's
website.
I read this article
http://winavr.scienceprog.com/avr-gcc-tutorial/save-constants-to-avr-eeprom-
using-winavr.html
http://winavr.scienceprog.com/avr-gcc-tutorial/save-constants-to-avr-eeprom-
using-winavr.html
I think that the internal Eeprom of the ATmega is not used because, the
keyword EEMEM isn't used in Nut/OS...
Maybe, that explained why the .eeprom section is removed with avr-objcopy?
Moreover, I read that during the "programmation" (makeburn), the internal
eeprom is not writted. It's was an article about Ponyprog and the AVR.
Ernst Stippl wrote:
>
> Hi!
>
> Yes,
> Nut/OS and Nut/Net use the eeprom section.
> There is a memory layout in Ethernut's software manual ..
>
> regards
>
> Ernst
>
> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Rodrigue
> Gesendet: Dienstag, 20. Februar 2007 12:46
> An: en-nut-discussion at egnite.de
> Betreff: Re: [En-Nut-Discussion] [Understand compilation process]
> avr-objcopy -R .eeprom
>
>
> Anybody doesn't know why we suppress the .eeprom section ?
> Is this section used Nut/OS? I think that the answer is yes but only
> within the software...
>
>
> Rodrigue wrote:
>>
>> Hello,
>>
>> When I compile "simple" project. The following commands are executed:
>> avr-objcopy -R .eeprom -O ihex simple.elf simple.hex avr-objcopy -O
>> binary simple.elf simple.bin
>>
>> The first command removes the .eeprom section form simple.elf and
>> converts the rest of the file in ihex format (is it Intel Format?).
>> Why remove this section? How to write the eeprom section? If I have a
>> variable like this in my software:
>> static const char my_string[] __attribute__ ((section(".eeprom"))) =
>> "This data will be loaded into EEPROM"; What's happening?
>>
>> The second command converts simple.elf file in binary format which is
>> not used after, so I don't understand why it's generated?
>> make -k burn
>> avrdude -p atmega128 -P com1 -c stk500v2 -V -U flash:w:simple.hex
>>
>> Thanks in advance!
>> Rodrigue
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/-Understand-compilation-process--avr-objcopy--R-
> .eepro
> m-tf3250513.html#a9060304
> Sent from the MicroControllers - Ethernut mailing list archive at
> Nabble.com.
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.441 / Virus Database: 268.18.3/693 - Release Date:
> 19.02.2007
> 17:01
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
--
View this message in context:
http://www.nabble.com/-Understand-compilation-process--avr-objcopy--R-.eepro
m-tf3250513.html#a9087698
Sent from the MicroControllers - Ethernut mailing list archive at
Nabble.com.
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list