Skip to content

Commit 1a32716

Browse files
authored
Update esptool to v5.1.0 (#319)
1 parent cab6792 commit 1a32716

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

lib/esptool/esptoolLinux/esptool

-1.67 MB
Binary file not shown.

lib/esptool/esptoolMac/esptool

6.73 MB
Binary file not shown.

lib/esptool/esptoolWin/esptool.exe

6.21 MB
Binary file not shown.

nanoFirmwareFlasher.Library/EspTool.cs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public Esp32DeviceInfo GetDeviceDetails(
157157

158158
// execute flash_id command and parse the result
159159
if (!RunEspTool(
160-
"flash_id",
160+
"flash-id",
161161
false,
162162
true,
163163
hardResetAfterCommand && !requireFlashSize,
@@ -186,7 +186,7 @@ public Esp32DeviceInfo GetDeviceDetails(
186186
// try again now without the stub
187187
// Also run this for the hardResetAfterCommand, as there is no way to use the tool for a reset only (esptool issue 910).
188188
if (!RunEspTool(
189-
"flash_id",
189+
"flash-id",
190190
true,
191191
true,
192192
hardResetAfterCommand,
@@ -198,7 +198,7 @@ public Esp32DeviceInfo GetDeviceDetails(
198198
}
199199

200200
Match match = Regex.Match(messages,
201-
$"(Detecting chip type... )(?<type>[ESP32\\-ICOCH6]+)(.*?[\r\n]*)*(Chip is )(?<name>.*)(.*?[\r\n]*)*(Features: )(?<features>.*)(.*?[\r\n]*)*(Crystal is )(?<crystal>.*)(.*?[\r\n]*)*(MAC: )(?<mac>.*)(.*?[\r\n]*)*(Manufacturer: )(?<manufacturer>.*)(.*?[\r\n]*)*(Device: )(?<device>.*)(.*?[\r\n]*)*(Detected flash size: )(?<size>.*)");
201+
$"(Detecting chip type... )(?<type>[ESP32\\-ICOCH6]+)(.*?[\r\n]*)*(Chip type: )(?<name>.*)(.*?[\r\n]*)*(Features: )(?<features>.*)(.*?[\r\n]*)*(Crystal frequency: )(?<crystal>.*)(.*?[\r\n]*)*(MAC: )(?<mac>.*)(.*?[\r\n]*)*(Manufacturer: )(?<manufacturer>.*)(.*?[\r\n]*)*(Device: )(?<device>.*)(.*?[\r\n]*)*(Detected flash size: )(?<size>.*)");
202202

203203
if (!match.Success)
204204
{
@@ -260,14 +260,16 @@ public Esp32DeviceInfo GetDeviceDetails(
260260
psRamSize = int.Parse(psRamMatch.Groups["size"].Value);
261261
psramIsAvailable = PSRamAvailability.Yes;
262262
}
263-
else
264-
{
265-
psramIsAvailable = PSRamAvailability.No;
266-
}
267263
}
268-
else
264+
else if (_chipType == "esp32s2")
265+
{
266+
// these devices usually require boot into bootloader which prevents running the app to get psram details.
267+
psramIsAvailable = PSRamAvailability.Undetermined;
268+
}
269+
270+
if (psramIsAvailable == PSRamAvailability.Undetermined)
269271
{
270-
//try to find out if PSRAM is present
272+
// try to find out if PSRAM is present
271273
psramIsAvailable = FindPSRamAvailable(out psRamSize, forcePsRamCheck);
272274
}
273275

@@ -445,9 +447,9 @@ internal void BackupFlash(string backupFilename,
445447
int flashSize,
446448
bool hardResetAfterCommand = false)
447449
{
448-
// execute read_flash command and parse the result; progress message can be found be searching for backspaces (ASCII code 8)
450+
// execute read-flash command and parse the result; progress message can be found be searching for backspaces (ASCII code 8)
449451
if (!RunEspTool(
450-
$"read_flash 0 0x{flashSize:X} \"{backupFilename}\"",
452+
$"read-flash 0 0x{flashSize:X} \"{backupFilename}\"",
451453
true,
452454
false,
453455
hardResetAfterCommand,
@@ -481,9 +483,9 @@ internal ExitCodes BackupConfigPartition(
481483
int address,
482484
int size)
483485
{
484-
// execute dump_mem command and parse the result; progress message can be found be searching for backspaces (ASCII code 8)
486+
// execute dump-mem command and parse the result; progress message can be found be searching for backspaces (ASCII code 8)
485487
if (!RunEspTool(
486-
$"read_flash 0x{address:X} 0x{size:X} \"{backupFilename}\"",
488+
$"read-flash 0x{address:X} 0x{size:X} \"{backupFilename}\"",
487489
false,
488490
true,
489491
false,
@@ -515,7 +517,7 @@ internal ExitCodes EraseFlash()
515517
{
516518
// execute erase_flash command and parse the result
517519
if (!RunEspTool(
518-
"erase_flash",
520+
"erase-flash",
519521
false,
520522
true,
521523
false,
@@ -525,7 +527,7 @@ internal ExitCodes EraseFlash()
525527
throw new EraseEsp32FlashException(messages);
526528
}
527529

528-
Match match = Regex.Match(messages, "(?<message>Chip erase completed successfully.*)(.*?\n)*");
530+
Match match = Regex.Match(messages, "(?<message>Flash memory erased successfully.*)(.*?\n)*");
529531
if (!match.Success)
530532
{
531533
throw new EraseEsp32FlashException(messages);
@@ -545,7 +547,7 @@ internal ExitCodes EraseFlashSegment(uint startAddress, uint length)
545547

546548
// execute erase_flash command and parse the result
547549
if (!RunEspTool(
548-
$"erase_region 0x{startAddress:X} 0x{length:X}",
550+
$"erase-region 0x{startAddress:X} 0x{length:X}",
549551
false,
550552
false,
551553
false,
@@ -555,7 +557,7 @@ internal ExitCodes EraseFlashSegment(uint startAddress, uint length)
555557
throw new EraseEsp32FlashException(messages);
556558
}
557559

558-
Match match = Regex.Match(messages, "(?<message>Erase completed successfully.*)(.*?\n)*");
560+
Match match = Regex.Match(messages, "(?<message>Flash memory erased successfully.*)(.*?\n)*");
559561
if (!match.Success)
560562
{
561563
throw new EraseEsp32FlashException(messages);
@@ -595,7 +597,7 @@ internal ExitCodes WriteFlash(
595597
counter++;
596598
}
597599

598-
// if flash size was detected already use it for the --flash_size parameter; otherwise use the default "detect"
600+
// if flash size was detected already use it for the --flash-size parameter; otherwise use the default "detect"
599601
string flashSize = _flashSize switch
600602
{
601603
>= 0x100000 => $"{_flashSize / 0x100000}MB",
@@ -605,7 +607,7 @@ internal ExitCodes WriteFlash(
605607

606608
// execute write_flash command and parse the result; progress message can be found be searching for linefeed
607609
if (!RunEspTool(
608-
$"write_flash --flash_size {flashSize} {partsArguments.ToString().Trim()}",
610+
$"write-flash --flash-size {flashSize} {partsArguments.ToString().Trim()}",
609611
false,
610612
useStandardBaudrate,
611613
true,
@@ -625,7 +627,7 @@ internal ExitCodes WriteFlash(
625627
/// Run the esptool one time
626628
/// </summary>
627629
/// <param name="commandWithArguments">the esptool command (e.g. write_flash) incl. all arguments (if needed)</param>
628-
/// <param name="noStub">if true --no-stub will be added; the chip_id, read_mac and flash_id commands can be quicker executes without uploading the stub program to the chip</param>
630+
/// <param name="noStub">if true --no-stub will be added; the chip_id, read_mac and flash-id commands can be quicker executes without uploading the stub program to the chip</param>
629631
/// <param name="useStandardBaudRate">If <see langword="true"/> the tool will use the standard baud rate to connect to the chip.</param>
630632
/// <param name="hardResetAfterCommand">if true the chip will execute a hard reset via DTR signal</param>
631633
/// <param name="progressTestChar">If not null: After each of this char a progress message will be printed out</param>
@@ -648,7 +650,7 @@ private bool RunEspTool(
648650
string noStubParameter = null;
649651
string baudRateParameter = null;
650652
string beforeParameter = null;
651-
string afterParameter = hardResetAfterCommand ? "hard_reset" : "no_reset_stub";
653+
string afterParameter = hardResetAfterCommand ? "hard-reset" : "no-reset";
652654

653655
if (noStub)
654656
{

0 commit comments

Comments
 (0)