@@ -252,7 +252,8 @@ def archive(self, objects, lib_path):
252
252
@hook_tool
253
253
def binary (self , resources , elf , bin ):
254
254
_ , fmt = splitext (bin )
255
- bin_arg = {".bin" : "--bin" , ".hex" : "--i32" }[fmt ]
255
+ # On .hex format, combine multiple .hex files (for multiple load regions) into one
256
+ bin_arg = {".bin" : "--bin" , ".hex" : "--i32combined" }[fmt ]
256
257
cmd = [self .elf2bin , bin_arg , '-o' , bin , elf ]
257
258
cmd = self .hook .get_cmdline_binary (cmd )
258
259
@@ -359,10 +360,15 @@ def __init__(self, target, *args, **kwargs):
359
360
self .flags ['common' ].append ("-mcmse" )
360
361
361
362
# Create Secure library
362
- if target .core == "Cortex-M23" or self .target .core == "Cortex-M33" :
363
+ if ((target .core == "Cortex-M23" or self .target .core == "Cortex-M33" ) and
364
+ kwargs .get ('build_dir' , False )):
363
365
build_dir = kwargs ['build_dir' ]
364
366
secure_file = join (build_dir , "cmse_lib.o" )
365
367
self .flags ["ld" ] += ["--import_cmse_lib_out=%s" % secure_file ]
368
+ # Add linking time preprocessor macro __DOMAIN_NS
369
+ if target .core == "Cortex-M23-NS" or self .target .core == "Cortex-M33-NS" :
370
+ define_string = self .make_ld_define ("__DOMAIN_NS" , 1 )
371
+ self .flags ["ld" ].append (define_string )
366
372
367
373
asm_cpu = {
368
374
"Cortex-M0+" : "Cortex-M0" ,
0 commit comments