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;
Hi,
which device and which IDE do you use?
Regards,
Lukas
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