Bootloading the arduino M0

I'm about to build an arduino M0 but I want to make sure I know how to boatload the chip before I build the PCB. When I bootloaded my custom arduino Nano I just used an arduino UNO and connected their ICSP's together.

Is the process the same for the M0? Or can I boatload straight from the USB port because the chip has a USB interface?

You'll need a JTAG programmer (actually: SWD) to put the bootloader onto a SAMD chip. ArduinoISP won't do it.

westfw:
You'll need a JTAG programmer (actually: SWD) to put the bootloader onto a SAMD chip. ArduinoISP won't do it.

Is there a good description how to do it? I'm also into designing in an SAMD21 and bootloading it is the only big question mark so far.

From the info I could gleam from other posts I concluded that it has a 3 pin interface SWDIO/SWCLK/RESET, could it be programmed via another Arduino like a Nano? Or do you need another M0 (Zero, MKZero etc.?)

could it be programmed via another Arduino like a Nano? Or do you need another M0 (Zero, MKZero etc.?)

I suppose that theoretically you could program it with a Nano using an appropriate sketch, but as far as I know, no one has written such a sketch. Most people working with bare SAMD chips spring for an Atmel Device programmer like the Atmel ICE or Atmel JTAG ICE3
In theory the Arduino Zero and M0 Pro include an "EDBG Chip" that can do this programming, but I don't know if it's possible to use this to program external chips. (if it IS possible, I don't think it's been documented.)
Other JTAG/SWD programmers might work as well, with possibly more complicated setup. (The Segger JLink is a popular multi-vendor JTAG device.)
SWD is a "small pin number" version of JTAG, and as far as I can tell, JTAG is significantly more complex than the SPI-like protocols used by the AVRs. It's designed to examine all sorts of internal aspects of the chain of devices to which it is connected, and only does flash programming as a sort-of side effect.

I found this site:
LINK

The guy describes a way how to burn the bootloader from one SAMD21 based board with EBDG to another one with the same port just like you described.

I'm waiting for some more info from him. Although it is well possible there is nothing more to the topic and the program to have one SAMD21 to burn bootloader to another one is already integrated into the Arduino IDE.
I found from Adafruit a page:

...according to it it looks quite easy but it does not show connections. Is the EBDG a separate chip or is it an integrated part of the SAMD21?

EDBG is a separate chip. Zero and "m0 pro" have it, but many SAMD21 boards don't (as a chip, it's more expensive than the SAMD21 itself :frowning: )
The Adafruit instructions are based on using EDBG for the Zero, but they assume you have a JLink (Segger) for their Feather. (And I don't see any connection instructions other than "wire it up correctly" (Some hints here, though: Parts | Debug Header for the Feather [M0] | Adafruit Learning System)

Oh - I found this: Overview | Programming an M0 using an Arduino | Adafruit Learning System
Which sounds exactly like what you're looking for...

(Although, if you're really building your own hardware, buying an "appropriate" JTAG programmer/debugger (~$100, these days) is sort of an "assumed start-up cost." Part of the "wonderfulness" of Arduino was elimination of this expense and complication for AVRs...)

Keep an eye out for Atmel (Microchip) training. Frequently a "hands on training class" will be giving away slightly old hardware at really steep discounts. For example, in NY "somewhat associated with Makerfaire" (this week?), these is:

which includes a class on "Advanced Arduino Debugging", where you'll get to take home an ATmega328p Xplained-mini (Uno equivalent with mEDBG on-board) AND a JTAGICE3 debugger (does ARM too), all for $25.

westfw:
Oh - I found this: Overview | Programming an M0 using an Arduino | Adafruit Learning System
Which sounds exactly like what you're looking for...

Good find, thank a lot!!! It really sound like the solution I've been looking for. Now the question remains to be answered is if it's similarly easy to just replace an arbitrary bin file with the bin of the bootloader and upload it the same way...?