Apply Zephyr commit 1952c56e7
NOTE: This applies Zephyr commit 1952c56e7 ("esp32: add abitily to flash bootloader"), which was merged without going through this tree first. 'make flash' also flashes the bootloader Signed-off-by: Gautier Seidel <gautier.seidel@tado.com> Signed-off-by: Marti Bolivar <marti@foundries.io>
This commit is contained in:
parent
d0f184412a
commit
1f35506a5e
|
@ -14,7 +14,8 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
|
|||
'''Runner front-end for espidf.'''
|
||||
|
||||
def __init__(self, cfg, device, baud=921600, flash_size='detect',
|
||||
flash_freq='40m', flash_mode='dio', espidf='espidf'):
|
||||
flash_freq='40m', flash_mode='dio', espidf='espidf',
|
||||
bootloader_bin=None, partition_table_bin=None):
|
||||
super(Esp32BinaryRunner, self).__init__(cfg)
|
||||
self.elf = cfg.kernel_elf
|
||||
self.device = device
|
||||
|
@ -23,6 +24,8 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
|
|||
self.flash_freq = flash_freq
|
||||
self.flash_mode = flash_mode
|
||||
self.espidf = espidf
|
||||
self.bootloader_bin = bootloader_bin
|
||||
self.partition_table_bin = partition_table_bin
|
||||
|
||||
@classmethod
|
||||
def name(cls):
|
||||
|
@ -53,6 +56,10 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
|
|||
'--esp-tool',
|
||||
help='''if given, complete path to espidf. default is to search for
|
||||
it in [ESP_IDF_PATH]/components/esptool_py/esptool/esptool.py''')
|
||||
parser.add_argument('--esp-flash-bootloader',
|
||||
help='Bootloader image to flash')
|
||||
parser.add_argument('--esp-flash-partition_table',
|
||||
help='Partition table to flash')
|
||||
|
||||
@classmethod
|
||||
def create(cls, cfg, args):
|
||||
|
@ -65,7 +72,9 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
|
|||
return Esp32BinaryRunner(
|
||||
cfg, args.esp_device, baud=args.esp_baud_rate,
|
||||
flash_size=args.esp_flash_size, flash_freq=args.esp_flash_freq,
|
||||
flash_mode=args.esp_flash_mode, espidf=espidf)
|
||||
flash_mode=args.esp_flash_mode, espidf=espidf,
|
||||
bootloader_bin=args.esp_flash_bootloader,
|
||||
partition_table_bin=args.esp_flash_partition_table)
|
||||
|
||||
def do_run(self, command, **kwargs):
|
||||
bin_name = path.splitext(self.elf)[0] + path.extsep + 'bin'
|
||||
|
@ -75,8 +84,14 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
|
|||
'--after', 'hard_reset', 'write_flash', '-u',
|
||||
'--flash_mode', self.flash_mode,
|
||||
'--flash_freq', self.flash_freq,
|
||||
'--flash_size', self.flash_size,
|
||||
'0x1000', bin_name]
|
||||
'--flash_size', self.flash_size]
|
||||
|
||||
if self.bootloader_bin:
|
||||
cmd_flash.extend(['0x1000', self.bootloader_bin])
|
||||
cmd_flash.extend(['0x8000', self.partition_table_bin])
|
||||
cmd_flash.extend(['0x10000', bin_name])
|
||||
else:
|
||||
cmd_flash.extend(['0x1000', bin_name])
|
||||
|
||||
log.inf("Converting ELF to BIN")
|
||||
self.check_call(cmd_convert)
|
||||
|
|
Loading…
Reference in New Issue