waf: don't generate hex files if intelhex module not installed

This commit is contained in:
Andrew Tridgell 2018-07-02 10:30:46 +10:00 committed by Randy Mackay
parent 7dfde045f1
commit 54a6c013ed
2 changed files with 10 additions and 1 deletions

View File

@ -407,6 +407,15 @@ class chibios(Board):
env.GIT_SUBMODULES += [
'ChibiOS',
]
try:
import intelhex
env.HAVE_INTEL_HEX = True
cfg.msg("Checking for intelhex module:", 'OK')
except Exception:
cfg.msg("Checking for intelhex module:", 'disabled', color='YELLOW')
env.HAVE_INTEL_HEX = False
cfg.load('chibios')
def build(self, bld):

View File

@ -142,7 +142,7 @@ def chibios_firmware(self):
abin_task.set_run_after(generate_apj_task)
bootloader_bin = self.bld.srcnode.make_node("Tools/bootloaders/%s_bl.bin" % self.env.BOARD)
if os.path.exists(bootloader_bin.abspath()):
if os.path.exists(bootloader_bin.abspath()) and self.bld.env.HAVE_INTEL_HEX:
hex_target = self.bld.bldnode.find_or_declare('bin/' + link_output.change_ext('.hex').name)
hex_task = self.create_task('build_intel_hex', src=[bin_target, bootloader_bin], tgt=hex_target)
hex_task.set_run_after(generate_bin_task)