iar for arm 8.41 icf文件

阅读: 评论:0

iar for arm 8.41  icf文件

iar for arm 8.41 icf文件

Iar 链接文件中的icf文件    

1. memory   可编址的存储空间

2. region    不同的存储器地址区域

3.  block     不同的地址块

4.  Section的 初始化与否

5.  Section  在存储空间中的放置

 

1. 将数组放入指定节区里

#pragma location = "ILOADER"
__root const unsigned char RBL_Code[] = {0x00, 0x04, 0x00, 0x20, 0x85, 0x2C, 0x00, 0x08, 0x9D, 0x2C, 0x00, 0x08, 0x9F, 0x2C, 0x00, 0x08,0xA1, 0x2C, 0x00, 0x08, 0xA3, 0x2C, 0x00, 0x08, 0xA5, 0x2C, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA7, 0x2C, 0x00, 0x08,
};
*/
define region ILOADER_region         = mem:[from 0x08000000 to 0x08003FFF];      
place in ILOADER_region         { readonly section ILOADER };

2. 在 程序中:定义一个section :#pragma section = “MYSECTION”

定义变量或数组时:

#pragma location = "MYSECTION"
UartItem uart1;//定义的串口设备变量

或者

unsigned char buf [100]@"MYSECTION";

在ICF配置中:

define region EXRAM_region   = mem:[from __ICFEDIT_region_EXTRAM_start__ to __ICFEDIT_region_EXTRAM_end__];

place in EXRAM_region { readwrite section MYSECTION};
 

3.验证

        .c 文件中定义一个全局变量

int testdata@"MYSECTION";            //定义
/*
** ###################################################################
**     Processors:          MK64FN1M0CAJ12
**                          MK64FN1M0VDC12
**                          MK64FN1M0VLL12
**                          MK64FN1M0VLQ12
**                          MK64FN1M0VMD12
**
**     Compiler:            IAR ANSI C/C++ Compiler for ARM
**     Reference manual:    K64P144M120SF5RM, Rev.2, January 2014
**     Version:             rev. 2.9, 2016-03-21
**     Build:               b180911
**
**     Abstract:
**         Linker file for the IAR ANSI C/C++ Compiler for ARM
**
**     Copyright 2016 Freescale Semiconductor, Inc.
**     Copyright 2016-2018 NXP
**     All rights reserved.
**
**     Redistribution and use in source and binary forms, with or without modification,
**     are permitted provided that the following conditions are met:
**
**     1. Redistributions of source code must retain the above copyright notice, this list
**       of conditions and the following disclaimer.
**
**     2. Redistributions in binary form must reproduce the above copyright notice, this
**       list of conditions and the following disclaimer in the documentation and/or
**       other materials provided with the distribution.
**
**     3. Neither the name of the copyright holder nor the names of its
**       contributors may be used to endorse or promote products derived from this
**       software without specific prior written permission.
**
**     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
**     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
**     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
**     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
**     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
**     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
**     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
**     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
**     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
**     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
**     http:                 p
**     mail:                 support@nxp
**
** ###################################################################
*/define symbol m_interrupts_start       = 0x00000000;
define symbol m_interrupts_end         = 0x000003FF;define symbol m_flash_config_start     = 0x00000400;
define symbol m_flash_config_end       = 0x0000040F;define symbol m_text_start             = 0x00000410;
define symbol m_text_end               = 0x000FFFFF;define symbol m_data_start             = 0x1FFF0000;
define symbol m_data_end               = 0x1FFFFFFF;define symbol m_data_2_start           = 0x20000000;
define symbol m_data_2_end             = 0x2002FFFF;/* Sizes */
if (isdefinedsymbol(__stack_size__)) {define symbol __size_cstack__        = __stack_size__;
} else {define symbol __size_cstack__        = 2048;
}if (isdefinedsymbol(__heap_size__)) {define symbol __size_heap__          = __heap_size__;
} else {define symbol __size_heap__          = 25600;
}define memory mem with size = 4G;
define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];
define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]| mem:[from m_text_start to m_text_end];
define region DATA_region2 = mem:[from m_data_start to m_data_end];
define region DATA_region = mem:[from m_data_2_start to m_data_2_end-__size_cstack__];
define region CSTACK_region = mem:[from m_data_2_end-__size_cstack__+1 to m_data_2_end];define block CSTACK    with alignment = 8, size = __size_cstack__   { };
define block HEAP      with alignment = 8, size = __size_heap__     { };
define block RW        { readwrite };
define block ZI        { zi };initialize by copy { readwrite, section .textrw };
do not initialize  { section .noinit };place at address mem: m_interrupts_start    { readonly section .intvec };
place in m_flash_config_region              { section FlashConfig };
place in TEXT_region                        { readonly };
place in DATA_region                        { block RW };
place in DATA_region                        { block ZI };
place in DATA_region                        { last block HEAP };
place in CSTACK_region                      { block CSTACK };
place in DATA_region2                        {readwrite section MYSECTION};
place in DATA_region2                        {readwrite object lwip_udpecho_freertos.o};
//将某个.o文件中的读写变量指定区域

 

结果:

 

经验证:

int testdata; //@"MYSECTION";
int b[8]@"MYSECTION";

都要有效。

 

 

本文发布于:2024-02-04 11:00:48,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170705659854980.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:文件   arm   iar   icf
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23