Arduino-CI / arduino_ci

Unit testing and Continuous Integration (CI) for Arduino libraries, from a Ruby gem
Apache License 2.0
110 stars 34 forks source link

[Question] Configure unit tests for Arduino Nano 33 iot #138

Open migarstka opened 4 years ago

migarstka commented 4 years ago

Hi, I was wondering how to setup my .arduino-ci.yaml to run the unit tests for the Arduino Nano 33 IoT. I saw that it is not defined in default.yml.

Thank you for your help.

ianfixes commented 4 years ago

Great question!

This seems to be a SAMD board, according to https://www.arduino.cc/en/Guide/NANO33IoT which means you won't need a new entry in the packages: config -- sure enough, I see the board listed in the official definitions: https://downloads.arduino.cc/packages/package_index.json

The next step is to pull relevant data about the board itself: https://github.com/arduino/ArduinoCore-samd/blob/master/boards.txt#L174-L202

# Arduino NANO 33 IoT
# --------------------
nano_33_iot.name=Arduino NANO 33 IoT
nano_33_iot.vid.0=0x2341
nano_33_iot.pid.0=0x8057
nano_33_iot.vid.1=0x2341
nano_33_iot.pid.1=0x0057

nano_33_iot.debug.tool=gdb
nano_33_iot.upload.tool=bossac
nano_33_iot.upload.protocol=sam-ba
nano_33_iot.upload.maximum_size=262144
nano_33_iot.upload.use_1200bps_touch=true
nano_33_iot.upload.wait_for_upload_port=true
nano_33_iot.upload.native_usb=true
nano_33_iot.build.mcu=cortex-m0plus
nano_33_iot.build.f_cpu=48000000L
nano_33_iot.build.usb_product="Arduino NANO 33 IoT"
nano_33_iot.build.usb_manufacturer="Arduino LLC"
nano_33_iot.build.board=SAMD_NANO_33_IOT
nano_33_iot.build.core=arduino
nano_33_iot.build.extra_flags=-DCRYSTALLESS -D__SAMD21G18A__ {build.usb_flags}
nano_33_iot.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
nano_33_iot.build.openocdscript=openocd_scripts/arduino_zero.cfg
nano_33_iot.build.variant=nano_33_iot
nano_33_iot.build.vid=0x2341
nano_33_iot.build.pid=0x8057
nano_33_iot.bootloader.tool=openocd
nano_33_iot.bootloader.file=nano_33_iot/samd21_sam_ba_arduino_nano_33_iot.bin

The configuration itself in your .arduino-ci.yaml should be a straightforward copy of the format you see in default.yml; you will be defining a new platform, and these are my best guesses for the values:

platforms:

  nano_33_iot:
    board: arduino:samd:nano_33_iot
    package: arduino:samd
    gcc:
      features:
      defines:
        - CRYSTALLESS
        - __SAMD21G18A__
      warnings:
      flags:

If this ends up working for you, please paste that final configuration here and/or open a pull request to add it to default.yml.