[arm-gnu] Placing variable at absolute address in RAM
Mark Deneen
mdeneen+arm at saucontech.com
Thu Apr 5 17:07:36 UTC 2012
In your example, nothing has been declared. Types have been defined, and you have a preprocessor macro mapping a particular address to a type, but nothing has been declared.
I don't think that it's doing what you think it is doing. You're fine in this situation simply because you are accessing peripheral registers and not SRAM.
-M
----- Original Message -----
Actually, I think it does. That example just reserved 4 bytes
(sizeof(int)), but you can just as easily use a struct or probably even
an array.
Here's an example from the LPC17xx.h header from and NXP cortex-M3 chip.
typedef struct
{
volatile uint32_t mask[512];
} LPC_CANAF_RAM_TypeDef;
#define LPC_APB0_BASE (0x40000000UL)
#define LPC_CANAF_RAM_BASE (LPC_APB0_BASE + 0x38000)
#define LPC_CANAF_RAM ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)
See the core_cm3.h file from CMSIS for more examples.
If I'm not mistaken when you declare a variable the compiler/linker
always reserves enough memory for that type - even when you specify the
starting address like this.
_______________________________________________
arm-gnu mailing list
arm-gnu at codesourcery.com
http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu
More information about the arm-gnu
mailing list