Skip to content

Commit 27c8c24

Browse files
authored
Correct the way nanoff chooses the partition to erase. (#53)
***NO_CI***
1 parent 49d50a6 commit 27c8c24

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

nanoFirmwareFlasher/Esp32Firmware.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal class Esp32Firmware : FirmwarePackage
2121
/// </summary>
2222
internal List<int> SupportedFlashSizes => new List<int> { 0x200000, 0x400000, 0x800000, 0x1000000 };
2323

24+
internal string BootloaderPath;
25+
2426
internal Dictionary<int, string> FlashPartitions;
2527

2628

@@ -53,11 +55,13 @@ internal async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync(in
5355

5456
if (executionResult == ExitCodes.OK)
5557
{
58+
BootloaderPath = "bootloader.bin";
59+
5660
// get ESP32 partitions
5761
FlashPartitions = new Dictionary<int, string>()
5862
{
5963
// bootloader goes to 0x1000
60-
{ 0x1000, Path.Combine(LocationPath, "bootloader.bin") },
64+
{ 0x1000, Path.Combine(LocationPath, BootloaderPath) },
6165

6266
// nanoCLR goes to 0x10000
6367
{ 0x10000, Path.Combine(LocationPath, "nanoCLR.bin") },

nanoFirmwareFlasher/Esp32Operations.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ internal static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync
168168
// need to get deployment address here
169169
// length must both be multiples of the SPI flash erase sector size. This is 0x1000 (4096) bytes for supported flash chips.
170170

171-
var flashPartition = firmware.FlashPartitions.First();
172-
173-
var fileStream = File.OpenRead(flashPartition.Value);
171+
var fileStream = File.OpenRead(firmware.BootloaderPath);
174172

175173
uint fileLength = (uint)Math.Ceiling((decimal)fileStream.Length / 0x1000) * 0x1000;
176174

0 commit comments

Comments
 (0)