avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] storing values at a spcified location in FLASH..?


From: Eivind Sivertsen
Subject: [avr-gcc-list] storing values at a spcified location in FLASH..?
Date: Thu, 13 Jan 2005 15:24:59 +0100

Hi guys,

I am looking for a way to store values at specified locations in flash, for
instance calibration values, serial number...etc...
I know that other compilers may use preprocessor directives to do this, but
I cant find the combination that does the trick with WinAVR...
The solution below seems to just add the data at the flash location wherever
code ends.

Suggestions?
Cheers,

Eivind


//
// Test for defining location of var in flash
//
// 1. Declare the array as below
//
// 2. Add the following link flags:
// -Wl,--section-start=.calib=0x100,--cref
//
// 3. Generate Intel Hex file using avr-objcopy
// Use the following flags:
// -j .text -j .data -j .calib
//

#include <avr/io.h>
#include <avr/pgmspace.h>

const unsigned char calval[] __attribute__ ((section (".calib"))) = {0xcd,
0xce};

int main(void){
unsigned char *calvalP;

calvalP = calval;

}// end



reply via email to

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