dbdd088 is great, but also dangerous to Arduino SAMx21 users who don't understand its implications.
The first time I ran my "make upload" target, which doesn't specify --offset and worked on v1.8, I bricked my chip by erasing the bootloader code. I have an SWD programmer so it was easy enough to re-flash the bootloader, but others users may not be so fortunate.
There's also a flags incompatibility issue:
| Version |
--offset=0x0000 (default) |
--offset=0x2000 |
| 1.8 |
Correct, writes to 0x2000 |
Incorrect, writes to 0x4000 (but bootloader still works) |
| 1.9 |
Dangerous, writes to 0x0000 and kills the bootloader |
Correct, writes to 0x2000 |
I don't have any great ideas for handling the changes to --offset, but I think it could be beneficial to print a warning and require confirmation (or an explicit --offset=0 argument) before erasing/writing anything at address 0.