Skip to content

Commit d0bd9ce

Browse files
authored
Add option to skip backup of ESP32 configuration partition (#300)
1 parent 6599f20 commit d0bd9ce

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ This example uses the binary format file that you can find when you are building
179179
nanoff --target ESP32_PSRAM_REV0 --update --serialport COM31 --deploy --image "c:\eps32-backups\my_awesome_app.bin" --address 0x1B000
180180
```
181181

182+
### Skip backing up configuration partition
183+
184+
To skip backing up the configuration partition when updating the firmware of an ESP32 target connected to COM31.
185+
```console
186+
nanoff --update --target ESP32_PSRAM_REV0 --serialport COM31 --noconfigbackup
187+
```
188+
182189
## STM32 usage examples
183190

184191
### Update the firmware of a specific STM32 target

nanoFirmwareFlasher.Library/Esp32Operations.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public static ExitCodes BackupFlash(
107107
/// <param name="massErase">If <see langword="true"/> perform mass erase on device before updating.</param>
108108
/// <param name="verbosity">Set verbosity level of progress and error messages.</param>
109109
/// <param name="partitionTableSize">Size of partition table.</param>
110+
/// <param name="noBackupConfig"><see langword="true"/> for skiping backup of configuration partition.</param>
110111
/// <returns>The <see cref="ExitCodes"/> with the operation result.</returns>
111112
public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
112113
EspTool espTool,
@@ -123,7 +124,8 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
123124
bool fitCheck,
124125
bool massErase,
125126
VerbosityLevel verbosity,
126-
PartitionTableSize? partitionTableSize)
127+
PartitionTableSize? partitionTableSize,
128+
bool noBackupConfig)
127129
{
128130
ExitCodes operationResult = ExitCodes.OK;
129131
uint address = 0;
@@ -511,8 +513,8 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
511513
int configPartitionSize = 0;
512514
string configPartitionBackup = Path.GetRandomFileName();
513515

514-
// if mass erase wasn't requested, backup config partitition
515-
if (!massErase)
516+
// if mass erase wasn't requested or skip backup config partitition
517+
if (!massErase || !noBackupConfig)
516518
{
517519
// check if the update file includes a partition table
518520
if (File.Exists(Path.Combine(firmware.LocationPath, $"partitions_nanoclr_{Esp32DeviceInfo.GetFlashSizeAsString(esp32Device.FlashSize).ToLowerInvariant()}.csv")))

nanoFirmwareFlasher.Tool/Esp32Manager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ private async Task<ExitCodes> DoProcessAsync()
172172
!_options.FitCheck,
173173
_options.MassErase,
174174
_verbosityLevel,
175-
_options.Esp32PartitionTableSize);
175+
_options.Esp32PartitionTableSize,
176+
_options.NoBackupConfig);
176177

177178
if (exitCode != ExitCodes.OK || _options.IdentifyFirmware)
178179
{

nanoFirmwareFlasher.Tool/Options.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ public class Options
138138
HelpText = "Perform check for PSRAM in device.")]
139139
public bool CheckPsRam { get; set; }
140140

141+
[Option(
142+
"noconfigbackup",
143+
Required = false,
144+
Default = false,
145+
HelpText = "Skip backup of configuration partition.")]
146+
public bool NoBackupConfig { get; set; }
147+
141148
#endregion
142149

143150

nanoFirmwareFlasher.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9FD8C426-A16A-49DB-952D-747C3AD96C42}"
99
ProjectSection(SolutionItems) = preProject
1010
NuGet.Config = NuGet.Config
11+
README.md = README.md
1112
version.json = version.json
1213
EndProjectSection
1314
EndProject
@@ -66,7 +67,7 @@ Global
6667
HideSolutionNode = FALSE
6768
EndGlobalSection
6869
GlobalSection(ExtensibilityGlobals) = postSolution
69-
SolutionGuid = {56E99FF7-1E34-4FB8-8E3C-F98890E741D0}
7070
SolutionGuid = {AF6C2B32-984F-41C2-B0F7-B895E45A1BB5}
71+
SolutionGuid = {56E99FF7-1E34-4FB8-8E3C-F98890E741D0}
7172
EndGlobalSection
7273
EndGlobal

0 commit comments

Comments
 (0)