Skip to content

Commit 0ae6a04

Browse files
authored
Merge pull request #9431 from deepikabhavnani/iar_armv8m_changes
Update IAR Armv8M changes
2 parents 026000d + 811152d commit 0ae6a04

File tree

3 files changed

+27
-39
lines changed

3 files changed

+27
-39
lines changed

targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,6 @@ extern void SystemInit(void);
130130
extern void SystemCoreClockUpdate(void);
131131

132132

133-
134-
135-
#if defined (__ICCARM__)
136-
uint32_t __TZ_get_PSP_NS(void);
137-
void __TZ_set_PSP_NS(uint32_t topOfProcStack);
138-
int32_t __TZ_get_MSP_NS(void);
139-
void __TZ_set_MSP_NS(uint32_t topOfMainStack);
140-
uint32_t __TZ_get_PRIMASK_NS(void);
141-
void __TZ_set_PRIMASK_NS(uint32_t priMask);
142-
#endif
143-
144-
145-
146133
#ifdef __cplusplus
147134
}
148135
#endif

tools/export/iar/iar_definitions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,8 @@
341341
"GBECoreSlave": 39,
342342
"FPU2": 6,
343343
"GFPUCoreSlave2": 39
344+
},
345+
"M2351KIAAEES": {
346+
"OGChipSelectEditMenu": "M2351 series\tNuvoton M2351 series"
344347
}
345348
}

tools/toolchains/iar.py

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from os.path import join, splitext, exists
2020
from distutils.version import LooseVersion
2121

22+
from tools.targets import CORE_ARCH
2223
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
2324
from tools.hooks import hook_tool
2425
from tools.utils import run_cmd, NotSupportedException
@@ -43,23 +44,34 @@ def check_executable():
4344

4445
def __init__(self, target, notify=None, macros=None, build_profile=None,
4546
build_dir=None):
46-
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir,
47-
build_profile=build_profile)
48-
if target.core == "Cortex-M7F" or target.core == "Cortex-M7FD":
49-
cpuchoice = "Cortex-M7"
50-
elif target.core.startswith("Cortex-M23"):
51-
cpuchoice = "8-M.baseline"
52-
elif target.core.startswith("Cortex-M33"):
53-
cpuchoice = "8-M.mainline"
54-
else:
55-
cpuchoice = target.core
47+
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir, build_profile=build_profile)
48+
core = target.core
49+
if CORE_ARCH[target.core] == 8:
50+
# Add linking time preprocessor macro DOMAIN_NS
51+
if target.core.endswith("-NS"):
52+
define_string = self.make_ld_define("DOMAIN_NS", "0x1")
53+
self.flags["ld"].append(define_string)
54+
core = target.core[:-3]
55+
else:
56+
# Create Secure library
57+
self.flags["asm"] += ["--cmse"]
58+
self.flags["common"] += ["--cmse"]
59+
secure_file = join(build_dir, "cmse_lib.o")
60+
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]
61+
62+
cpu = {
63+
"Cortex-M7FD": "Cortex-M7.fp.dp",
64+
"Cortex-M7F": "Cortex-M7.fp.sp",
65+
"Cortex-M33": "Cortex-M33.no_dsp",
66+
"Cortex-M33F": "Cortex-M33.fp.no_dsp",
67+
"Cortex-M33FE": "Cortex-M33.fp"}.get(core, core)
5668

5769
# flags_cmd are used only by our scripts, the project files have them already defined,
5870
# using this flags results in the errors (duplication)
5971
# asm accepts --cpu Core or --fpu FPU, not like c/c++ --cpu=Core
60-
asm_flags_cmd = ["--cpu", cpuchoice]
72+
asm_flags_cmd = ["--cpu", cpu]
6173
# custom c flags
62-
c_flags_cmd = ["--cpu", cpuchoice]
74+
c_flags_cmd = ["--cpu", cpu]
6375

6476
c_flags_cmd.extend([
6577
"--thumb", "--dlib_config", "DLib_Config_Full.h"
@@ -68,20 +80,6 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
6880
cxx_flags_cmd = [
6981
"--c++", "--no_rtti", "--no_exceptions"
7082
]
71-
if target.core == "Cortex-M7FD":
72-
asm_flags_cmd += ["--fpu", "VFPv5"]
73-
c_flags_cmd.append("--fpu=VFPv5")
74-
elif target.core == "Cortex-M7F":
75-
asm_flags_cmd += ["--fpu", "VFPv5_sp"]
76-
c_flags_cmd.append("--fpu=VFPv5_sp")
77-
elif target.core == "Cortex-M23" or target.core == "Cortex-M33" or target.core == "Cortex-M33F":
78-
self.flags["asm"] += ["--cmse"]
79-
self.flags["common"] += ["--cmse"]
80-
81-
# Create Secure library
82-
if target.core == "Cortex-M23" or self.target.core == "Cortex-M33" or self.target.core == "Cortex-M33F":
83-
secure_file = join(build_dir, "cmse_lib.o")
84-
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]
8583

8684
IAR_BIN = join(TOOLCHAIN_PATHS['IAR'], "bin")
8785
main_cc = join(IAR_BIN, "iccarm")

0 commit comments

Comments
 (0)