19
19
from os .path import join , splitext , exists
20
20
from distutils .version import LooseVersion
21
21
22
+ from tools .targets import CORE_ARCH
22
23
from tools .toolchains import mbedToolchain , TOOLCHAIN_PATHS
23
24
from tools .hooks import hook_tool
24
25
from tools .utils import run_cmd , NotSupportedException
@@ -43,23 +44,34 @@ def check_executable():
43
44
44
45
def __init__ (self , target , notify = None , macros = None , build_profile = None ,
45
46
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 )
56
68
57
69
# flags_cmd are used only by our scripts, the project files have them already defined,
58
70
# using this flags results in the errors (duplication)
59
71
# 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 ]
61
73
# custom c flags
62
- c_flags_cmd = ["--cpu" , cpuchoice ]
74
+ c_flags_cmd = ["--cpu" , cpu ]
63
75
64
76
c_flags_cmd .extend ([
65
77
"--thumb" , "--dlib_config" , "DLib_Config_Full.h"
@@ -68,20 +80,6 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
68
80
cxx_flags_cmd = [
69
81
"--c++" , "--no_rtti" , "--no_exceptions"
70
82
]
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 ]
85
83
86
84
IAR_BIN = join (TOOLCHAIN_PATHS ['IAR' ], "bin" )
87
85
main_cc = join (IAR_BIN , "iccarm" )
0 commit comments