本帖最后由 AwesomeOY 于 2025-1-11 10:16 编辑
MCU: STM32H750VB
环境: IAR 9.30.1
内存分配: Flash空间存储代码;ITCM存储关键代码;DTCM存储ReadWrite数据
icf文件配置如下:
[C] 纯文本查看 复制代码 /*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\linker\ST\IcfEditor\stm32h7xx.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_FLASH1_start__ = 0x08000000;
define symbol __ICFEDIT_region_FLASH1_end__ = 0x0801FFFF;
define symbol __ICFEDIT_region_ITCMR_start__ = 0x00000008;
define symbol __ICFEDIT_region_ITCMR_end__ = 0x0000FFFF;
define symbol __ICFEDIT_region_DTCMR1_start__ = 0x20000000;
define symbol __ICFEDIT_region_DTCMR1_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_AXISR_start__ = 0x24000000;
define symbol __ICFEDIT_region_AXISR_end__ = 0x2407FFFF;
define symbol __ICFEDIT_region_SRAM1_start__ = 0x30000000;
define symbol __ICFEDIT_region_SRAM1_end__ = 0x3001FFFF;
define symbol __ICFEDIT_region_SRAM2_start__ = 0x30020000;
define symbol __ICFEDIT_region_SRAM2_end__ = 0x3003FFFF;
define symbol __ICFEDIT_region_SRAM3_start__ = 0x30040000;
define symbol __ICFEDIT_region_SRAM3_end__ = 0x30047FFF;
define symbol __ICFEDIT_region_SRAM4_start__ = 0x38000000;
define symbol __ICFEDIT_region_SRAM4_end__ = 0x3800FFFF;
define symbol __ICFEDIT_region_BKPR_start__ = 0x38800000;
define symbol __ICFEDIT_region_BKPR_end__ = 0x38800FFF;
define symbol __ICFEDIT_region_SDR1_start__ = 0x0;
define symbol __ICFEDIT_region_SDR1_end__ = 0x0;
define symbol __ICFEDIT_region_SDR2_start__ = 0x0;
define symbol __ICFEDIT_region_SDR2_end__ = 0x0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
//define symbol __ICFEDIT_size_proc_stack__ = 0x0;
define symbol __ICFEDIT_size_heap__ = 0x800;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region FLASH_region = mem:[from __ICFEDIT_region_FLASH1_start__ to __ICFEDIT_region_FLASH1_end__];
define region ITCMR_region = mem:[from __ICFEDIT_region_ITCMR_start__ to __ICFEDIT_region_ITCMR_end__ ];
define region DTCMR_region = mem:[from __ICFEDIT_region_DTCMR1_start__ to __ICFEDIT_region_DTCMR1_end__];
define region AXISR_region = mem:[from __ICFEDIT_region_AXISR_start__ to __ICFEDIT_region_AXISR_end__ ];
define region SRAM1_region = mem:[from __ICFEDIT_region_SRAM1_start__ to __ICFEDIT_region_SRAM1_end__ ];
define region SRAM2_region = mem:[from __ICFEDIT_region_SRAM2_start__ to __ICFEDIT_region_SRAM2_end__ ];
define region SRAM3_region = mem:[from __ICFEDIT_region_SRAM3_start__ to __ICFEDIT_region_SRAM3_end__ ];
define region SRAM4_region = mem:[from __ICFEDIT_region_SRAM4_start__ to __ICFEDIT_region_SRAM4_end__ ];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
//define block PROC_STACK with alignment = 8, size = __ICFEDIT_size_proc_stack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
initialize by copy { section .text_rw };
if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
{
// Required in a multi-threaded application
initialize by copy with packing = none { section __DLIB_PERTHREAD };
}
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in DTCMR_region { readwrite, section dtcm_ram, block CSTACK, block HEAP};
place in AXISR_region { section .sram_axi };
place in SRAM1_region { section .sram1 };
place in SRAM2_region { section .sram2 };
place in SRAM3_region { section .sram3 };
place in SRAM4_region { section .sram4 };
place in FLASH_region { readonly };
initialize by copy {
section .text object msp.o
};
place in ITCMR_region { section .textrw };
place in ITCMR_region {
section .text object msp.o
};
但是编译会报链接器错误,不知道什么原因,有大神指点下吗?
[C] 纯文本查看 复制代码 错误:
Warning[Lp051]: some sections in automatic block ".text" would have been placed differently if they were not part of an automatic block. Example: section ".text (msp.o #8)" would have matched "object msp.o section .text" Hat line 75 of "D:\SVN_Project\UAM221\trunk\UAM221_H750VB_APP\EWARM\stm32h750xx_flash.icf"h. Instead, it is placed in block ".text" which matched "rw" Hat line 60 of "D:\SVN_Project\UAM221\trunk\UAM221_H750VB_APP\EWARM\stm32h750xx_flash.icf"h.
Error[Lp008]: ambiguous placement when building the automatic block ".text": member "ro code section .text" matches a different place ("P7" Hat line 67 of "D:\SVN_Project\UAM221\trunk\UAM221_H750VB_APP\EWARM\stm32h750xx_flash.icf"h) than member "rw code section .text" ("P1" Hat line 60 of "D:\SVN_Project\UAM221\trunk\UAM221_H750VB_APP\EWARM\stm32h750xx_flash.icf"h)
Error[Lp005]: placement includes a mix of sections with content (example "ro code section .text in app.o symbols: [app_loop, get_radar_core, app_init]") [suitable for placement in ROM] and sections without content (example "rw code section .text in msp.o symbols: [msp_rangfinder_data_message_encode, crc8_calc, crc8_update]") [suitable for placement in RAM] D:\SVN_Project\UAM221\trunk\UAM221_H750VB_APP\EWARM\stm32h750xx_flash.icf 67
单独用简单的工程使用icf配置是没有问题的,但是结合该工程(源码模块多)就出现上面的报错。
|