From 7760796d6a12d5fa8177c260417be1f09c1b08c3 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Wed, 13 Oct 2021 21:55:05 +0200 Subject: [PATCH 1/6] support for ESP32-S2 ESP32-S3 32MB..1024MB ESP32-S2 and ESP32-S3 supports up to 1 GB of external flash and RAM add support for - 32MB - 64MB - 128MB ( example NOR spiFLASH 1G-BIT W25Q01JVZEIQ ) - 256MB - 512MB - 1024MB change small typo in helper --flash-size --- esptool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esptool.py b/esptool.py index ffcad0381..c050f5b5b 100755 --- a/esptool.py +++ b/esptool.py @@ -135,7 +135,7 @@ def get_default_connected_device(serial_list, port, connect_attempts, initial_ba DETECTED_FLASH_SIZES = {0x12: '256KB', 0x13: '512KB', 0x14: '1MB', 0x15: '2MB', 0x16: '4MB', 0x17: '8MB', - 0x18: '16MB', 0x19: '32MB', 0x1a: '64MB'} + 0x18: '16MB', 0x19: '32MB', 0x1a: '64MB', 0x21: '128MB'} def check_supported_function(func, check_func): @@ -3693,7 +3693,7 @@ def write_flash(esp, args): argfile.seek(0, os.SEEK_END) if address + argfile.tell() > flash_end: raise FatalError(("File %s (length %d) at offset %d will not fit in %d bytes of flash. " - "Use --flash-size argument, or change flashing address.") + "Use --flash_size argument, or change flashing address.") % (argfile.name, argfile.tell(), address, flash_end)) argfile.seek(0) @@ -4254,7 +4254,7 @@ def add_spi_flash_subparsers(parent, allow_keep, auto_detect): parent.add_argument('--flash_mode', '-fm', help='SPI Flash mode', choices=extra_keep_args + ['qio', 'qout', 'dio', 'dout'], default=os.environ.get('ESPTOOL_FM', 'keep' if allow_keep else 'qio')) - parent.add_argument('--flash_size', '-fs', help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16M)' + parent.add_argument('--flash_size', '-fs', help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, 256MB, 512MB, 1024MB)' ' plus ESP8266-only (256KB, 512KB, 2MB-c1, 4MB-c1)' + extra_fs_message, action=FlashSizeAction, auto_detect=auto_detect, default=os.environ.get('ESPTOOL_FS', 'keep' if allow_keep else '1MB')) From 6e2b13b71e2417e87721e1b05f04f78cde55b3ee Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Fri, 15 Oct 2021 12:30:25 +0200 Subject: [PATCH 2/6] Update esptool.py - updating the FLASH_SIZES dictionary in ESP32ROM class was missing ( 32MB, 64MB, 128MB ) - remove > 128MB in the helper since we have just in time only the possibles ( Market ) to test 128MB Version --- esptool.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esptool.py b/esptool.py index c050f5b5b..30674f9bc 100755 --- a/esptool.py +++ b/esptool.py @@ -1458,7 +1458,10 @@ class ESP32ROM(ESPLoader): '2MB': 0x10, '4MB': 0x20, '8MB': 0x30, - '16MB': 0x40 + '16MB': 0x40, + '32MB': 0x50, + '64MB': 0x60, + '128MB': 0x70 } BOOTLOADER_FLASH_OFFSET = 0x1000 @@ -4254,7 +4257,7 @@ def add_spi_flash_subparsers(parent, allow_keep, auto_detect): parent.add_argument('--flash_mode', '-fm', help='SPI Flash mode', choices=extra_keep_args + ['qio', 'qout', 'dio', 'dout'], default=os.environ.get('ESPTOOL_FM', 'keep' if allow_keep else 'qio')) - parent.add_argument('--flash_size', '-fs', help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, 256MB, 512MB, 1024MB)' + parent.add_argument('--flash_size', '-fs', help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, 128MB)' ' plus ESP8266-only (256KB, 512KB, 2MB-c1, 4MB-c1)' + extra_fs_message, action=FlashSizeAction, auto_detect=auto_detect, default=os.environ.get('ESPTOOL_FS', 'keep' if allow_keep else '1MB')) From 0c313f2f8f0878c2495d99649d92b10a0fb15eea Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Fri, 15 Oct 2021 12:42:57 +0200 Subject: [PATCH 3/6] Update esptool.py - updating the FLASH_SIZES dictionary in ESP32ROM class was missing ( 32MB, 64MB, 128MB ) - remove > 128MB in the helper since we have just in time only the possibles ( Market ) to test 128MB Version --- esptool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esptool.py b/esptool.py index 30674f9bc..d002a3369 100755 --- a/esptool.py +++ b/esptool.py @@ -1461,7 +1461,7 @@ class ESP32ROM(ESPLoader): '16MB': 0x40, '32MB': 0x50, '64MB': 0x60, - '128MB': 0x70 + '128MB': 0x70 } BOOTLOADER_FLASH_OFFSET = 0x1000 From bc44538df6766bffc375cf3b98c8eead908a0a9d Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Fri, 15 Oct 2021 13:24:25 +0200 Subject: [PATCH 4/6] Update esptool.py - updated Custom flash size parser class (8MB..128MB) to support backwards compatibility with megabit size arguments --- esptool.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esptool.py b/esptool.py index d002a3369..5e5e3e217 100755 --- a/esptool.py +++ b/esptool.py @@ -4588,6 +4588,11 @@ def __call__(self, parser, namespace, values, option_string=None): '8m': '1MB', '16m': '2MB', '32m': '4MB', + '64m': '8MB', + '128m': '16MB', + '256m': '32MB', + '512m': '64MB', + '1024m': '128MB', '16m-c1': '2MB-c1', '32m-c1': '4MB-c1', }[values[0]] From 8beb19ac9026dcc37a22499ad784bb9b5a685803 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Fri, 15 Oct 2021 14:34:30 +0200 Subject: [PATCH 5/6] Update esptool.py - remove whitespace and multiple spaces --- esptool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esptool.py b/esptool.py index 5e5e3e217..c22ec4291 100755 --- a/esptool.py +++ b/esptool.py @@ -4591,8 +4591,8 @@ def __call__(self, parser, namespace, values, option_string=None): '64m': '8MB', '128m': '16MB', '256m': '32MB', - '512m': '64MB', - '1024m': '128MB', + '512m': '64MB', + '1024m': '128MB', '16m-c1': '2MB-c1', '32m-c1': '4MB-c1', }[values[0]] From 0fa0cfa535f9906dade3a28b252f8023a72d0fa1 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Fri, 15 Oct 2021 14:38:06 +0200 Subject: [PATCH 6/6] Update esptool.py - remove whitespace and multiple spaces --- esptool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esptool.py b/esptool.py index c22ec4291..36f504c16 100755 --- a/esptool.py +++ b/esptool.py @@ -1461,7 +1461,7 @@ class ESP32ROM(ESPLoader): '16MB': 0x40, '32MB': 0x50, '64MB': 0x60, - '128MB': 0x70 + '128MB': 0x70 } BOOTLOADER_FLASH_OFFSET = 0x1000