mirror of https://github.com/ARMmbed/mbed-os.git
Upgrade OUTPUT_EXT and use it to pick binary type
targets.json contained a key for some targets, `OUTPUT_EXT`, which I moved to `Target`, the root of all targets. Following on that, the tools now use this extension provided by `OUTPUT_EXT` to determine the file type of the output executable.pull/3994/head
parent
91ecc52da0
commit
09afe23762
|
@ -1003,7 +1003,7 @@ class mbedToolchain:
|
||||||
|
|
||||||
filename = name+'.'+ext
|
filename = name+'.'+ext
|
||||||
elf = join(tmp_path, name + '.elf')
|
elf = join(tmp_path, name + '.elf')
|
||||||
bin = join(tmp_path, filename)
|
bin = None if ext is 'elf' else join(tmp_path, filename)
|
||||||
map = join(tmp_path, name + '.map')
|
map = join(tmp_path, name + '.map')
|
||||||
|
|
||||||
r.objects = sorted(set(r.objects))
|
r.objects = sorted(set(r.objects))
|
||||||
|
@ -1012,7 +1012,7 @@ class mbedToolchain:
|
||||||
self.progress("link", name)
|
self.progress("link", name)
|
||||||
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
|
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
|
||||||
|
|
||||||
if self.need_update(bin, [elf]):
|
if bin and self.need_update(bin, [elf]):
|
||||||
needed_update = True
|
needed_update = True
|
||||||
self.progress("elf2bin", name)
|
self.progress("elf2bin", name)
|
||||||
self.binary(r, elf, bin)
|
self.binary(r, elf, bin)
|
||||||
|
|
|
@ -216,8 +216,10 @@ class ARM(mbedToolchain):
|
||||||
|
|
||||||
@hook_tool
|
@hook_tool
|
||||||
def binary(self, resources, elf, bin):
|
def binary(self, resources, elf, bin):
|
||||||
|
_, fmt = splitext(bin)
|
||||||
|
bin_arg = {".bin": "--bin", ".hex": "--i32"}[fmt]
|
||||||
# Build binary command
|
# Build binary command
|
||||||
cmd = [self.elf2bin, '--bin', '-o', bin, elf]
|
cmd = [self.elf2bin, bin_arg, '-o', bin, elf]
|
||||||
|
|
||||||
# Call cmdline hook
|
# Call cmdline hook
|
||||||
cmd = self.hook.get_cmdline_binary(cmd)
|
cmd = self.hook.get_cmdline_binary(cmd)
|
||||||
|
|
|
@ -261,7 +261,9 @@ class GCC(mbedToolchain):
|
||||||
@hook_tool
|
@hook_tool
|
||||||
def binary(self, resources, elf, bin):
|
def binary(self, resources, elf, bin):
|
||||||
# Build binary command
|
# Build binary command
|
||||||
cmd = [self.elf2bin, "-O", "binary", elf, bin]
|
_, fmt = splitext(bin)
|
||||||
|
bin_arg = {'.bin': 'binary', '.hex': 'ihex'}[fmt]
|
||||||
|
cmd = [self.elf2bin, "-O", bin_arg, elf, bin]
|
||||||
|
|
||||||
# Call cmdline hook
|
# Call cmdline hook
|
||||||
cmd = self.hook.get_cmdline_binary(cmd)
|
cmd = self.hook.get_cmdline_binary(cmd)
|
||||||
|
|
|
@ -224,8 +224,10 @@ class IAR(mbedToolchain):
|
||||||
|
|
||||||
@hook_tool
|
@hook_tool
|
||||||
def binary(self, resources, elf, bin):
|
def binary(self, resources, elf, bin):
|
||||||
|
_, fmt = splitext(bin)
|
||||||
|
bin_arg = {".bin": "--bin", ".hex": "--ihex"}[fmt]
|
||||||
# Build binary command
|
# Build binary command
|
||||||
cmd = [self.elf2bin, "--bin", elf, bin]
|
cmd = [self.elf2bin, bin_arg, elf, bin]
|
||||||
|
|
||||||
# Call cmdline hook
|
# Call cmdline hook
|
||||||
cmd = self.hook.get_cmdline_binary(cmd)
|
cmd = self.hook.get_cmdline_binary(cmd)
|
||||||
|
|
Loading…
Reference in New Issue