# Proteus and Internal EEPROM of AVR problem..

Status
Not open for further replies.

#### rdpdo

##### Junior Member level 1
eeprom simulation in proteus

Hi,
I make a simulation of a avr at90s8515, the programm .hex is ok, this run fine... but ICCAVR create me a file X.eep that i cannot load from proteus...When the simulation run, data aren't the eeprom data( but FF).
I d'ont understand because there is no error message when compiling the simulation whith my file X.eep...
Somebody can help me ?
Thanks

#### james

##### Member level 2
proteus eeprom

rdpdo,

Currently, proteus VSM processor models supports for Program files the Intel Hex or IAR D90 Files format, and for inial values of eeprom the binary image of of the initial contents of the EEPROM. Usually the binaries files have a .bin extension.

If X.eep format is an Intel Hex format like, you can use a Hex2Bin utility (most compilers usually have it), or you can just go to ImageCraft web page to see if a conversion program is there.

BTW, ImageCraft compilers (AVR and 68HC11/12 as well) aren't fully supported by proteus, while IAR is full supported (symbolic debug).

Go to La*bc*ent*er web page and see "third parts compilers" section.

Hope this helps

james

<font size=-1>[ This Message was edited by: james on 2002-05-07 16:49 ]</font>

#### rdpdo

##### Junior Member level 1
proteus avr eeprom

Thank you for your information, this is ok now for me.
Before running a simulation with internal eeprom data (in serial eeprom, uc eeprom,...) isis need to "reset the internal data" with the command DEBUG>RESET PERSISTENT MODEL DATA. If it could help someone...

sherazi

### sherazi

Points: 2

#### lulingar

##### Newbie level 3
This thread is a somewhat old, but I've just faced the same problem when simulating an ATmega8 and solved it this how:
Once you have the compiler generate the .eep file with the eeprom contents, run the following inside the directory where all the stuff is located:
Code:
avr-objcopy -I ihex -O binary <EEPROMFileGeneratedByCompiler>.eep <YourNewBinFileForProteus>.bin
Then you'll be able to load the file in Proteus and get your EEPROM stuffed . As mentioned elsewhere, don't forget to check "Reset Persistent Model Data" in the "Debug" menu.

Greetz

andre_teprom

### andre_teprom

Points: 2

#### tahertinu

##### Member level 4
This thread is a somewhat old, but I've just faced the same problem when simulating an ATmega8 and solved it this how:
Once you have the compiler generate the .eep file with the eeprom contents, run the following inside the directory where all the stuff is located:
Code:
avr-objcopy -I ihex -O binary <EEPROMFileGeneratedByCompiler>.eep <YourNewBinFileForProteus>.bin
Then you'll be able to load the file in Proteus and get your EEPROM stuffed . As mentioned elsewhere, don't forget to check "Reset Persistent Model Data" in the "Debug" menu.

Greetz

As i am facing the same problem so i am writing though its old one. i am confused where to feed .bin file? please any one tell me. Little Help is appreciable.

#### andrej]

##### Newbie
If you're using Proteus 8.1, there is a way to automate this behaviour (.bin generation).

Proteus 8 has its compiler settings stored in .xml files in the (C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\VSM Studio\compilers) folder. For example, winavr.xml defines your winavr compiler/linker settings. Labcenter probably doesn't want you to (you could screw up), but you can edit these files on your own with an .xml editor and add additional compilation steps, alter parameters, etc. Hell, you could set it up to your own compiler/linker combo to suit your needs completely.

Back to the problem! winavr.xml already has an entry describing eeprom file generation, but it's in the wrong (for our purpose) format - Intel hex (.eep). We need it in .bin (plain binary). Here's the line:
Code:
$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep" || exit 0 As you can see, this behaviour outputs .eeprom section from the .elf file, adjusts it a bit and outputs it in ihex (intel hex) format. That's the Code: -O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep" part. You can actually just double this entry in a .xml editor, switch the extension and set -O binary and you have a .bin generated each time, along your .eep! The new enty looks like this: Code: $(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O binary "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.bin" || exit 0

Since (this kind of) xml holds data in a HTML-like format (" everywhere!), you can't easily edit this line into your winavr.xml.
That's why I've rendered it to xml for you, so you just need to open winavr.xml in notepad++ and add:
Code:
    <POSTPROCESS TOOL="LD" CMDLINE="$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O binary "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.bin" || exit 0 " /> after Code:  <POSTPROCESS TOOL="LD" CMDLINE="$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep" || exit 0 " />
which is line 607 in my winavr.xml

Now, it Proteus generates .bin on every build!

Status
Not open for further replies.