I wonder if anyone can please assist with an M0 upload issue.
Upload from the Arduino IDE works fine. However putting the board in bootloader mode and uploading the same command from the windows command prompt fails every time.
Steps to reproduce....
In the arduino ide enable file>preferences>upload verbose and then upload.
After upload you will see the avrdude.exe upload command.
Highlight the avrdude command with the mouse and then use the keyboard to copy the highlighted command.
Open/run windows CMD (command prompt)
Past the command line with right click.
Press the reset button on your M0 so it goes into bootloader mode.
Press ENTER in the cmd window to run the avrdude.exe upload command
It's a confusing one. Avrdude.exe runs and establishes the device id but then hits a lot of timeouts.
I don't own an M0 but from a test upload with no board connected it looks like it uses the same system as the Leonardo. What happens is at the start of the upload the Arduino IDE opens the board's serial port at 1200 baud. That is a signal to some USB code that's added in by the Arduino core library to reset the board to activate the bootloader. With my Leonardo I can successfully upload from the command line by following the steps you list but I wonder if there could be some difference in the way the M0 bootloader handles the software reset that happens at the start of the upload via the IDE and the hard reset you are doing for the command line upload.
I recently got an M0 clone. I favor using my own tooling using cmake, hence why I'm using avrdude manually.
Considering it was an issue from where avrdude was invoked and not necessarily what is invoked, I investigated the issue.
I found that avrdude provides a -u flag which says "Disable safemode, default when running from a script." Because the IDE uses Java and probably calls the upload as a separate process of some kind, it is added by default. The running from script detection mechanism is probably not perfect.
However, once I read that, I tried again flashing using avrdude, this time with -u, via the command line and I found that it worked perfectly.