The data locating methods are as follows:
1. _ no_init char Alpha @ 0x0200;
2. # pragma location = 0x0202
Const int Beta;
3, const int gamma @ 0x0204 = 3;
Or;
1. _ no_init int Alpha @ "mysegment"; // The mysegment segment can be opened in xcl.
2. # pragma location = "mysegment"
Const int Beta;
3. Const int gamma @ "mysegment" = 3;
Function Positioning is written in the following two ways:
1,
Void g (void) @ "mysegment" // The mysegment segment can be opened in xcl
{
}
2,
# Pragma location = "mysegment"
Void H (void)
{
}
Change the xcl File
Note: Changes to the. xcl connection file may be involved in the implementation process. Please save the original. xcl file!
1. Open the corresponding * C. xcl file and use the "-z (const) segment name = the target segment located by the Program-ffdf" to define the start address of the segment.
2. Use # pragma constseg (segment name) in your c program to locate your program
3. Restore the default location of the compiler after the end # pragma default
In IAR 1.26b:
1. Place the constant array in the Custom myseg segment of the flash segment.
The original msp430f149 xcl file is as follows:
// Constant daTa
-Z (const) daTa16_c, daTa16_id, difunct, checksum = 1100-ffdf
If you want to split a part of it into a data storage area, make the following changes:
-Z (const) daTa16_c, daTa16_id, difunct, checksum = 1500-ffdf // separate 1100-14ff from Rom to the number of Arry
Group
-Z (const) myseg = 1100-14ff
The interval size can be determined by yourself
The program can be described as follows:
# Pragma memory = constseg (myseg) // modify it in the. xcl File
Char arry [] = {1, 2, 4, 5, 6, 7 };
# Pragma memory = default
2. Put variables in the named segments
Open a myseg segment in the xcl file, as described above
# Pragma memory = dataseg (myseg)
Char I;
Char J;
Int K;
# Pragma memory = default