Associate
August 12, 2020
Question
How to allocate variable in Flash to desired address with CubeIDE?
- August 12, 2020
- 5 replies
- 3538 views
- there is a same problem, but there is still no solution. I use STM32CubeIDE , meeting the same problem."https://community.st.com/s/question/0D50X00009XkZhJSAV/how-to-allocate-variable-in-flash-to-desired-address"
- I modify the project from Keil to CubeIDE, and need to store some data to Flash.
- I edit the .Id and .c according to: http://blog.atollic.com/using-gnu-gcc-on-arm-cortex-devices-placing-code-and-data-on-special-memory-addresses-using-the-gnu-ld-linker, but it doesn't work.
- my .Id file is shown as the attchment.
- and I add these in the main.c beform "int main(void)", but there is no data in the generated HEX file.
__attribute__((section(".myvars.VERSION_NUMBER"))) uint32_t VERSION_NUMBER = 0x12;
__attribute__((section(".myvars.CRC"))) uint32_t CRC16 = 0x12;
__attribute__((section(".myvars.BUILD_ID"))) uint16_t BUILD_ID = 0x12;
__attribute__((section(".myvars.OTHER_VAR"))) uint8_t OTHER_VAR = 0x12;
the mcu is stm32g474mb, please help me, thanks very much!
