Place Symbols in Specific Memory Location

For placing the symbols in specific memory location, user has to define the memory region (say Memory_to_store ) in the lcf file and also define a new section (say .user_defined_section) then use the same section in the source file to place the symbol.

Listing 1. Example for initialized variable
In the source file:
#pragma section  <section_qualifier(R,RW)> ".user_defined_section" 

__declspec(section ".user_defined_section") int temp = 5;

In the LCF file:

    GROUP : {    

.user_defined_section :{}

    } > Memory_to_store             // Memory_to_store is the memory area where user want to 
store
Listing 2. Example for uninitialized variable
In the source file:
#pragma section  ".user_defined_section"".data"  

 __declspec(section ".user_defined_section") /* We cannot have an uninitialized section name 
in The //uninitialized section must be paired with initialized section. */

__declspec(section ".user_defined_section") int temp;

In the LCF file:

    GROUP : {    

.user_defined_section :{}

    } > Memory_to_store