Bootloading custom ATSAMD21G18 ARM controller

I am developing a custom board using ATSAMD21G18 ARM controller(Similar to Arduino Zero). Thanks to Arduino community for design files. So, my question is- what is process of uploading Arduino bootloader in ATSAMD21G18 ARM controller? or can i upload my custom arduino code directly to the board?

I use a J-Link and Adalink to flash bootloaders to ATSAMD21G18 chips:

Bootloaders are here:

I haven't tried flashing compiled sketches this way, but I'm sure it's the same process. You can get the compiled sketch like this:

  • Sketch > Export Compiled Binary
  • Wait for the compilation to finish.
  • Sketch > Show Sketch Folder

The compiled .hex file will be in the sketch folder.

You can also use the Adafruit_DAP library to turn a regular Arduino board into a programmer:

Despite hours of trying, I've never been able to get it to work, but other people report it does work for them.