I’m using an STM32 Nucleo board connected to a Raspberry Pi. To flash the MCU I drop a binary file to a mounted drive. The problem is that it takes a random, and sometimes long time, from the moment I drop the file to the actual moment the MCU is flashed. As a contrast, I have an instantaneous result when flashing from Windows. Is there a way to expedite the process?
Linux thinks it's just some external storage, and holds back (caches) writes while it's mounted. You can try to
umountthe Nucleo interface after copying, forcing everything to be written back
- issue a
synccommand after copying
- mount it with
-o syncto disable write caching.
The first two methods are preferred over
-o sync (as long as they work), because writes are still cached until the system is told to write everything, using up fewer flash write cycles.
If none of the above works reliably, then install openocd or texane st-link on the pi, and use that for flashing.