Hi,
I need to place specific data (default values which could be changed via IAP) into specific address on flash when I program the MCU.
I found cr_section_macros.h - Placing code/rodata into different FLASH blocks
There is macro
#define __RODATA_EXT(bank,name) __SECTION_EXT(rodata, bank, name)
It´s ok but there is no option to define specific address where the data will be placed.
Is there any option/approach How I can complete this task?
Is it possible to create variable in flash somehow via pointer?
There is another solution which could work but I would prefer something which is easier...
Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
Solved! Go to Solution.
Hi vojtech havlicek,
If you want to change it in the future, you still can add the flash IAP function to modify that flash area.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi vojtech havlicek,
I don't know what the data type you want to write it in the flash.
Do you want to define some constant data in the flash, and you don't need to modify it in the code?
If yes, you can use these ways, just like the method in your :
Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
1. IAR
Define the constant data in flash address 0x10000000, the detail address you can modified it by your own solution.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
thank you for your reply.
Data in flash are intended for system setting and can be changed via IAP in life cycle.
I had system via IAP which inits these data on first run of device but there was some problems with reading of flash. So I would prefer to write data with setting into flash when the image is loaded into flash.
As I see I will use 3rd option - change linker section and save data via attribute.
Hi Vojtech,
You are welcome!
If you don't need to modify the data with setting, you totally can use the linker and place it in the specific flash address, don't need to use the IAP to operate it.
If you still have question about it, please kindly let me know!
If your question is solved, please help me to mark the correct answer, just to close this case, thank you~
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Kerry,
I need to change this data in future.
Hi vojtech havlicek,
If you want to change it in the future, you still can add the flash IAP function to modify that flash area.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------