Uploading Bin file

Hi! I have to upload an exported bin file ( sketch from Arduino IDE ) and upload it to SAMD21 board with Atmel Ice through SWD connector.
How can I do it ?
Thank you!

See here. Second section ("Feather M0 and others") shows you how to upload a compiled program on the chip using Atmel Studio and the Atmel ICE.

Hi AloyseTech,

Thanks again, that's really useful.

MartinL

Hy AloyseTech!

Thank you!

taken from Sulimarco. I tested and it works:

"if you are not worried to make a little modification to a ZERO board, I think you can try the following method to use a ZERO as an SWD programmer.

I didn't try it but I think it could work.

1- Remove the two resistors shown in the "Arduino_ZERO_pcb" and "ARDUINO_ZERO_schematics" attachments.

2- Make your board. A minimalist implementation is shown in the "SAMD21G18_minimalist_implementation" attachment.

3- Connect signals SWDIO, SWCLK, RESET plus GND and 3.3V between the ZERO and your board.

For RESET GND and 3.3V I recommend to use the normal Arduino's connector.
For SWDIO and SWCLK you can use the pads of the SWD connector or the left side pads of the removed resistors.

Keep the wires as short as possible.

4- Double check your connection.

5- Connect your PC to the ZERO's "programming " usb connector (the one near the black power supply connector".

6- Open the Arduino IDE on your pc and select the ZERO board and the ZERO's programming port as a programmer.

7- Burn the ZERO's bootloader.

8- If everything go ok you can now write a sketch and download it to your board."

Hi all!

I've been able to upload a sketch from the Arduino IDE to SAMD21G18 via Atmel Ice and through SWD connector. It works but only from the sketch.
If I try to upload the exported bin file via Atmel Studio the file doesn't start.
Maybe because without the bootloader the sketch starts from a different address? how can I link it to the correct address?

Thank you!

If you want to upload and execute a bin file without the bootloader, you have to compile using the correct linker script.

In fact, with the bootloader, your code is located at address 0x2000, and the bootloader take care of everything at launch.

But without bootloader, you have to upload the sketch at address 0x0000, because at start up this is the where the first instructions are expected to be.
See this line in the linker script (with/without bootloader):

 FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000

Hi AloyseTech!

Thank you, it works!

(deleted)

Hi LucaTudor,

Do i modify
Code: [Select]

mzero_bl.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld

, to point to
the linker script without bootloader. And what about the other entries.

Yes that's right, you just need to change the linker script file in the "boards.txt" file.

The only difference between the "flash_with_bootloader.ld" and "flash_without_bootloader.ld" linker scripts, are that the flash with bootloader script reserves the first 8K of flash memory and starts at address 0x2000 (8192 bytes or 8KB in decimal), whereas flash without bootloader starts at 0x0000.

The command lines used by the Arduino IDE for the compiler and linker can be found in the "platform.txt" file.