Create New RAM Section

The memory segment specifies the intended location in RAM. The code below shows a new section called .my_ram which is going to be linked in segment .myram but is going to be resident in the Flash memory address calculated by label ___CodeStart. This label is intended to find the first address available in flash.

In the listing section .app_text the linker places in the segment code all the code and then the read only data. After this it sets a label called __ROM_AT. Section .data is allocated in the address pointed by this label.

Add the following code to LCF. You can put this code just after Placing data in RAM . The uninitialized and initialized data are placed in RAM.

Listing 1. Add this Code to LCF after Listing D.
___CodeStart = ___RAM_end;
.my_ram : 

{

. = ALIGN (0x4);

___myRAMStart = .;

*(.myCodeInRAM)

___myRAMEnd = .;

. = ALIGN (0x4);

} > myram