Skip to content

Update IAR Armv8M changes #9431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions targets/TARGET_NUVOTON/TARGET_M2351/device/system_M2351.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ extern void SystemInit(void);
extern void SystemCoreClockUpdate(void);




#if defined (__ICCARM__)
uint32_t __TZ_get_PSP_NS(void);
void __TZ_set_PSP_NS(uint32_t topOfProcStack);
int32_t __TZ_get_MSP_NS(void);
void __TZ_set_MSP_NS(uint32_t topOfMainStack);
uint32_t __TZ_get_PRIMASK_NS(void);
void __TZ_set_PRIMASK_NS(uint32_t priMask);
#endif



#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 3 additions & 0 deletions tools/export/iar/iar_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,8 @@
"GBECoreSlave": 39,
"FPU2": 6,
"GFPUCoreSlave2": 39
},
"M2351KIAAEES": {
"OGChipSelectEditMenu": "M2351 series\tNuvoton M2351 series"
}
}
50 changes: 24 additions & 26 deletions tools/toolchains/iar.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from os.path import join, splitext, exists
from distutils.version import LooseVersion

from tools.targets import CORE_ARCH
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
from tools.hooks import hook_tool
from tools.utils import run_cmd, NotSupportedException
Expand All @@ -43,23 +44,34 @@ def check_executable():

def __init__(self, target, notify=None, macros=None, build_profile=None,
build_dir=None):
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)
if target.core == "Cortex-M7F" or target.core == "Cortex-M7FD":
cpuchoice = "Cortex-M7"
elif target.core.startswith("Cortex-M23"):
cpuchoice = "8-M.baseline"
elif target.core.startswith("Cortex-M33"):
cpuchoice = "8-M.mainline"
else:
cpuchoice = target.core
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir, build_profile=build_profile)
core = target.core
if CORE_ARCH[target.core] == 8:
# Add linking time preprocessor macro DOMAIN_NS
if target.core.endswith("-NS"):
define_string = self.make_ld_define("DOMAIN_NS", "0x1")
self.flags["ld"].append(define_string)
core = target.core[:-3]
else:
# Create Secure library
self.flags["asm"] += ["--cmse"]
self.flags["common"] += ["--cmse"]
secure_file = join(build_dir, "cmse_lib.o")
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]

cpu = {
"Cortex-M7FD": "Cortex-M7.fp.dp",
"Cortex-M7F": "Cortex-M7.fp.sp",
"Cortex-M33": "Cortex-M33.no_dsp",
"Cortex-M33F": "Cortex-M33.fp.no_dsp",
"Cortex-M33FE": "Cortex-M33.fp"}.get(core, core)

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

c_flags_cmd.extend([
"--thumb", "--dlib_config", "DLib_Config_Full.h"
Expand All @@ -68,20 +80,6 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
cxx_flags_cmd = [
"--c++", "--no_rtti", "--no_exceptions"
]
if target.core == "Cortex-M7FD":
asm_flags_cmd += ["--fpu", "VFPv5"]
c_flags_cmd.append("--fpu=VFPv5")
elif target.core == "Cortex-M7F":
asm_flags_cmd += ["--fpu", "VFPv5_sp"]
c_flags_cmd.append("--fpu=VFPv5_sp")
elif target.core == "Cortex-M23" or target.core == "Cortex-M33" or target.core == "Cortex-M33F":
self.flags["asm"] += ["--cmse"]
self.flags["common"] += ["--cmse"]

# Create Secure library
if target.core == "Cortex-M23" or self.target.core == "Cortex-M33" or self.target.core == "Cortex-M33F":
secure_file = join(build_dir, "cmse_lib.o")
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]

IAR_BIN = join(TOOLCHAIN_PATHS['IAR'], "bin")
main_cc = join(IAR_BIN, "iccarm")
Expand Down