IAR data locating method, which is used to define the serial number and the data to be stored

Source: Internet
Author: User

 

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.