GCC rodata problem with AT91EB40A evaluation board

Dec 31, 2003 2 Replies

I'm using AT91EB40A evaluation board and GCC. Everything works just fine until I use .rodata -section in my program. If I use rodata the program is compiled, but it doesn't work as it should. I would be very happy if somebody could tell me what I'm doing wrong.


---Source code I'm using looks like this---:



/* GPIO set and reset registers */ #define PIO_SODR 0xffff0030 #define PIO_CODR 0xffff0034



/* Bits to be set/reset on the GPIO port in order to toggle the LED */ #define RED_LED 1


As an aside: these macros are somewhat more obfuscated than necessary. This definition

#define REGW_ARRAY(addr) (* (volatile unsigned int *) (addr))

can be used in the more obvious fashion

REGW_ARRAY(addr) = value;

The gain is that you can use the same macro to read the register, too:

value = REGW_ARRAY(addr);

You can even achieve a macro that works like an actual array, i.e. with syntax REGW_ARRAY[addr].

Thanks about that tip, code looks now much nicer.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required