Hi,
The safe way is modify your linker script and add section in RAM for your variable(s). If you have more vars - just put them in a struct - if you don't like to have section for each var.
m_myram (RW) : ORIGIN = 0x20000000, LENGTH = 0x00000010
SECTIONS
{
.my_ram_space (NOLOAD):
{
*(.my_ram_space)
} > m_myram
Variable def:
__attribute__ ((section(".my_ram_space"))) int my_abs_var;
There is example - https://community.nxp.com/docs/DOC-335619 which uses DFLASH for data - the same principle you can use for store data in regular flash area (just use your address 0x20400).
Jiri
I also found this topic on Erich Styger's blog - Defining Variables at Absolute Addresses with gcc | MCU on Eclipse
But in this case there is no exactly defined address - your section is added in the m_data memory space based on place in SECTIONS definition. If your section is very first - it starts on beginning.
Jiri
Hi,
The safe way is modify your linker script and add section in RAM for your variable(s). If you have more vars - just put them in a struct - if you don't like to have section for each var.
m_myram (RW) : ORIGIN = 0x20000000, LENGTH = 0x00000010
SECTIONS
{
.my_ram_space (NOLOAD):
{
*(.my_ram_space)
} > m_myram
Variable def:
__attribute__ ((section(".my_ram_space"))) int my_abs_var;
There is example - https://community.nxp.com/docs/DOC-335619 which uses DFLASH for data - the same principle you can use for store data in regular flash area (just use your address 0x20400).
Jiri
Hi,
I want write some information to the specific address that is not application source code section.
the informations are sw version, application source code mask to check validation and so on.
I can read the information I want at the address in binary file.
The way you showed me is not right for what i want.
Thanks for your help.
Best regards,
Byungju.