Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions nanoFirmwareFlasher.Library/Esp32Firmware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal class Esp32Firmware : FirmwarePackage
public const int CLRAddress = 0x10000;

/// <summary>
/// ESP32 nanoCLR is available for 2MB, 4MB, 8MB and 16MB flash sizes
/// ESP32 nanoCLR is available for 2MB, 4MB, 8MB, 16MB, 32MB and 64MB flash sizes if supported.
/// </summary>
private List<int> SupportedFlashSizes => [0x200000, 0x400000, 0x800000, 0x1000000];
private List<int> SupportedFlashSizes => [0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000];

internal string BootloaderPath;

Expand Down Expand Up @@ -76,15 +76,26 @@ internal async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync(Es
{
BootloaderPath = "bootloader.bin";

// Boot loader goes to 0x1000, except for ESP32_C3/C6/H2/S3, which goes to 0x0
// and ESP32_P4 where it goes at 0x2000
int BootLoaderAddress = 0x1000;
if (deviceInfo.ChipType == "ESP32-C3"
|| deviceInfo.ChipType == "ESP32-C6"
|| deviceInfo.ChipType == "ESP32-H2"
|| deviceInfo.ChipType == "ESP32-S3")
{
BootLoaderAddress = 0;
}
if (deviceInfo.ChipType == "ESP32-P4")
{
BootLoaderAddress = 0x2000;
}

// get ESP32 partitions
FlashPartitions = new Dictionary<int, string>
{
// bootloader goes to 0x1000, except for ESP32_C3/C6/H2/S3, which goes to 0x0
{
deviceInfo.ChipType == "ESP32-C3"
|| deviceInfo.ChipType == "ESP32-C6"
|| deviceInfo.ChipType == "ESP32-H2"
|| deviceInfo.ChipType == "ESP32-S3" ? 0x0 : 0x1000, Path.Combine(LocationPath, BootloaderPath) },
// BootLoader goes to an address depending on chip type
{ BootLoaderAddress, Path.Combine(LocationPath, BootloaderPath) },

// nanoCLR goes to 0x10000
{ CLRAddress, Path.Combine(LocationPath, "nanoCLR.bin") },
Expand Down