20
20
/*-Editor annotation file-*/
21
21
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
22
22
23
- include "../../../device/partition_M2351_mem.icf";
23
+ include "../../../device/partition_M2351_mem.icf.h ";
24
24
25
- if (! isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
25
+ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
26
26
define symbol MBED_BOOT_STACK_SIZE = 0x400;
27
27
}
28
28
@@ -38,6 +38,10 @@ define symbol __ICFEDIT_region_IRAM_end__ = MBED_RAM_APP_START + MBED_RAM_
38
38
39
39
/*-Sizes-*/
40
40
define 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);
41
45
define symbol __ICFEDIT_size_heap__ = 0x400;
42
46
43
47
@@ -48,26 +52,72 @@ define memory mem with size = 4G;
48
52
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
49
53
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
50
54
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 };
52
58
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
+ }
54
63
define block HEAP with expanding size, alignment = 8, minimum size = __ICFEDIT_size_heap__ { };
55
64
/* 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
+ }
58
75
59
76
initialize by copy { readwrite };
60
77
do not initialize { section .noinit };
61
78
62
79
place at address mem: __ICFEDIT_intvec_start__ { readonly section .intvec };
63
80
place 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 };
65
82
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
+ }
67
89
place 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
+
69
102
place in IRAM_region { block HEAP };
70
103
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
+ /*
71
108
if (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;
73
122
}
123
+ */
0 commit comments