Hello everybody, I'm using a stm32 family device (stm32f4), it is possible to place constants at absolute memory address? In my case R/O base starts from 0x0800 0000 and my code look like this:
#define USER_FLASH_STARTADDRESS ((uint32_t)0x08000000) #define OFF_DATA_1 0x400 #define OFF_DATA_2 0x401 #define OFF_DATA_3 0x402 #define OFF_DATA_4 0x403 #define POS_DATA_1 (uint32_t)(USER_FLASH_STARTADDRESS+OFF_DATA_1) #define POS_DATA_2 (uint32_t)(USER_FLASH_STARTADDRESS+OFF_DATA_2) #define POS_DATA_3 (uint32_t)(USER_FLASH_STARTADDRESS+OFF_DATA_3) #define POS_DATA_4 (uint32_t)(USER_FLASH_STARTADDRESS+OFF_DATA_4) const uint8_t variable1 __attribute__((at(POS_DATA_1))) = 'd'; const uint8_t variable2 __attribute__((at(POS_DATA_2))) = 'a'; const uint8_t variable1 __attribute__((at(POS_DATA_3))) = 't'; const uint8_t variable2 __attribute__((at(POS_DATA_4))) = 'a';
I've got no errors at compilations, and my program seems to run fine, but i want to be sure that this procedure is correct and safe. Thank you very much. Best regards