Arduino Zero, No bootloader, Just sketch

Hi All!,

I working on a project that uses the ATSAMD21G18 on a custom board. For testing am using a Sparkfun MINIDEV version. ( SparkFun SAMD21 Mini Breakout - DEV-13664 - SparkFun Electronics )

The project is reliant on the USB port for communication and my goal is to load programs onto the chip with no bootloader (using Atmel Ice). This way there is no chance of the firmware being accidentally overwritten when connected to the computer.

So far I have been able to erase the chip, load the current zero bootloader on to the device, then export the compiled binary of my blink sketch and load it onto the zero at 0x2000. The light blinks away happily.

My issue is when I erase the chip and try and program the compiled binary onto the chip without the bootloader. The program doesn't run (no blinking) and I loose the COMM port in device manager.

Thanks

An arm starts executing at 0x00000000. You have erased the flash so the code (bootloader) over there is gone now, so nothing interesting happens.

If you link your sketch at address 0x0 and program it at that location it will work.

You can link at 0x0 by usung the linker script flash_withoutbootloader.ld instead of the flashwith_bootloader.ld used by the ide.

I did a quick test: I located boards.txt (on my linux system it is in
<my_home_dir>/.arduino15/packages/arduino-beta/hardware/samd/1.6.1-build-34/boards.txt)

I copy pasted the complete section starting with:

arduino_zero_edbg.name=Arduino Zero (Programming Port)

into a new section in which I changed the keys ‘arduino_zero_edbg’ into ’ arduino_zero_nobl’,
I changed the top line into:

arduino_zero_nobl.name=Arduino Zero (No Bootloader)

… and the line with the linker script into:

arduino_zero_nobl.build.ldscript=linker_scripts/gcc/flash_without_bootloader.ld

Then I selected Arduino Zero (No Bootloader) as board and compiled the blink sketch.
Then I burned it manually with openocd at location 0x0.
It blinks.

Wow.... thanks. That worked perfectly, I appreciate you taking the effort to try that for me.

Hi PeterVH,

even if this thread is quite old I want to thank you a lot: I had the same problem as bflug and you saved my day!

Your expertise is amazing ! :slight_smile:

Marco