Convert to avr-gcc

Hi all, i'm converting a C source written with CodevisionAvr to avr-gcc. My trouble is replace the 'flash' and '__flash' directive ! I tried with 'const' and 'PROGMEM' but i have trouble ...

-- SteM

Reply to
SteM
Loading thread data ...

I have these in typedefn.h: #define flash __attribute__((__progmem__)) #define eeprom __attribute__((section(".eeprom")))

Then char foo[20] flash;

Reply to
David R Brooks

Thanks,

but i need a modifier to access to flash memory, to generate correct assembly code. I discovered that i have to use pgm_read_byte() macro (and friends) to allow the flash access: i guess that avr-gcc is not able to discover when the access is on a flash while CodevisionAvr yes .... otherwise the compiler generates memory access. Or i'm missing some options/modifiers ?

-- SteM

Reply to
SteM

No, this is probably the biggest "problem" on avr-gcc compared to the other avr compilers. Especially if one has complex data structures that must live in flash. It would have been nicer if the compiler could automatically use the lpm instructions for any data in a specific section.

Regards Anton Erasmus

Reply to
Anton Erasmus

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.