I want to port Arduino Zero from samd21g18 to samd21g17 (or g16), which has the same pin count, just less Flash and RAM. How can this be done? Anyone know of a tutorial?

I've created my own variant of the Zero for g18 before by modifying the Makefile for the bootloader, boards.txt, and variant.h (as discussed here). However, I suspect those modifications are not sufficient when switching to the g17 because there are a number of references specifically to the x18 variant (ie. samd21g18 or samd21x18) throughout the ArduinoCore-samd, including in:

boards.txt,

Makefile (for the bootloader),

samd21_sam_bas.cproj,

pulse_asm.S,

WVariant.h,

SAMD21_USBDevice,

USBCore, SPI.h,

arduino_zero.cfg,

variant.gdb.

So, at first glance, it appears to be more involved. If anyone has done this before and can advise, I'd greatly appreciate your insight.

One of the most important file when dealing with variant with different memory size is the linker script. It's here that you say how much RAM and of much FLASH your device has. And it will be used to compile and map your programm correctly.

If you changed correctly the board.txt file to match you board variant it should work correctly. Other files (puls_asm, WVariant, USBCore etc..) should work whithout modification.

I have no idea how to make this a friendly path that would work regardless of the user that installed it, but that's where sam.h is.

But I notice there is a checkbox for "include device support header path". What is that?

Well, I think maybe that means to include the paths I specify in the box.And when I pasted the address above into the dialog that came up and left "relative path" checked it spit this out in the path dialog:

../../../../../../../arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL

And when I click that "relative path" is now checked, so I guess if I'd entered that in the first place I would have had to check that box.

And I guess that's 7 directories up from where my project is? But that can't be Tau, so it must be Tau/Release? I see a make file in there. So I guess maybe that's it.

I also had to include this directory:C:\Users\Shawn\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\Include

Could not successfully build release after adding those directories due to missing USB VID PID defines. These are in the makefile provided... but it seems release generates a new makefile and it doesn't have these? And the provided makefile does, and has those directories defined in it for the includes?

All I know is a debug build compiles, release does not.

But debug also only generates an .ELF file, no BIN which is needed for Arduino to burn bootloader. Why?

I think I see the problem. Release build config didn't have "use external makefle" checked under build?

I'm not sure what I wrote that for, but it turns out that if I click "build samd21" and not "build project" then it creates .HEX and .BIN files in addition to the .ELF

Here, LENGTH = 0x00008000 must be changed to LENGTH = 0x00004000 because tau has half the ram.

And 0x00040000 for the flash length equals 262,144 and the Tau has half the flash, so that also has to be reduced.

The last piece of a puzzle is that the default BOSSA tool which uploads to the board does not provide support for the SAMD21E17:https://github.com/shumatech/BOSSA/blob/arduino/src/Devices.h

Unless you tick a little box in the IDE that tells it to provide verbose output during UPLOAD (not compile, they are two separate options!) the only error you will see when BOSSA does not recognize the processor is "no device found on COM [whatever]", which would lead you to believe there is a problem with your board's hardware instead of a problem with the IDE's tools.

There is a version of BOSSA here which has been recompiled to include support for all the SAMD, SAMC, and SAML chips:

https://github.com/mattairtech/BOSSA

Actual compiled version can be found hre:https://github.com/mattairtech/ArduinoCore-samd

Scroll down and there are links to compiled versions near the bottom. Alternatively you can use the boards manager to install the mattairtech board files which have a compiled BOSSA in the tools folder for that variant.

Hey guys,Thanks to both of you for your responses. I will try out your suggestions, starting with AloyseTech, and moving on to scswift's notes as needed.I'll let you know what works, and hopefully can post a guide on the topic later.

It took a while but I got a bootloader running on a different samd21 chip(samd21g17), and can upload to it from the Arduino IDE. scswift's notes above capture mostly all the steps, except for step 7 in the list below. Before starting, you should already have a created (and hopefully tested) a samd21g18 variant. Here's a guide on doing that: https://forum.arduino.cc/index.php?topic=409715.0

I developed hardware for the Atmel ATSAML21J18B. It has the same pin count as the Arduino Zero/Atmel ATSAMD21. It should be possible to port the ATSAMD21 to ATSAML21J18B. Can someone port it for me? Of course I can give you hardware and a fee.

I developed hardware for the Atmel ATSAML21J18B. It has the same pin count as the Arduino Zero/Atmel ATSAMD21. It should be possible to port the ATSAMD21 to ATSAML21J18B. Can someone port it for me? Of course I can give you hardware and a fee.

Just curious - did you success ? I just did the same. Not easy task, but possible ! Regards !