Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Erase flash before uploading (part of the upload process) (Read 175 times)
Martinus Maxiumus
Newbies
*
Offline



Posts: 6
Erase flash before uploading (part of the upload process)
Aug 16th, 2022 at 12:54pm
 
Hi,

For factory release testing i need to be able to erase the flash to clean out all WiFi settings, file systems etc.

Esptool has the -e (Erase) or erase_flash argument which can be configured that should perform this task. How can this be achieved within VisualMicro (VS2022)?

So what do i want to achieve:

- After the build
- Erase the flash (all settings all file systems)
- flash the new firmware
- after flashing the system should be like 'factory' delivered.

How can i do that?
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Erase flash before uploading (part of the upload process)
Reply #1 - Aug 16th, 2022 at 2:08pm
 
If you add a local board.txt to your project (vMicro > Add Code > Add Local Board.txt) and then add the below contents to it, it should perform the erase action before upload:

Code:
# Add Additional Pre-Upload command to Erase Flash before Upload
recipe.hooks.deploy.preupload.1.pattern={runtime.tools.esptool_py.path}\{tools.esptool_py.cmd} --port {serial.port} erase_flash 

Back to top
 
 
IP Logged
 
Martinus Maxiumus
Newbies
*
Offline



Posts: 6
Re: Erase flash before uploading (part of the upload process)
Reply #2 - Aug 17th, 2022 at 5:14pm
 
I've been searching for board.txt (i know where boards.txt is and added new profiles to it as well) as i found a similar article online.

Never found out how / where to create the board.txt

Thank you for the solution  Smiley
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: Erase flash before uploading (part of the upload process)
Reply #3 - Aug 17th, 2022 at 5:21pm
 
Thanks for the update, and glad it has worked.

Just to be clear there is a boards.txt included in each board package (e.g. esp32), however manipulating this, or adding the boards.local.txt into the board package folder, will be removed whenever you update the package (e.g. v2.0.1 > 2.0.2).  There are alternative routes using the sketchbook\hardware folder, however these become complex to understand and maintain generally.

This is why we have the "Local Board.txt" in Visual Micro, which lives alongside your project so you can override settings per-project, without losing them when updating the board package. It also allows overrides for multiple boards depending on the items being added to the file (e.g. Build Hook Overrides).
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print