I created a clone of platform-atmelsam and modified it to work with the Omzlo NoCAN CANZERO boards. I used the guide “Custom Development Platforms”.
The CANZERO board is essentially an Arduino MKR ZERO clone, but with a custom CAN-based network. The network is managed by a Raspberry-Pi HAT. The nocanc daemon runs on the Raspberry and exposes an API to the network.
I tried to make all the necessary changes, but now platform.io gives an error when I try to build a simple blink program.
My guess is that the error comes from the fact that I cloned platform-atmelsam and there is quite a lot of code in main.py and platform.py that I do not really understand.
The platform code can be found at GitHub - bergernetch/platform-nocan: platform.io OMZLO nocan platform
Blink.cpp
/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include <Arduino.h>
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(1000);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(200);
}
Build output
xecuting task: platformio run --environment canzero
Warning! Ignore unknown configuration option `node_id` in section [env:canzero]
Processing canzero (platform: nocan; framework: arduino; board: nocan_canzero)
------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nocan/nocan_canzero.html
PLATFORM: OMZLO NoCAN (1.0.0+sha.7b7c414) > Omzlo CANZERO
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES:
- framework-arduino-samd @ 1.8.13
- framework-cmsis @ 1.40500.0 (4.5.0)
- framework-cmsis-atmel @ 1.2.2
- toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/canzero/src/Blink.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/Reset.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/SERCOM.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/USB/CDC.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/USB/USBCore.cpp.o
Compiling .pio/build/canzero/FrameworkArduino/USB/samd21_host.c.o
Compiling .pio/build/canzero/FrameworkArduino/Uart.cpp.o
In file included from src/Blink.cpp:7:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/src/Blink.cpp.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Reset.cpp:19:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/Reset.cpp.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/SERCOM.cpp:19:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Tone.cpp:19:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/Tone.cpp.o] Error 1
*** [.pio/build/canzero/FrameworkArduino/SERCOM.cpp.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/USB/CDC.cpp:19:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/USB/CDC.cpp.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/USB/USBCore.cpp:21:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/USB/USBCore.cpp.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/USB/samd21_host.c:24:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/USB/samd21_host.c.o] Error 1
In file included from /Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Uart.cpp:19:0:
/Users/dani/.platformio/packages/framework-arduino-samd/cores/arduino/Arduino.h:51:10: fatal error: variant.h: No such file or directory
*****************************************************************
* Looking for variant.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:variant.h"
* Web > https://registry.platformio.org/search?q=header:variant.h
*
*****************************************************************
#include "variant.h"
^~~~~~~~~~~
compilation terminated.
*** [.pio/build/canzero/FrameworkArduino/Uart.cpp.o] Error 1
======================================================= [FAILED] Took 0.68 seconds =======================================================
Environment Status Duration
------------- -------- ------------
canzero FAILED 00:00:00.677