Skip to content

Commit 6bd4d0d

Browse files
authored
Add support for ESP32_P4 (#328)
1 parent fdc1e5b commit 6bd4d0d

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

nanoFirmwareFlasher.Library/Esp32Operations.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
139139
esp32Device.ChipType != "ESP32-C6" &&
140140
esp32Device.ChipType != "ESP32-H2" &&
141141
esp32Device.ChipType != "ESP32-S2" &&
142-
esp32Device.ChipType != "ESP32-S3")
142+
esp32Device.ChipType != "ESP32-S3" &&
143+
esp32Device.ChipType != "ESP32-P4")
143144
{
144145
// connected to a device not supported
145146
OutputWriter.ForegroundColor = ConsoleColor.Yellow;
@@ -370,6 +371,33 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
370371
// compose target name
371372
targetName = $"ESP32_S3{revisionSuffix}";
372373
}
374+
else if (esp32Device.ChipType == "ESP32-P4")
375+
{
376+
// version schema for ESP32-P4
377+
378+
string revisionSuffix;
379+
380+
// so far we are only offering a single ESP32_P4 build
381+
if (esp32Device.ChipName.Contains("revision v0.1") || esp32Device.ChipName.Contains("revision v1.0"))
382+
{
383+
revisionSuffix = "";
384+
}
385+
else
386+
{
387+
OutputWriter.ForegroundColor = ConsoleColor.Red;
388+
389+
OutputWriter.WriteLine("");
390+
OutputWriter.WriteLine($"Unsupported ESP32_P4 revision.");
391+
OutputWriter.WriteLine("");
392+
393+
OutputWriter.ForegroundColor = ConsoleColor.White;
394+
395+
return ExitCodes.E9000;
396+
}
397+
398+
// compose target name
399+
targetName = $"ESP32_P4{revisionSuffix}";
400+
}
373401

374402
if (showFwOnly)
375403
{

nanoFirmwareFlasher.Library/EspTool.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ public Esp32DeviceInfo GetDeviceDetails(
233233
throw new EspToolExecutionException("Can't read flash size from device");
234234
}
235235

236+
// Chip name shows as ESP32_P (ESP32_P4) so correct
237+
if (chipType == "ESP32-P")
238+
{
239+
chipType = "ESP32-P4";
240+
}
241+
236242
// update chip type
237243
// lower case, no hifen
238244
_chipType = chipType.ToLower().Replace("-", "");

0 commit comments

Comments
 (0)