@@ -381,70 +381,67 @@ def __init__(self, target, *args, **kwargs):
381
381
if not set (("ARM" , "ARMC6" )).intersection (set (target .supported_toolchains )):
382
382
raise NotSupportedException ("ARM/ARMC6 compiler support is required for ARMC6 build" )
383
383
384
- if target .core .lower ().endswith ("fd" ):
385
- self .flags ['common' ].append ("-mcpu=%s" % target .core .lower ()[:- 2 ])
386
- self .flags ['ld' ].append ("--cpu=%s" % target .core .lower ()[:- 2 ])
387
- self .SHEBANG += " -mcpu=%s" % target .core .lower ()[:- 2 ]
388
- elif target .core .lower ().endswith ("fd-ns" ):
389
- self .flags ['common' ].append ("-mcpu=%s" % target .core .lower ()[:- 5 ])
390
- self .flags ['ld' ].append ("--cpu=%s" % target .core .lower ()[:- 5 ])
391
- self .SHEBANG += " -mcpu=%s" % target .core .lower ()[:- 5 ]
392
- elif target .core .lower ().endswith ("f" ):
393
- self .flags ['common' ].append ("-mcpu=%s" % target .core .lower ()[:- 1 ])
394
- self .flags ['ld' ].append ("--cpu=%s" % target .core .lower ()[:- 1 ])
395
- self .SHEBANG += " -mcpu=%s" % target .core .lower ()[:- 1 ]
396
- elif target .core .startswith ("Cortex-M33" ):
397
- self .flags ['common' ].append ("-mcpu=cortex-m33+nodsp" )
398
- self .flags ['common' ].append ("-mfpu=none" )
399
- self .flags ['ld' ].append ("--cpu=Cortex-M33.no_dsp.no_fp" )
400
- elif not target .core .startswith ("Cortex-M23" ):
401
- self .flags ['common' ].append ("-mcpu=%s" % target .core .lower ())
402
- self .flags ['ld' ].append ("--cpu=%s" % target .core .lower ())
403
- self .SHEBANG += " -mcpu=%s" % target .core .lower ()
404
-
405
- if target .core == "Cortex-M4F" :
406
- self .flags ['common' ].append ("-mfpu=fpv4-sp-d16" )
407
- self .flags ['common' ].append ("-mfloat-abi=hard" )
408
- elif target .core == "Cortex-M7F" :
409
- self .flags ['common' ].append ("-mfpu=fpv5-sp-d16" )
410
- self .flags ['common' ].append ("-mfloat-abi=hard" )
411
- elif target .core == "Cortex-M7FD" :
412
- self .flags ['common' ].append ("-mfpu=fpv5-d16" )
413
- self .flags ['common' ].append ("-mfloat-abi=hard" )
414
- elif target .core .startswith ("Cortex-M23" ):
415
- self .flags ['common' ].append ("-march=armv8-m.base" )
416
- elif target .core .startswith ("Cortex-M33F" ):
417
- self .flags ['common' ].append ("-mfpu=fpv5-sp-d16" )
418
- self .flags ['common' ].append ("-mfloat-abi=hard" )
419
-
384
+ core = target .core
420
385
if CORE_ARCH [target .core ] == 8 :
386
+ if (not target .core .endswith ("-NS" )) and kwargs .get ('build_dir' , False ):
387
+ # Create Secure library
388
+ build_dir = kwargs ['build_dir' ]
389
+ secure_file = join (build_dir , "cmse_lib.o" )
390
+ self .flags ["ld" ] += ["--import_cmse_lib_out=%s" % secure_file ]
391
+
421
392
# Add linking time preprocessor macro DOMAIN_NS
422
393
if target .core .endswith ("-NS" ):
423
394
define_string = self .make_ld_define ("DOMAIN_NS" , "0x1" )
424
395
self .flags ["ld" ].append (define_string )
396
+ core = target .core [:- 3 ]
425
397
else :
426
398
# Add secure build flag
427
399
self .flags ['cxx' ].append ("-mcmse" )
428
400
self .flags ['c' ].append ("-mcmse" )
429
401
430
- if (not target .core .endswith ("-NS" )) and kwargs .get ('build_dir' , False ):
431
- # Create Secure library
432
- build_dir = kwargs ['build_dir' ]
433
- secure_file = join (build_dir , "cmse_lib.o" )
434
- self .flags ["ld" ] += ["--import_cmse_lib_out=%s" % secure_file ]
402
+ cpu = {
403
+ "Cortex-M0+" : "cortex-m0plus" ,
404
+ "Cortex-M4F" : "cortex-m4" ,
405
+ "Cortex-M7F" : "cortex-m7" ,
406
+ "Cortex-M7FD" : "cortex-m7" ,
407
+ "Cortex-M33" : "cortex-m33+no_dsp+no_fp" ,
408
+ "Cortex-M33F" : "cortex-m33+no_dsp" ,
409
+ "Cortex-M33FD" : "cortex-m33" }.get (core , core )
410
+
411
+ cpu = cpu .lower ()
412
+ self .flags ['common' ].append ("-mcpu=%s" % cpu )
413
+ self .SHEBANG += " -mcpu=%s" % cpu
414
+
415
+ # FPU handling
416
+ if core == "Cortex-M4F" :
417
+ self .flags ['common' ].append ("-mfpu=fpv4-sp-d16" )
418
+ self .flags ['common' ].append ("-mfloat-abi=hard" )
419
+ self .flags ['ld' ].append ("--cpu=cortex-m4" )
420
+ elif core == "Cortex-M7F" :
421
+ self .flags ['common' ].append ("-mfpu=fpv5-sp-d16" )
422
+ self .flags ['common' ].append ("-mfloat-abi=hard" )
423
+ self .flags ['ld' ].append ("--cpu=cortex-m7.fp.sp" )
424
+ elif core == "Cortex-M7FD" :
425
+ self .flags ['common' ].append ("-mfpu=fpv5-d16" )
426
+ self .flags ['common' ].append ("-mfloat-abi=hard" )
427
+ self .flags ['ld' ].append ("--cpu=cortex-m7" )
428
+ elif core == "Cortex-M33F" :
429
+ self .flags ['common' ].append ("-mfpu=fpv5-sp-d16" )
430
+ self .flags ['common' ].append ("-mfloat-abi=hard" )
431
+ self .flags ['ld' ].append ("--cpu=cortex-m33.no_dsp" )
432
+ elif core == "Cortex-M33" :
433
+ self .flags ['ld' ].append ("--cpu=cortex-m33.no_dsp.no_fp" )
434
+ else :
435
+ self .flags ['ld' ].append ("--cpu=%s" % cpu )
435
436
436
437
asm_cpu = {
437
438
"Cortex-M0+" : "Cortex-M0" ,
438
439
"Cortex-M4F" : "Cortex-M4.fp" ,
439
440
"Cortex-M7F" : "Cortex-M7.fp.sp" ,
440
441
"Cortex-M7FD" : "Cortex-M7.fp.dp" ,
441
- "Cortex-M23-NS" : "Cortex-M23" ,
442
442
"Cortex-M33" : "Cortex-M33.no_dsp.no_fp" ,
443
- "Cortex-M33-NS" : "Cortex-M33.no_dsp.no_fp" ,
444
443
"Cortex-M33F" : "Cortex-M33.no_dsp" ,
445
- "Cortex-M33F-NS" : "Cortex-M33.no_dsp" ,
446
- "Cortex-M33FD" : "Cortex-M33" ,
447
- "Cortex-M33FD-NS" : "Cortex-M33" }.get (target .core , target .core )
444
+ "Cortex-M33FD" : "Cortex-M33" }.get (core , core )
448
445
449
446
self .flags ['asm' ].append ("--cpu=%s" % asm_cpu )
450
447
0 commit comments