Problems burning SAMD boards with a programmer

Hello!

I am using the Adafruit_DAP "flash_from_SD" example to burn MKR bootloader using another MKR with ETH shield as a programmer, hooked to target's SWD pads. It works well every time, however, using the same method to burn a sketch is not successful.

The sketch is something I wrote and saved as a bin file using IDE, so no bootloader here, and I know my bin is good as I use it to update the board Over The Air which also works well.

Is there a difference between burning a bootloader vs. other programs, for instance, are they burned to the same Flash address (normally 0 I assume), maybe something else?

Thanks!

What do you mean by "is not successful"? If you're getting an error message, please post the full text of it.

pert:
What do you mean by "is not successful"? If you're getting an error message, please post the full text of it.

No error message, the burning completed as expected, it is just the board that bricks after the matter (reflashing the bootloader brings it back alive).

ninora:
No error message, the burning completed as expected, it is just the board that bricks after the matter (reflashing the bootloader brings it back alive).

is the bin build for start address without bootloader? in SAMD the execution starts at address 0. the bootloader is there usually. the DAP erases the flash. so if your bin starts at address 2000 and is flashed at address 0, it will not work

Juraj:
is the bin build for start address without bootloader?

No, I guess I should change the linker script in boards.txt file or there's a more direct approach?

I hav

ninora:
No, I guess I should change the linker script in boards.txt file or there's a more direct approach?

I have this

Thanks!

Juraj:
my_boards/samd/boards.txt at master · JAndrassy/my_boards · GitHub

I am using your boards.txt and get an error for a missing specs file which I couldn't find anywhere:

avr-g++: error: device-specs/specs-cortex-m0plus: No such file or directory

The complete log here:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Admin\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Admin\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Admin\Documents\Arduino\libraries -fqbn=arduino:avr:mzero_no_bl -vid-pid=0X2341_0X8054 -ide-version=10812 -build-path C:\Users\Admin\AppData\Local\Temp\arduino_build_786505 -warnings=none -build-cache C:\Users\Admin\AppData\Local\Temp\arduino_cache_987742 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Admin\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Admin\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Admin\Documents\Arduino\libraries -fqbn=arduino:avr:mzero_no_bl -vid-pid=0X2341_0X8054 -ide-version=10812 -build-path C:\Users\Admin\AppData\Local\Temp\arduino_build_786505 -warnings=none -build-cache C:\Users\Admin\AppData\Local\Temp\arduino_cache_987742 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board 'mzero_no_bl' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=cortex-m0plus -DF_CPU=48000000L -DARDUINO=10812 -DARDUINO_SAM_ZERO -DARDUINO_ARCH_AVR -D__SAMD21G18A__ -mthumb -DUSB_VID=0x2a03 -DUSB_PID=0x804e "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino M0\"" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\arduino_mzero" "C:\\Users\\Admin\\AppData\\Local\\Temp\\arduino_build_786505\\sketch\\Blink.ino.cpp" -o nul
Error while detecting libraries included by C:\Users\Admin\AppData\Local\Temp\arduino_build_786505\sketch\Blink.ino.cpp
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=cortex-m0plus -DF_CPU=48000000L -DARDUINO=10812 -DARDUINO_SAM_ZERO -DARDUINO_ARCH_AVR -D__SAMD21G18A__ -mthumb -DUSB_VID=0x2a03 -DUSB_PID=0x804e "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino M0\"" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\arduino_mzero" "C:\\Users\\Admin\\AppData\\Local\\Temp\\arduino_build_786505\\sketch\\Blink.ino.cpp" -o "C:\\Users\\Admin\\AppData\\Local\\Temp\\arduino_build_786505\\preproc\\ctags_target_for_gcc_minus_e.cpp"
avr-g++: error: device-specs/specs-cortex-m0plus: No such file or directory

exit status 1
Error compiling for board Arduino M0 (no bootloader).

why did you put it in arduino/avr folder?
Using board 'mzero_no_bl' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Embarrassing :confused:
Thanks

Based on the good advices here I was able to burn a bootloader and afterwards use Serial to upload a sketch, which works, I can also burn a Blink bin compiled for address 0, works as well.

However, when I try to burn a bootloader and afterwards burn a Blink bin compiled with default address 2000, the board bricks.

You may ask why burn a BL and then burn the program when I can use Serial in the first place?

Because the target is to burn the program without a bootloader, and where Blinks works well off address 0, I am having troubles running more complex programs with communication libraries straight off address 0, it simply won't run and I am trying to isolate the cause.

ninora:
Because the target is to burn the program without a bootloader, and where Blinks works well off address 0, I am having troubles running more complex programs with communication libraries straight off address 0, it simply won't run and I am trying to isolate the cause.

I run my 100 kB bin with Ethernet and SD card without problems from address 0.

Juraj:
without problems from address 0.

Mine too! After fixing a typo in the boards file...
As always thanks a lot.