best practice for erasing /flash after updating firmware

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
safetyfactorman
Posts: 11
Joined: Sat Jan 24, 2015 10:34 pm
Location: vancouver/kelowna/lethbridge

best practice for erasing /flash after updating firmware

Post by safetyfactorman » Sat Apr 13, 2019 2:53 pm

Hi,

I recently updated the firmware on my pyboard (clone), and then discovered that the /flash was not reset or cleared. I think it would be a good idea to specify in the documentation for reflashing the firmware, to also include a paragraph describing how to re-initialize the /flash memory.

I am running linux mint 18, 32 bit, and my attempts to empty the trash folder on the /flash failed. The linux mint nemo software does not empty the trash folder. running under sudo does not help. /flash disappears. Is there a linux utility that allows for emptying the trash folder on the /flash drive? Does this mean that /flash is not recognized properly by linux? Or is it a user error?

I tried to reformat the /flash, using disks utility under linux. I was able to do that, however, the parameters required to reproduce the status of the drive are beyond my expertise. I ended up with a read only /flash.

Lastly, I examined the documentation, and discovered a reference to pyb.mount(), which has been deprecated and moved to uos.mount().
Does anyone know what the syntax is to execte uos.mount() to reinitialize the /flash? Perhaps there should be an uos.recreate_flash() function?

Is it best practice to avoid putting any user test code onto /flash? Should use of an sd card constitute best practice?

thanks,

Mark

chrismas9
Posts: 102
Joined: Wed Jun 25, 2014 10:07 am

Re: best practice for erasing /flash after updating firmware

Post by chrismas9 » Sun Apr 14, 2019 1:11 am

Usually updates preserve the filesystem. However some updates affect the filesystem and you need to do a filesystem reset using the USR switch at reset.

Hold down USR and press RST. After releasing RST the green and yellow LEDs will count in binary. Release USR at 3 - both LEDs on. The red LED will come on for a while during the erase and format. You will see a new boot.py and main.py.

safetyfactorman
Posts: 11
Joined: Sat Jan 24, 2015 10:34 pm
Location: vancouver/kelowna/lethbridge

Re: best practice for erasing /flash after updating firmware

Post by safetyfactorman » Sun Apr 14, 2019 1:36 am

worked great! thanks!

Post Reply