@ -17,12 +17,11 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
@@ -17,12 +17,11 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
''' Runner front-end for bossac. '''
def __init__ ( self , cfg , bossac = ' bossac ' , port = DEFAULT_BOSSAC_PORT ,
offset = None , flash_address = None ) :
offset = None ) :
super ( ) . __init__ ( cfg )
self . bossac = bossac
self . port = port
self . offset = offset
self . flash_address = flash_address
@classmethod
def name ( cls ) :
@ -44,15 +43,22 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
@@ -44,15 +43,22 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
help = ' serial port to use, default is /dev/ttyACM0 ' )
@classmethod
def do_create ( cls , cfg , args ) :
# BOSSA means there's a bootloader so always fetch the flash address
args . dt_flash = True
def get_flash_offset ( cls , cfg ) :
# Pull the bootloader size from the config
build_conf = BuildConfiguration ( cfg . build_dir )
flash_address = cls . get_flash_address ( args , build_conf , None )
if build_conf [ ' CONFIG_HAS_FLASH_LOAD_OFFSET ' ] :
return build_conf [ ' CONFIG_FLASH_LOAD_OFFSET ' ]
return None
@classmethod
def do_create ( cls , cfg , args ) :
offset = args . offset
if offset is None :
offset = cls . get_flash_offset ( cfg )
return BossacBinaryRunner ( cfg , bossac = args . bossac ,
port = args . bossac_port , offset = args . offset ,
flash_address = flash_address )
port = args . bossac_port , offset = offset )
def read_help ( self ) :
""" Run bossac --help and return the output as a list of lines """
@ -75,8 +81,6 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
@@ -75,8 +81,6 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
if supports_offset :
if self . offset is not None :
return self . offset
if self . flash_address is not None :
return self . flash_address
self . logger . warning (
' This version of BOSSA supports the --offset flag but ' +
@ -113,7 +117,7 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
@@ -113,7 +117,7 @@ class BossacBinaryRunner(ZephyrBinaryRunner):
offset = self . get_offset ( self . supports ( ' --offset ' ) )
if offset is not None :
if offset :
cmd_flash + = [ ' -o ' , ' %s ' % offset ]
self . check_call ( cmd_flash )