How to build on macOS - Seeed-Studio/ArduPy GitHub Wiki

I recommend arduino-cli tools and hope you enjoy it as much as I do. Here are the simple installation and compilation steps, similar to those used when compiling on Linux, with some differences in the path.

  1. Add our Seeed‘s Arduino Core
arduino-cli core update-index --additional-urls  https://raw.githubusercontent.com/Seeed-Studio/Seeed_Platform/master/package_seeeduino_boards_index.json
  1. Add platform packages for the samd architecture
arduino-cli core install Seeeduino:samd  --additional-urls  https://raw.githubusercontent.com/Seeed-Studio/Seeed_Platform/master/package_seeeduino_boards_index.json;
  1. Use cmake to compile it. If you don't have it on your computer, you need to install it. There should be 10,000 ways to install cmake on Google. The following commands need to be executed under the source root of Ardupy.
mkdir build
COREVER=$(arduino-cli core list | grep Seeeduino | awk '{print $2}')   

Compile samd51

cmake ../ -DARDUINO_CORE_PATH=$HOME/Library/Arduino15/packages/Seeeduino/hardware/samd/$COREVER -DTOOLCHAIN=$HOME/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin -DBOARD=grove_ui_m4 -DARDUINO_VERIANT=grove_ui_wireless

Compile samd21

cmake ../ -DARDUINO_CORE_PATH=$HOME/Library/Arduino15/packages/Seeeduino/hardware/samd/$COREVER -DTOOLCHAIN=$HOME/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin  -DBOARD=seeeduino_m0 -DARDUINO_VERIANT=arduino_zero

Flash your board

#Grove UI board
$HOME/.arduino15/packages/arduino/tools/bossac/1.8.0-48-gb176eee/bossac -i -d --port=ttyACM0 -U -i --offset=0x4000 -w -v Ardupy.bin -R