How can I flash the STM32F0 flash over SWD?
The flash is not directly programmed via SWD.
First a piece of MCU code, a loader stub that can program FLASH, is loaded via SWD to SRAM.
Then the data that needs to be programmed is transferred to SRAM via SWD.
Finally the CPU is told to jump and execute the programming code and it does the programming.
This way you can program to any internal or external memory, as long as you have a compatible loader stub.
If you need to program MCU firmware from Linux, just execute a program that does it for you.