Salesforce

Storing the value in particular memory location using GCC

Information

 
TitleStoring the value in particular memory location using GCC
Question
How can I store a value in a particular memory location? 
Answer
This FAQ will explain about how to store a particular value in a memory location. For example consider you want to store 0x0A in the particular memory location 0x1FE.

1. 
You can use __attribute to store data in a particular location. 

__attribute__((section(".memory"))) 
unsigned char memory=0x0A;

2. G
o to Project-> Project Properties->Toolchain-> AVR/GNU Linker-> Miscellaneous, and add the linker flag as “-Wl,--section-start=.version=0x1FE”.

User-added image

3. Build the Project. The memory section will start at 0x1F and value (0x0A) will be stored.


Note: U
ncheck the option garbage collect from Project-> Project Properties->Toolchain-> AVR/GNU Linker->Optimization. 




 
URL NameStoring-the-value-in-particular-memory-location-using-GCC


Powered by