Skip to content

Commit f130a80

Browse files
committed
When linking program define the output name based on the OUTPUT_EXT before processing linking the file. This let's any hooks to use the final output file/name.
Omit the dot before the extension for OUTPUT_EXT (all Nordic and Teensy boards);
1 parent ca4aaa2 commit f130a80

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

workspace_tools/targets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def __init__(self):
415415
self.detect_code = ["0230"]
416416

417417
class TEENSY3_1(Target):
418-
OUTPUT_EXT = '.hex'
418+
OUTPUT_EXT = 'hex'
419419

420420
def __init__(self):
421421
Target.__init__(self)
@@ -742,7 +742,7 @@ class NRF51822(Target):
742742
'offset' : 0x14000
743743
}
744744
]
745-
OUTPUT_EXT = '.hex'
745+
OUTPUT_EXT = 'hex'
746746
MERGE_SOFT_DEVICE = True
747747

748748
def __init__(self):

workspace_tools/toolchains/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ def build_library(self, objects, dir, name):
633633

634634
def link_program(self, r, tmp_path, name):
635635
ext = 'bin'
636+
if hasattr(self.target, 'OUTPUT_EXT'):
637+
ext = self.target.OUTPUT_EXT
636638

637639
if hasattr(self.target, 'OUTPUT_NAMING'):
638640
self.var("binary_naming", self.target.OUTPUT_NAMING)
@@ -641,7 +643,6 @@ def link_program(self, r, tmp_path, name):
641643
ext = ext[0:3]
642644

643645
filename = name+'.'+ext
644-
645646
elf = join(tmp_path, name + '.elf')
646647
bin = join(tmp_path, filename)
647648

@@ -657,9 +658,6 @@ def link_program(self, r, tmp_path, name):
657658
self.var("compile_succeded", True)
658659
self.var("binary", filename)
659660

660-
if hasattr(self.target, 'OUTPUT_EXT'):
661-
bin = bin.replace('.bin', self.target.OUTPUT_EXT)
662-
663661
return bin
664662

665663
def default_cmd(self, command):

0 commit comments

Comments
 (0)