[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] pre-loading the internal EEPROM
From: |
Max Klein |
Subject: |
Re: [avr-gcc-list] pre-loading the internal EEPROM |
Date: |
Wed, 18 Jun 2003 14:15:35 -0500 (CDT) |
Great, that was exactly what I was looking for. For the archive, and to
aid others out there in the future, there is a great description of the
Intel Hex file format at:
http://www.keil.com/support/docs/1584.htm
This document contains a very complete description of the file format and
fields. Thanks to everyone who shared their thoughts!
--Max
On Sat, 14 Jun 2003, Tyler Hall wrote:
> There are a couple of ways to do this, without knowing
> the kind of data you want in the hex file it'll be up
> to you to decide what's the most efficient...
>
> The .hex file is an "Intel HEX" format file. All it
> knows is what data goes into what address. If you just
> have a little bit of data to into the hex file and you
> really want to produce each hex file "by hand" (I'm
> assuming you really mean a script to do this dirty
> work for you?) you should do a google search on the
> intel hex format. Each line in the hex file goes
> something like this:
>
> 00000000AA55AA55AA55AA55AA55AA55AA55AA55
> 00000010BB66BB66BB66BB66BB66BB66BB66BB66
> 00000020CC77CC77CC77CC77CC77CC77CC77CC77
>
> which says to put 0xAA into address 0x00, 0x55 into
> 0x01, 0xAA into 0x02, etc. because the first set of
> hex digits are the address, the rest of the line is
> the data. Don't quote me on the field lengths there, I
> just made them up.
>
> Now if you've got a lot of non-chaotic data, ie.
> structured data, for each avr chip, you might want to
> reconsider using C to for the job, and just use a
> struct with a lot of #defines that get filled in at
> compile time.
>
> Tag the structure with the appropriate EEPROM
> attribute (see avr-libc manual) and run gcc. The
> output of the compile just has to be an OBJ (ie. no
> linking), then run avr-objcopy to extract the EEPROM
> section from the OBJ and put it an IHEX output file.
>
> Here's an example, but again don't quote me on this,
> it's 2am here as I type this...
>
> eeprom_data.c:
> struct eepromStruct {
> char serialNum[8];
> char deviceName[32];
> int someProperty;
> } eepromInstance EEPROM_ATTRIBUTE_HERE = {
> SERIAL_NUM,
> DEVICE_NAME,
> SOME_PROPERTY
> };
>
> gcc -c eeprom_data.c -DSERIAL_NUM="01234567"
> -DDEVICE_NAME="Hello, my name is ..."
> -DSOME_PROPERTY=132
>
> avr-objcopy -j .eeprom -O ihex eeprom_data.o
> eeprom_data.hex
>
>
> Tyler
>
> --- Max Klein <address@hidden> wrote:
> > Right, that's not the problem I have. AVR Studio's
> > integrated ISP interface has an option to upload a
> > .hex
> > file into the EEPROM, similar to the .hex files
> > created by
> > gcc to load into the main flash. My question is, how
> > do I
> > create the .hex file for the EEPROM contents only? I
> > don't
> > mind writing a fake C program to generate the .hex
> > file
> > with the contents, but I don't want to actually
> > program
> > the flash, only the EEPROM. The only information
> > that I've
> > seen for loading contents into the EEPROM is via
> > function
> > calls in the main (flash) program to load data byte
> > by
> > byte; all I want is to create some kind of an image
> > of the
> > EEPROM memory, and dump it directly into the chip.
> > --Max
> >
> > On Sat, 14 Jun 2003 22:05:59 -0400 (EDT)
> > "Christopher X. Candreva" <address@hidden>
> > wrote:
> > >On Sat, 14 Jun 2003, Max Klein wrote:
> > >
> > >>
> > >> The Problem:
> > >> All I want to do is create a .hex file (or
> > whatever else
> > >> works) with the EEPROM contents (byte-by-byte) so
> > that I
> > >> can mass-program my devices, and then go back and
> >
> > >>program
> > >> the EEPROM on each device individually with an
> > ISP. I
> > >
> > >Any programmer should be able to do this. I know
> > uisp
> > >(under Linux) does.
> > >
> > >
> >
> >==========================================================
> > >Chris Candreva -- address@hidden -- (914)
> > 967-7816
> > >WestNet Internet Services of Westchester
> > >http://www.westnet.com/
> >
> >
> > _______________________________________________
> > avr-gcc-list mailing list
> > address@hidden
> > http://www.avr1.org/mailman/listinfo/avr-gcc-list
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>