Hello, I’m trying to add support for the Macchina M2. Support was originally added in November, 2017, however it was removed at some point between now and then.
The M2 is based on the Arduino Due but there are a few differences, so even though the dueUSB board does compile and run, I’d like to be able to use some variant-specific defines.
So far the only way I’ve been able to get this to work is the following:
- Create
boards/macchina_m2.json
with the contents:
{
"build": {
"arduino": {
"ldscript": "flash.ld"
},
"core": "arduino",
"cpu": "cortex-m3",
"extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_M2 -DMACCHINA_M2",
"f_cpu": "84000000L",
"hwids": [
[
"0x2341",
"0x003E"
],
[
"0x2A03",
"0x003E"
]
],
"mcu": "at91sam3x8e",
"usb_product": "Arduino Due",
"variant": "m2"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "ATSAM3X8E",
"openocd_chipname": "at91sam3X8E",
"openocd_target": "at91sam3ax_8x",
"svd_path": "ATSAM3X8E.svd"
},
"frameworks": [
"arduino",
"simba"
],
"name": "Macchina M2",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 98304,
"maximum_size": 524288,
"native_usb": true,
"protocol": "sam-ba",
"protocols": [
"sam-ba",
"jlink",
"blackmagic",
"atmel-ice",
"stlink"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://docs.macchina.cc/m2-docs",
"vendor": "Macchina"
}
- Clone GitHub - macchina/arduino-boards-sam: Arduino IDE support for the M2 and other SAM-based boards. to
/tmp
- Add
board_build.variants_dir = /tmp/arduino-boards-sam/sam/variants
toplatformio.ini
My questions are as follows:
- How can I add this custom variant to the Atmel SAM platform? I see how I can add the board to the existing GitHub repo, but how can I add the variant such that I do not have to locally clone a repo and alter
board_build.variants_dir
? - How does PlatformIO generate
package.json
for existing cores? For example,framework-arduino-sam
is sourced as fromhttps://github.com/arduino/ArduinoCore-sam
, however there’s an additionalpackage.json
in my~/.platformio/packages/framework-arduino-sam
directory that does not appear in the open source repo.