GCC rodata problem with AT91EB40A evaluation board

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

Reply to
Kari Veikkolainen
Loading thread data ...

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].

Reply to
Hans-Bernhard Broeker

Thanks about that tip, code looks now much nicer.

Reply to
Kari Veikkolainen

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.