[Top][All Lists]

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

[avr-gcc-list] Eeprom..

From: Larry Barello
Subject: [avr-gcc-list] Eeprom..
Date: Sat, 26 May 2001 22:28:10 -0700

Ok, here is a concrete example...

--- foo.c ---
#include <eeprom.h>

/* Declare a variable in eeprom and assign an initial value. */

int foo __attribute__ ((section(".eeprom"))) = 0x1234;

int main(void)
    char myVar = eeprom_rb((unsigned)&foo);

    eeprom_wb((unsigned)&foo, 0x0000);

    return myVar;


To extract the eep file you need to do:

avr-objcopy -j
.eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma
.eeprom=0 -O ihex foo.elf foo.eep

The magic "--change-section..." is because someone changed the linker
scripts and moved the EEPROM section out in never-never land.

reply via email to

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