How to moved variable to certain section of RAM memory

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to moved variable to certain section of RAM memory

1,544 次查看
vikasb
Contributor II

I want to know is  there in method to align the indivialial variable declared is such way that blow variable can be  moved

to some section of RAM memory,

 

I want align below variable to RAM memory section to 0x40005000

 

volatile real32_T Main_KD = 6.0F; RAM address = 0x40005000
volatile real32_T Main_KD_limit = 1.0F; RAM address = 0x40005004
volatile real32_T Main_KP1 = 4.0F; RAM address = 0x40005008
volatile real32_T Main_KP2 = 2.0F; RAM address = 0x4000500C
volatile real32_T Main_KP_conv1 = 0.15F;  so on
volatile real32_T Main_KP_conv2 = 1.0F;
volatile real32_T Main_Threshold_off = 1.0F;
volatile real32_T Main_Threshold_on = 2.0F;
volatile real32_T Main_deadbandA = 0.0F;
volatile real32_T Main_deadbandB = 0.0F;

标签 (1)
0 项奖励
回复
4 回复数

1,424 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

which device and which IDE do you use?

Regards,

Lukas

0 项奖励
回复

1,424 次查看
vikasb
Contributor II

Hello Luncas,

I’m using the MPC5553 controller with codewarrior IDE v2.8 for developing the software.

-Vikas

0 项奖励
回复

1,424 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Here is simple example which I copied from some old test project.

In linker file:

MEMORY

{

...

my_ram:          org = 0x40030000,   len = 0x0000C000   //just example, use addresses you need

...

}

SECTIONS

{

...

.__my_ram: {} > my_ram

...

}

In *.c file:

#pragma push
#pragma section all_types ".__my_ram" ".__my_ram" data_mode=far_abs
volatile unsigned int data1;

volatile unsigned int data2;

volatile unsigned int data3;
#pragma pop

The order of data1, data2, data3 in RAM will be the same as order in this section. You can check it in the map file.

Regards,

Lukas

0 项奖励
回复

1,424 次查看
vikasb
Contributor II

Thanks for help, now I could manage the RAM memory addressing as per my need.

0 项奖励
回复