Skip to content

Commit 1f259a4

Browse files
author
Cruz Monrreal
authored
Merge pull request #6644 from OpenNuvoton/nuvoton_fix_armc6_armv8m
Fix build tool with ARMC6/ARMv8M
2 parents 380973a + da69f01 commit 1f259a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/toolchains/arm.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ def archive(self, objects, lib_path):
252252
@hook_tool
253253
def binary(self, resources, elf, bin):
254254
_, 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]
256257
cmd = [self.elf2bin, bin_arg, '-o', bin, elf]
257258
cmd = self.hook.get_cmdline_binary(cmd)
258259

@@ -359,10 +360,15 @@ def __init__(self, target, *args, **kwargs):
359360
self.flags['common'].append("-mcmse")
360361

361362
# 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)):
363365
build_dir = kwargs['build_dir']
364366
secure_file = join(build_dir, "cmse_lib.o")
365367
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)
366372

367373
asm_cpu = {
368374
"Cortex-M0+": "Cortex-M0",

0 commit comments

Comments
 (0)