[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
R: [avr-gcc-list] including default eeprom values in flash memory
From: |
palmerino tallarico |
Subject: |
R: [avr-gcc-list] including default eeprom values in flash memory |
Date: |
Wed, 21 Oct 2009 15:31:26 +0200 |
Hi
I'm using this (for example):
File eedata.c
#include "eedata.h"
TOTAL_DATA total_data;
ERROR_DATA error_data;
TOTAL_DATA __attribute__((section(".eeprom"))) e2total_data =
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
ERROR_DATA __attribute__((section(".eeprom"))) error_data = {0,0};
File eedata.h
#define TOTAL_DATA_ADDR 0 // Starting address of SYS_DATA image
data in eeprom
#define ERROR_DATA_ADDR (TOTAL_DATA_ADDR + sizeof(total_data))
// Starting address of ERROR_DATA image in eeprom
typedef struct {
u32 .........; (fill as you need)
}TOTAL_DATA;
extern TOTAL_DATA total_data
typedef struct {
u16 ........;
}ERROR_DATA;
extern ERROR_DATA error_data;
hope this help U!
Rino Tallarico
_________________________
-----Messaggio originale-----
Da: address@hidden
[mailto:address@hidden Per
conto di Prashant D. Kharade
Inviato: mercoledì 21 ottobre 2009 12.35
A: Michael Clift; address@hidden
Oggetto: RE: [avr-gcc-list] including default eeprom values in flash memory
Hi,
One method, which I have read on the net & also used by myself in my
project is as follows.
As per this we have to write the default eeprom values in our 'C' file.
1. Create one variable named eeload.
2. In your main program, if eeload !=250 (any random value) then put all
your default values in EEprom.
3. And also load eeload = 250.
4. Because of this, next time eeload will be 250 & default values will
not be reloaded.
5. Hence after you load your main hex file, at first instant all the
default eeprom values will get loaded alongwith eeload=250.
6. This part of code will never get executed in future because eeload =
250.
Hope this will help you.
Good Luck
Prashant
India
-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Michael Clift
Sent: 21 October 2009 15:04
To: address@hidden
Subject: [avr-gcc-list] including default eeprom values in flash memory
Hi, I am using winavr, and would like to include the default eeprom
values (normally output to .eep) in flash memory. I want to do this so
that my application can easily default the eeprom. Whats the best way to
do this? can it be done with a modification to the linker script? or
should it be done in the makefile somehow?
Regards, Michael.
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date:
10/20/09 18:42:00
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
[avr-gcc-list] Re: including default eeprom values in flash memory, Heike C. Zimmerer, 2009/10/21
Re: [avr-gcc-list] including default eeprom values in flash memory, Dusan Ferbas, 2009/10/21