Custom Arduino SAMD21 bootloader with Atmel Studio

I recently got a low-cost ARM Cortex M0 based ( Atmel SAMD21G18A ) board , a clone of the Robotdyn SAMD21 M0-mini board and wanted to make a custom Arduino IDE compatible bootloader using the Atmel Studio IDE – it has the GNU-ARM toolchain built in.

The user L-LED was not mounted, so the RX- and TX-LEDs could be used as bootloading progress indicators. It turned out that a fresh installed Arduino IDE is able to add GNU ARM Cortex M0+ toolchain for various Arduino boards that uses the Atmel SAMD21 microcontroller.

Steps involved to make the custom bootloader are these, assuming Windows 10 is used:

  1. Download the Arduino IDE v. 1.18.13 from here: Arduino IDE  , do not use Microsoft App Store to inatall the Arduino IDE.!
  2. Install to the default installation path: C:\Program Files (x86)\Arduino
  3. Select Tools -> Board -> Boards Manager . Scroll down to find and install the Arduino package: Arduino SAMD Boards ( 32 bits ARM Cortex M0+ ). After installation , goto Tools -> Board and select the Arduino MKRZero board :
  4. Close the Arduino IDE. Bootloader source code for the bootloaders shown for the Arduino SAMD boards are found in the path: C:\Users\foo\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.9\bootloaders , replace foo with your Win 10 user name , and enable “show hidden files” in Explorer View. Contents of the bootloaders folder:  
  5. Download and install the Atmel Studio IDE ( I used version 7.0.2397 ) from here:  Atmel Studio download
  6. The zero folder holds the source files for the Arduino SAMD21 bootloaders. Copy the zero folder to: C:\Users\foo\Documents\Atmel Studio\7.0 ,  foo is your user name.
  7. Open the zero folder in C:\Users\foo\Documents\Atmel Studio\7.0 ,  foo is your user name. In the zero folder find and click the samd21_sam_ba.atsln Atmel Studio project file:
  8. Atmel Studio starts the project . Press F7 to build the bootloader:
  9. Some Warnings will show, but the “Build succeeded.” is OK. The bootloader .hex file from the compilation is found in the folder from step 7 and can be flashed to the SAMD21G18A microcontroller via the on-board SWD connector. At this point a customized Arduino compatible SAMD21 bootloader can be made by modifying the files in the Atmel Studio project to fulfill the actual needs. I made a bootloader version that used the RX- and TX-LEDs to indicate, that the bootloader is running. This version of the bootloader is here: SAMD21 custom bootloader. A small demo video is to be seen here: Youtube ldr
  10. To flash the bootloader, refer to the blog: Atmel Studio 7 and SAMD21 – ARM Cortex M0+

17 thoughts on “Custom Arduino SAMD21 bootloader with Atmel Studio

  1. Erik,
    I am actually wanting to chat with you about your “Simple retriggerable delay circuit for an USB outlet” post. I have a similar need to delay attachment of a USB Device for a few seconds but I have some questions about your diagram.
    If you are open to discussing it please respond to my email provided in your data form.

  2. Heya are using WordPress for your site platform? I’m new to
    the blog world but I’m trying to get started and set up my own. Do you
    require any html coding knowledge to make
    your own blog? Any help would be really appreciated!

  3. Αn outstanding sharе! I have juswt forwardeⅾ thnis
    onto a friеnd who has been conducting a little homework on this.
    And hһe іn fact Ƅought me lunch due to the fact that
    I found it foг him… lol. So allow me to reword
    thiѕ…. Thanks for the meal!! But yеah,
    thanks for spending time to talk about this tߋpic herе on your

  4. When someone writes an arіcle he/she maіntains the image ⲟf a user in hiѕ/her mind that how a user can understrand it.
    Theгefore that’s why thjs paragraph is gгeat. Thanks!

  5. Hi, this weekend is nice designed for me, since this
    occasion i am reading this fantastic educational paragraph here at my home.

  6. Hi! This post couldn’t be written any better! Reading this post reminds me of my previous
    room mate! He always kept chatting about this. I will forward this post to him.
    Pretty sure he will have a good read. Many thanks for sharing!

  7. I will immediately grab your rss feed as I can not in finding your email subscription link or newsletter service.
    Do you have any? Please let me recognise so that I could subscribe.

  8. Interesting blog! Is your theme custom made or did you download it
    from somewhere? A design like yours with a few simple adjustements
    would really make my blog jump out. Please let me know where you got
    your theme. Bless you

  9. you are in point of fact a just right webmaster. The website loading velocity is incredible.

    It seems that you are doing any distinctive trick.
    Furthermore, The contents are masterwork. you’ve performed a excellent process in this topic!

  10. Hi thеre i am қavin, itts myy first time to commenting anywhere, when i read thiѕ рaragraph i tһought i cօuld
    also make comment due to this gooⅾ article.

Leave a Reply

Your email address will not be published.