Skip to content

Commit a81a605

Browse files
author
root
committed
Changed binary naming flag to OUTPUT_NAMING; Fixed binary_hook() to use 3 params
1 parent 9272cde commit a81a605

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

workspace_tools/targets.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def init_hooks(self, hook, toolchain_name):
193193
hook.hook_add_binary("post", self.binary_hook)
194194

195195
@staticmethod
196-
def binary_hook(t_self, resources, elf, binf):
196+
def binary_hook(t_self, elf, binf):
197197
if not os.path.isdir(binf):
198198
# Regular binary file, nothing to do
199199
return
@@ -266,6 +266,8 @@ def __init__(self):
266266

267267

268268
class NUCLEO_F103RB(Target):
269+
OUTPUT_NAMING = "8.3"
270+
269271
def __init__(self):
270272
Target.__init__(self)
271273

@@ -274,11 +276,11 @@ def __init__(self):
274276
self.extra_labels = ['STM', 'STM32F1', 'STM32F103RB']
275277

276278
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
277-
278-
self.binary_naming = "8.3"
279279

280280

281281
class NUCLEO_L152RE(Target):
282+
OUTPUT_NAMING = "8.3"
283+
282284
def __init__(self):
283285
Target.__init__(self)
284286

@@ -287,11 +289,11 @@ def __init__(self):
287289
self.extra_labels = ['STM', 'STM32L1', 'STM32L152RE']
288290

289291
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
290-
291-
self.binary_naming = "8.3"
292292

293293

294294
class NUCLEO_F401RE(Target):
295+
OUTPUT_NAMING = "8.3"
296+
295297
def __init__(self):
296298
Target.__init__(self)
297299

@@ -300,11 +302,11 @@ def __init__(self):
300302
self.extra_labels = ['STM', 'STM32F4', 'STM32F401RE']
301303

302304
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
303-
304-
self.binary_naming = "8.3"
305305

306306

307307
class NUCLEO_F030R8(Target):
308+
OUTPUT_NAMING = "8.3"
309+
308310
def __init__(self):
309311
Target.__init__(self)
310312

@@ -313,8 +315,6 @@ def __init__(self):
313315
self.extra_labels = ['STM', 'STM32F0', 'STM32F030R8']
314316

315317
self.supported_toolchains = ["ARM", "uARM", "GCC_ARM"]
316-
317-
self.binary_naming = "8.3"
318318

319319

320320
class LPC1347(Target):
@@ -393,8 +393,8 @@ def init_hooks(self, hook, toolchain_name):
393393
hook.hook_add_binary("post", self.binary_hook)
394394

395395
@staticmethod
396-
def binary_hook(t_self, resources, elf, binf):
397-
for hexf in resources.hex_files:
396+
def binary_hook(t_self, elf, binf):
397+
for hexf in t_self.resources.hex_files:
398398
if hexf.find(NRF51822.EXPECTED_SOFTDEVICE) != -1:
399399
break
400400
else:

workspace_tools/toolchains/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ def build_library(self, objects, dir, name):
445445
def link_program(self, r, tmp_path, name):
446446
ext = 'bin'
447447

448-
if hasattr(self.target, 'binary_naming'):
449-
if self.target.binary_naming == "8.3":
448+
if hasattr(self.target, 'OUTPUT_NAMING'):
449+
self.var("binary_naming", self.target.OUTPUT_NAMING)
450+
if self.target.OUTPUT_NAMING == "8.3":
450451
name = name[0:8]
451452
ext = ext[0:3]
452453

@@ -470,9 +471,7 @@ def link_program(self, r, tmp_path, name):
470471

471472
self.var("compile_succeded", True)
472473
self.var("binary", filename)
473-
if hasattr(self.target, 'binary_naming'):
474-
self.var("binary_naming", self.target.binary_naming)
475-
474+
476475
if hasattr(self.target, 'OUTPUT_EXT'):
477476
bin = bin.replace('.bin', self.target.OUTPUT_EXT)
478477

0 commit comments

Comments
 (0)