Skip to content

Commit a76e49c

Browse files
committed
M2351: Support IAR
1. Enable IAR on non-secure targets 2. Disable IAR on secure targets because: (1) IAR toolchain bug: As of IAR 8.32, cmse_nonsecure_caller() is not always inlined. (2) TFM hasn't supported IAR yet.
1 parent 5ec9b79 commit a76e49c

File tree

3 files changed

+139
-1
lines changed

3 files changed

+139
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2018-2019, Nuvoton Technology Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/*###ICF### Section handled by ICF editor, don't touch! ****/
20+
/*-Editor annotation file-*/
21+
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
22+
23+
include "../../../device/partition_M2351_mem.icf.h";
24+
25+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
26+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
27+
}
28+
29+
/*-Specials-*/
30+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
31+
/*-Memory Regions-*/
32+
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
33+
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
34+
define symbol __ICFEDIT_region_IRAM_start__ = MBED_RAM_APP_START;
35+
define symbol __ICFEDIT_region_IRAM_end__ = MBED_RAM_APP_START + MBED_RAM_APP_SIZE - 1;
36+
37+
/*-Sizes-*/
38+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
39+
define symbol __ICFEDIT_size_intvec__ = 4 * (16 + 102);
40+
define symbol __ICFEDIT_size_heap__ = 0x400;
41+
42+
/**** End of ICF editor section. ###ICF###*/
43+
44+
45+
define memory mem with size = 4G;
46+
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
47+
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
48+
49+
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
50+
define block HEAP with expanding size, alignment = 8, minimum size = __ICFEDIT_size_heap__ { };
51+
/* NOTE: Vector table base requires to be aligned to the power of vector table size. Give a safe value here. */
52+
define block IRAMVEC with alignment = 1024, size = __ICFEDIT_size_intvec__ { };
53+
54+
55+
initialize by copy { readwrite };
56+
do not initialize { section .noinit };
57+
58+
place at address mem: __ICFEDIT_intvec_start__ { readonly section .intvec };
59+
place in ROM_region { readonly };
60+
61+
place at start of IRAM_region { block CSTACK };
62+
place in IRAM_region { block IRAMVEC };
63+
place in IRAM_region { readwrite };
64+
place in IRAM_region { block HEAP };
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright (c) 2018-2019, Nuvoton Technology Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/*###ICF### Section handled by ICF editor, don't touch! ****/
20+
/*-Editor annotation file-*/
21+
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
22+
23+
include "../../../device/partition_M2351_mem.icf.h";
24+
25+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
26+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
27+
}
28+
29+
/* FIXME: Check NSC area requirement */
30+
31+
/*-Specials-*/
32+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
33+
/*-Memory Regions-*/
34+
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
35+
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
36+
define symbol __ICFEDIT_region_IRAM_start__ = MBED_RAM_APP_START;
37+
define symbol __ICFEDIT_region_IRAM_end__ = MBED_RAM_APP_START + MBED_RAM_APP_SIZE - 1;
38+
39+
/*-Sizes-*/
40+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
41+
define symbol __ICFEDIT_size_intvec__ = 4 * (16 + 102);
42+
define symbol __ICFEDIT_size_heap__ = 0x400;
43+
44+
45+
/**** End of ICF editor section. ###ICF###*/
46+
47+
48+
define memory mem with size = 4G;
49+
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
50+
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
51+
52+
/* IAR has something wrong with "$$" in section/block name. So unlike other toolchains,
53+
* we name "ER_IROM_NSC" instead of "Image$$ER_IROM_NSC". */
54+
define block ER_IROM_NSC with alignment = 32 { readonly section Veneer$$CMSE };
55+
56+
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
57+
define block HEAP with expanding size, alignment = 8, minimum size = __ICFEDIT_size_heap__ { };
58+
/* NOTE: Vector table base requires to be aligned to the power of vector table size. Give a safe value here. */
59+
define block IRAMVEC with alignment = 1024, size = __ICFEDIT_size_intvec__ { };
60+
61+
62+
initialize by copy { readwrite };
63+
do not initialize { section .noinit };
64+
65+
place at address mem: __ICFEDIT_intvec_start__ { readonly section .intvec };
66+
place in ROM_region { readonly };
67+
place at address mem: NU_TZ_NSC_START { block ER_IROM_NSC };
68+
69+
place at start of IRAM_region { block CSTACK };
70+
place in IRAM_region { block IRAMVEC };
71+
place in IRAM_region { readwrite };
72+
place in IRAM_region { block HEAP };
73+
74+
define exported symbol Image$$ER_IROM_NSC$$Base = NU_TZ_NSC_START;

targets/targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8943,7 +8943,7 @@
89438943
"inherits": ["NU_PFM_M2351"],
89448944
"core": "Cortex-M23-NS",
89458945
"trustzone": true,
8946-
"supported_toolchains": ["ARMC6", "GCC_ARM"],
8946+
"supported_toolchains": ["ARMC6", "GCC_ARM", "IAR"],
89478947
"extra_labels_add": [
89488948
"M23_NS",
89498949
"NU_PREBUILD_SECURE"

0 commit comments

Comments
 (0)