Skip to content

Commit bc5d116

Browse files
authored
Add support for ESP32_S3 (#221)
***NO_CI***
1 parent 0fa4f86 commit bc5d116

File tree

9 files changed

+40
-9
lines changed

9 files changed

+40
-9
lines changed
20.6 KB
Binary file not shown.
3 KB
Binary file not shown.
3 KB
Binary file not shown.
3 KB
Binary file not shown.
191 KB
Binary file not shown.

nanoFirmwareFlasher.Library/Esp32Firmware.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ internal async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync(Es
8282
// get ESP32 partitions
8383
FlashPartitions = new Dictionary<int, string>
8484
{
85-
// bootloader goes to 0x1000, except for ESP32_C3 which goes to 0x0
86-
{ deviceInfo.ChipType == "ESP32-C3" ? 0x0 : 0x1000, Path.Combine(LocationPath, BootloaderPath) },
85+
// bootloader goes to 0x1000, except for ESP32_C3 and ESP32_S3, which goes to 0x0
86+
{ deviceInfo.ChipType == "ESP32-C3" || deviceInfo.ChipType == "ESP32-SC3" ? 0x0 : 0x1000, Path.Combine(LocationPath, BootloaderPath) },
8787

8888
// nanoCLR goes to 0x10000
8989
{ CLRAddress, Path.Combine(LocationPath, "nanoCLR.bin") },
9090

91-
// partition table goes to 0x8000; there are partition tables for 2MB, 4MB, 8MB and 16MB flash sizes
91+
// partition table goes to 0x8000; there are partition tables for 4MB, 8MB and 16MB flash sizes (and 2MB for ESP32)
9292
{ 0x8000, Path.Combine(LocationPath, $"partitions_{Esp32DeviceInfo.GetFlashSizeAsString(flashSize).ToLowerInvariant()}.bin") }
9393
};
9494
}

nanoFirmwareFlasher.Library/Esp32Operations.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
127127
// perform sanity checks for the specified target against the connected device details
128128
if (esp32Device.ChipType != "ESP32" &&
129129
esp32Device.ChipType != "ESP32-S2" &&
130-
esp32Device.ChipType != "ESP32-C3")
130+
esp32Device.ChipType != "ESP32-C3" &&
131+
esp32Device.ChipType != "ESP32-S3")
131132
{
132133
// connected to a device not supported
133134
Console.ForegroundColor = ConsoleColor.Yellow;
@@ -237,6 +238,31 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
237238
// compose target name
238239
targetName = $"ESP32_C3_{revisionSuffix}";
239240
}
241+
else if (esp32Device.ChipType == "ESP32-S3")
242+
{
243+
string revisionSuffix;
244+
245+
if (esp32Device.ChipName.Contains("revision 3") || esp32Device.ChipName.Contains("revision 4"))
246+
{
247+
// all the others (rev3 and rev4) will take rev3
248+
revisionSuffix = "_REV3";
249+
}
250+
else
251+
{
252+
Console.ForegroundColor = ConsoleColor.Red;
253+
254+
Console.WriteLine("");
255+
Console.WriteLine($"Unsupported ESP32_S3 revision.");
256+
Console.WriteLine("");
257+
258+
Console.ForegroundColor = ConsoleColor.White;
259+
260+
return ExitCodes.E9000;
261+
}
262+
263+
// compose target name
264+
targetName = $"ESP32_S3";
265+
}
240266

241267

242268
Console.ForegroundColor = ConsoleColor.Blue;
@@ -260,7 +286,7 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
260286
Console.WriteLine("");
261287
Console.WriteLine("***************************************** WARNING ****************************************");
262288
Console.WriteLine("Seems that the firmware image that's about to be used is for a revision 3 device, but the");
263-
Console.WriteLine($"connected device is {esp32Device.ChipName}. You should use the 'ESP32_WROOM_32' instead.");
289+
Console.WriteLine($"connected device is {esp32Device.ChipName}.");
264290
Console.WriteLine("******************************************************************************************");
265291
Console.WriteLine("");
266292
}

nanoFirmwareFlasher.Library/EspTool.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,19 @@ public Esp32DeviceInfo GetDeviceDetails(
252252
// FEATHER_S2's have PSRAM, so don't even bother
253253
psramIsAvailable = PSRamAvailability.Yes;
254254
}
255-
else if (name.Contains("ESP32-C3"))
255+
else if (name.Contains("ESP32-C3")
256+
|| name.Contains("ESP32-S3"))
256257
{
257-
// all ESP32-C3 SDK config have support for PSRAM, so don't even bother
258+
// all ESP32-C3/S3 SDK config have support for PSRAM, so don't even bother
258259
psramIsAvailable = PSRamAvailability.Undetermined;
259260
}
260261
else
261262
{
262263
// if a target name wasn't provided, check for PSRAM
263-
// except for ESP32_C3
264-
if (targetName == null && !name.Contains("ESP32-C3"))
264+
// except for ESP32_C3 and S3
265+
if (targetName == null
266+
&& !name.Contains("ESP32-C3")
267+
&& !name.Contains("ESP32-S3"))
265268
{
266269
psramIsAvailable = FindPSRamAvailable();
267270
}

nanoFirmwareFlasher.Library/nanoFirmwareFlasher.Library.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
</None>
9494
<None Include="..\lib\esp32s2bootloader\**" Link="esp32s2bootloader\%(RecursiveDir)%(Filename)%(Extension)">
9595
</None>
96+
<None Include="..\lib\esp32s3bootloader\**" Link="esp32s3bootloader\%(RecursiveDir)%(Filename)%(Extension)">
97+
</None>
9698
</ItemGroup>
9799

98100
<!-- STLink executables for all platforms -->

0 commit comments

Comments
 (0)