Relocating Code and Data in Internal RAM

Create a new section using section pragma directive and __declspec directives as shown in the listing below.

Listing 1. Using pragma Directives to Define a Section
#pragma section  ".myCodeInRAM" data_mode=far_abs
__declspec(section ".myCodeInRAM")

struct {

unsigned char data0;

unsigned char data1;

unsigned char data2;

unsigned char data3;

unsigned char data4;

unsigned char data5;

unsigned char data6;

unsigned char data7;

} CTMData = { 0x82, 0x65, 0x77, 0x32, 0x84, 0x69, 0x83, 0x84 };

__declspec(section ".myCodeInRAM")  void funcInROM(int flag); 

 void funcInROM(int flag){

if (flag > 0)

{

flag++;

}

}



This Information Center content is based on CWMCUPABTR Rev 10.5, 09/2013, which can be downloaded from www.freescale.com.