VS Arduino
Visual Micro >> Installation & Troubleshooting >> Erase flash before uploading (part of the upload process)
https://www.visualmicro.com/forums/YaBB.pl?num=1660650878

Message started by Martinus Maxiumus on Aug 16th, 2022 at 11:54am

Title: Erase flash before uploading (part of the upload process)
Post by Martinus Maxiumus on Aug 16th, 2022 at 11:54am
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?

Title: Re: Erase flash before uploading (part of the upload process)
Post by Simon@Visual Micro on Aug 16th, 2022 at 1: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[/code]

Title: Re: Erase flash before uploading (part of the upload process)
Post by Martinus Maxiumus on Aug 17th, 2022 at 4: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  :)

Title: Re: Erase flash before uploading (part of the upload process)
Post by Simon@Visual Micro on Aug 17th, 2022 at 4: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).

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.