Skip to content

Commit

Permalink
Add C3 flashing to binary flasher
Browse files Browse the repository at this point in the history
  • Loading branch information
pkendall64 committed Mar 9, 2024
1 parent bcc4c97 commit 464001b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/binary_flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def upload_esp32_uart(args):
args.port = serials_find.get_serial_port()
try:
dir = os.path.dirname(args.file.name)
esptool.main(['--chip', 'esp32', '--port', args.port, '--baud', str(args.baud), '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x1000', os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000'
esptool.main(['--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', str(args.baud), '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
except:
return ElrsUploadResult.ErrorGeneral
return ElrsUploadResult.Success
Expand All @@ -102,7 +103,8 @@ def upload_esp32_etx(args):
args.port = serials_find.get_serial_port()
try:
dir = os.path.dirname(args.file.name)
esptool.main(['--passthrough', '--chip', 'esp32', '--port', args.port, '--baud', '460800', '--before', 'etx', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x1000', os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000'
esptool.main(['--passthrough', '--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', '460800', '--before', 'etx', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
except:
return ElrsUploadResult.ErrorGeneral
return ElrsUploadResult.Success
Expand All @@ -112,7 +114,8 @@ def upload_esp32_passthru(args):
args.port = serials_find.get_serial_port()
try:
dir = os.path.dirname(args.file.name)
esptool.main(['--passthrough', '--chip', 'esp32', '--port', args.port, '--baud', '230400', '--before', 'passthru', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x1000', os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
start_addr = '0x0000' if args.platform.startswith('esp32-c') else '0x1000'
esptool.main(['--passthrough', '--chip', args.platform.replace('-', ''), '--port', args.port, '--baud', '230400', '--before', 'passthru', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', start_addr, os.path.join(dir, 'bootloader.bin'), '0x8000', os.path.join(dir, 'partitions.bin'), '0xe000', os.path.join(dir, 'boot_app0.bin'), '0x10000', args.file.name])
except:
return ElrsUploadResult.ErrorGeneral
return ElrsUploadResult.Success
Expand Down

0 comments on commit 464001b

Please sign in to comment.