2020/*-Editor annotation file-*/
2121/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
2222
23- include "../../../device/partition_M2351_mem.icf";
23+ include "../../../device/partition_M2351_mem.icf.h ";
2424
25- if (! isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
25+ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
2626 define symbol MBED_BOOT_STACK_SIZE = 0x400;
2727}
2828
@@ -38,6 +38,10 @@ define symbol __ICFEDIT_region_IRAM_end__ = MBED_RAM_APP_START + MBED_RAM_
3838
3939/*-Sizes-*/
4040define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
41+ if (TFM_LVL > 0) {
42+ define symbol __ICFEDIT_size_cstack_msp__ = 0x800;
43+ }
44+ define symbol __ICFEDIT_size_intvec__ = 4 * (16 + 102);
4145define symbol __ICFEDIT_size_heap__ = 0x400;
4246
4347
@@ -48,26 +52,72 @@ define memory mem with size = 4G;
4852define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
4953define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
5054
51- define block Image$$ER_IROM_NSC with alignment = 32 { readonly section Veneer$$CMSE };
55+ /* IAR has something wrong with "$$" in section/block name. So unlike other toolchains,
56+ * we name "ER_IROM_NSC" instead of "Image$$ER_IROM_NSC". */
57+ define block ER_IROM_NSC with alignment = 32 { readonly section Veneer$$CMSE };
5258
53- define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
59+ define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
60+ if (TFM_LVL > 0) {
61+ define block CSTACK_MSP with alignment = 8, size = __ICFEDIT_size_cstack_msp__ { };
62+ }
5463define block HEAP with expanding size, alignment = 8, minimum size = __ICFEDIT_size_heap__ { };
5564/* NOTE: Vector table base requires to be aligned to the power of vector table size. Give a safe value here. */
56- define block IRAMVEC with alignment = 1024, size = 4 * (16 + 102) { };
57-
65+ define block IRAMVEC with alignment = 1024, size = __ICFEDIT_size_intvec__ { };
66+
67+ if (TFM_LVL == 1) {
68+ define block TDB_INTERNAL_STORAGE with size = NU_TDB_INTERNAL_STORAGE_SIZE{ };
69+ define block TFM_SECURE_STACK with alignment = 128, size = 0x1000 { };
70+ define block TFM_UNPRIV_SCRATCH with alignment = 32, size = 0x400 { };
71+ define block ER_TFM_DATA with alignment = 8 { readwrite };
72+ } else if (TFM_LVL > 1) {
73+ error "TFM level 2/3 are not supported yet";
74+ }
5875
5976initialize by copy { readwrite };
6077do not initialize { section .noinit };
6178
6279place at address mem: __ICFEDIT_intvec_start__ { readonly section .intvec };
6380place in ROM_region { readonly };
64- place at address mem: NU_TZ_NSC_START { block Image$$ ER_IROM_NSC }
81+ place at address mem: NU_TZ_NSC_START { block ER_IROM_NSC };
6582
66- place at start of IRAM_region { block CSTACK };
83+ if (TFM_LVL == 0) {
84+ place at start of IRAM_region { block CSTACK };
85+ } else {
86+ place at start of IRAM_region { block CSTACK_MSP };
87+ place in IRAM_region { block CSTACK };
88+ }
6789place in IRAM_region { block IRAMVEC };
68- place in IRAM_region { readwrite };
90+
91+ if (TFM_LVL == 0) {
92+ place in IRAM_region { readwrite };
93+ } else if (TFM_LVL == 1) {
94+ place at address mem: NU_TDB_INTERNAL_STORAGE_START { block TDB_INTERNAL_STORAGE };
95+ place in IRAM_region { block TFM_SECURE_STACK };
96+ place in IRAM_region { block TFM_UNPRIV_SCRATCH };
97+ place in IRAM_region { block ER_TFM_DATA };
98+ } else {
99+ error "TFM level 2/3 are not supported yet";
100+ }
101+
69102place in IRAM_region { block HEAP };
70103
104+ define exported symbol Image$$ER_IROM_NSC$$Base = NU_TZ_NSC_START;
105+
106+ /* TODO: Export the following symbols to support TFM secure code */
107+ /*
71108if (TFM_LVL > 0) {
72- /* TODO: Check if TDB internal storage area overlaps with application ROM code */
109+ define exported symbol Image$$ARM_LIB_STACK$$ZI$$Limit = Start of CSTACK;
110+ }
111+ if (TFM_LVL == 1) {
112+ define exported symbol Image$$TFM_SECURE_STACK$$ZI$$Base = Start of TFM_SECURE_STACK;
113+ define exported symbol Image$$TFM_SECURE_STACK$$ZI$$Limit = End of TFM_SECURE_STACK;
114+ define exported symbol Image$$TFM_UNPRIV_SCRATCH$$ZI$$Base = Start of TFM_UNPRIV_SCRATCH;
115+ define exported symbol Image$$TFM_UNPRIV_SCRATCH$$ZI$$Limit = End of TFM_UNPRIV_SCRATCH;
116+ define exported symbol Image$$ER_TFM_DATA$$RW$$Base = Start of ER_TFM_DATA (readwrite - zeroinit);
117+ define exported symbol Image$$ER_TFM_DATA$$RW$$Limit = End of ER_TFM_DATA (zeroinit);
118+ define exported symbol Image$$ER_TFM_DATA$$ZI$$Base = End of ER_TFM_DATA (zeroinit);
119+ define exported symbol Image$$ER_TFM_DATA$$ZI$$Limit = ADDR(.TFM_BSS) + SIZEOF(.TFM_BSS);
120+ define exported symbol Image$$ARM_LIB_HEAP$$ZI$$Base = Start of HEAP;
121+ define exported symbol Image$$ARM_LIB_HEAP$$ZI$$Limit = End of HEAP;
73122}
123+ */
0 commit comments