AR 開發環境下使用 .icf文件定義 MCU及其外擴資源的應用範圍,這些在項目設計之前必須被確定下來。所以認識它非常重要。那麼該文件是如何定義的呢?
下面通過一個.icf來認識其具體結構:
這是一個基於STM32芯片的.icf文件定義結構:
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/********************************-Specials-************************************/
/*由於STM32內部flash的起始地址爲 0x08000000, 所以如下語句定義程序的起始地址,但對於一個應用程序,其起始運行地址不一定是 芯片定義的初地址,其可根據實際需要修改,當修改後,必須特殊設計一段引導代碼使其能跳到應用程序中來。 由於作者的系統的APP 起始地址爲 0x08008000 ,所以我的應用程序app start addrress 定義如下:*/
define symbol __ICFEDIT_intvec_start__ = 0x08008000;
/********************************-Memory Regions-******************************/
/* 定義內部FLASH地址 */
define symbol __ICFEDIT_region_ROM_start__ = 0x08008000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
/* 定義內部RAM地址 */
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
/* 定義擴展RAM地址 */
define symbol __ICFEDIT_region_EXRAM_start__ = 0x68000000;
define symbol __ICFEDIT_region_EXRAM_end__ = 0x68040000;
/*********************************-Sizes-***************************************/
/* 棧和堆大小,一般不需要修改 */
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__ = 0x200;
/******************************* End of ICF editor section. ###ICF###***********/
define memory mem with size = 4G;
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
/*定義內部 RAM ROM, 以及外部RAM 地址範圍 */
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define region EXRAM_region = mem:[from __ICFEDIT_region_EXRAM_start__ to __ICFEDIT_region_EXRAM_end__];
/*
********************************************************************************
Define Bootloader address
********************************************************************************
*/
/* 這段語句相當於一個標誌位,使的以 ILOADER 聲明的代碼放在如下空間內,具體聲明方式如下:
#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 };
/*******************************************************************************/
/* 下列語句定義所定義地址空間內可完成的操作類型*/
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite, block CSTACK, block HEAP };
/* 對外部RAM操作類型的聲明 */
place in EXRAM_region {readwrite data section SDRAM }; /* EXTSRAM_region */
/* 定義一個標誌位,代表擴展RAM的起始地址,可以再應用函數中直接調用SDRAM_BASE_ADDR 這個變量 */
define exported symbol SDRAM_BASE_ADDR = __ICFEDIT_region_EXRAM_start__;
/******************************* End of this file ******************************/
發佈了14 篇原創文章 · 獲贊 40 · 訪問量 11萬+