Hi all
For my Adafruit Metro M0 board, I want to build a trivial program in C with PlatformIO:
➜ cat src/main.c
int main(void) {
return 0;
}
I generated the project like this:
➜ pio --version
PlatformIO Core, version 5.1.1
➜ pio project init --board adafruit_metro_m0
...
Project has been successfully updated!
My platformio.ini
looks good (I guess):
[env:adafruit_metro_m0]
platform = atmelsam
board = adafruit_metro_m0
framework = arduino
But when I try and build this, the compiler says:
error: 'Port' was not declared in this scope
Here is the relevant part from the output:
➜ pio run -v
Processing adafruit_metro_m0 (platform: atmelsam; board: adafruit_metro_m0; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/adafruit_metro_m0.html
PLATFORM: Atmel SAM (6.3.1) > Adafruit Metro M0 Expresss
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES:
- framework-arduino-samd-adafruit 1.7.2
- framework-cmsis 2.50400.181126 (5.4.0)
- framework-cmsis-atmel 1.2.2
- toolchain-gccarmnoneeabi 1.90301.200702 (9.3.1)
...
arm-none-eabi-g++ -o .pio/build/adafruit_metro_m0/FrameworkArduino/Uart.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -fno-threadsafe-statics -Os -ffunction-sections -fdata-sections -Wall -mcpu=cortex-m0plus -mthumb -nostdlib --param max-inline-insns-single=500 -Wno-expansion-to-defined -DPLATFORMIO=50101 -DARDUINO_SAMD_ZERO -DADAFRUIT_METRO_M0_EXPRESS -DARM_MATH_CM0PLUS -D__SAMD21G18A__ -DARDUINO=10805 -DF_CPU=48000000L -DUSBCON -DUSB_VID=0x239A -DUSB_PID=0x8013 "-DUSB_PRODUCT=\"Metro M0 Expres\"" -DUSB_MANUFACTURER=\"Adafruit\" -DARDUINO_ARCH_SAMD -DUSB_CONFIG_POWER=100 -I/Users/me/.platformio/packages/framework-cmsis/CMSIS/Core/Include -I/Users/me/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL -I/Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino -I/Users/me/.platformio/packages/framework-arduino-samd-adafruit/libraries/Adafruit_TinyUSB_Arduino/src/arduino -I/Users/me/.platformio/packages/framework-cmsis/CMSIS/DSP/Include -I/Users/me/.platformio/packages/framework-arduino-samd-adafruit/variants/metro_m0 /Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Uart.cpp
In file included from /Users/me/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69,
from /Users/me/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd.h:105,
from /Users/me/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/sam.h:565,
from /Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Arduino.h:48,
from /Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Tone.h:23,
from /Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Tone.cpp:20:
/Users/me/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/Tone.cpp: In function 'void tone(uint32_t, uint32_t, uint32_t)':
/Users/me/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:480:29: error: 'Port' was not declared in this scope
480 | #define PORT ((Port *)0x41004400UL) /**< \brief (PORT) APB Base Address */
| ^~~~
...
Compilation for other compile units from framework-arduino-samd-adafruit fail for the same reason. In particular: hooks.c, pulse.c, Uart.cpp and USBCore.cpp
Any ideas how to fix this? Thanks!