stefang
September 30, 2021, 10:43am
#1
Compiling against ARM’s CMSIS for my Adafruit Metro M0 board fails on Linux, because the include path for the core_cm0plus.h
header is specified incorrectly in the compiler invocation:
~/.platformio/packages/framework-cmsis/CMSIS/Core/include
The correct path on disk is the same with a capital I
(same on GitHub ):
~/.platformio/packages/framework-cmsis/CMSIS/Core/Include
I did the same on macOS and it works there, because it uses case-in-sensitive paths. Linux paths, however, are case-sensitive and so the compiler is not including the right one. I checked the package.json
, but I didn’t see how to change the way that PlatformIO deduces the include paths. Happy to fix this and make a PR, if you point me to the right location.
stefang
September 30, 2021, 10:43am
#2
Here is the full error output:
$ pio run -e adafruit_metro_m0 -v
Processing adafruit_metro_m0 (platform: atmelsam; board: adafruit_metro_m0; build_type: debug; platform_packages: framework-cmsis-atmel, framework-cmsis; build_flags: -I$PROJECT_PACKAGES_DIR/framework-cmsis-atmel/CMSIS/Device/ATMEL, -I$PROJECT_PACKAGES_DIR/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include, -I$PROJECT_PACKAGES_DIR/framework-cmsis/CMSIS/Core/include, -lc -lm -lgcc -lstdc++; src_filter: -<*> +<main.c> +<*_samd21.c>; board_build.ldscript: misc/samd21g18a_flash.ld)
------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-cmsis @ *
Unpacking [####################################] 100%
Tool Manager: framework-cmsis @ 2.50700.210515 has been installed!
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-cmsis 2.50700.210515 (5.7.0)
- framework-cmsis-atmel 1.2.2
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
arm-none-eabi-gcc -o .pio/build/adafruit_metro_m0/src/main.o -c -std=gnu11 -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib --param max-inline-insns-single=500 -mcpu=cortex-m0plus -Og -g2 -ggdb2 -DF_CPU=48000000L -DUSBCON -DPLATFORMIO=50200 -DARDUINO_SAMD_ZERO -DADAFRUIT_METRO_M0_EXPRESS -DARM_MATH_CM0PLUS -D__SAMD21G18A__ -D__PLATFORMIO_BUILD_DEBUG__ -Iinclude -Isrc -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include -I/home/ez/.platformio/packages/framework-cmsis/CMSIS/Core/include src/main.c
In file included from src/main.c:2:0:
/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:239:10: fatal error: core_cm0plus.h: No such file or directory
**********************************************************************
* Looking for core_cm0plus.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:core_cm0plus.h"
* Web > https://platformio.org/lib/search?query=header:core_cm0plus.h
*
**********************************************************************
#include <core_cm0plus.h>
^~~~~~~~~~~~~~~~
compilation terminated.
arm-none-eabi-gcc -o .pio/build/adafruit_metro_m0/src/startup_samd21.o -c -std=gnu11 -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib --param max-inline-insns-single=500 -mcpu=cortex-m0plus -Og -g2 -ggdb2 -DF_CPU=48000000L -DUSBCON -DPLATFORMIO=50200 -DARDUINO_SAMD_ZERO -DADAFRUIT_METRO_M0_EXPRESS -DARM_MATH_CM0PLUS -D__SAMD21G18A__ -D__PLATFORMIO_BUILD_DEBUG__ -Iinclude -Isrc -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include -I/home/ez/.platformio/packages/framework-cmsis/CMSIS/Core/include src/startup_samd21.c
*** [.pio/build/adafruit_metro_m0/src/main.o] Error 1
arm-none-eabi-gcc -o .pio/build/adafruit_metro_m0/src/system_samd21.o -c -std=gnu11 -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib --param max-inline-insns-single=500 -mcpu=cortex-m0plus -Og -g2 -ggdb2 -DF_CPU=48000000L -DUSBCON -DPLATFORMIO=50200 -DARDUINO_SAMD_ZERO -DADAFRUIT_METRO_M0_EXPRESS -DARM_MATH_CM0PLUS -D__SAMD21G18A__ -D__PLATFORMIO_BUILD_DEBUG__ -Iinclude -Isrc -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL -I/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include -I/home/ez/.platformio/packages/framework-cmsis/CMSIS/Core/include src/system_samd21.c
In file included from /home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from src/startup_samd21.c:44:
/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:239:10: fatal error: core_cm0plus.h: No such file or directory
**********************************************************************
* Looking for core_cm0plus.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:core_cm0plus.h"
* Web > https://platformio.org/lib/search?query=header:core_cm0plus.h
*
**********************************************************************
#include <core_cm0plus.h>
^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/adafruit_metro_m0/src/startup_samd21.o] Error 1
In file included from /home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from src/system_samd21.c:44:
/home/ez/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:239:10: fatal error: core_cm0plus.h: No such file or directory
**********************************************************************
* Looking for core_cm0plus.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:core_cm0plus.h"
* Web > https://platformio.org/lib/search?query=header:core_cm0plus.h
*
**********************************************************************
#include <core_cm0plus.h>
^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/adafruit_metro_m0/src/system_samd21.o] Error 1
============================================== [FAILED] Took 3.04 seconds ==============================================
Environment Status Duration
----------------- -------- ------------
adafruit_metro_m0 FAILED 00:00:03.044
stefang
September 30, 2021, 10:48am
#3
For now I am creating a symlink as a workaround:
$ cd ~/.platformio/packages/framework-cmsis/CMSIS/Core
$ ln -s Include include
$ ls -la
total 16
drwxr-xr-x 4 ez ez 4096 Sep 30 12:45 .
drwxr-xr-x 10 ez ez 4096 Sep 30 12:29 ..
lrwxrwxrwx 1 ez ez 7 Sep 30 12:45 include -> Include
drwxr-xr-x 2 ez ez 4096 Sep 30 12:44 Include
drwxr-xr-x 3 ez ez 4096 Sep 30 12:29 Template
Hold up – the Atmel SAM platform doesn’t even have framework = cmsis
as an option
"frameworks": {
"arduino": {
"package": "framework-arduino-sam",
"script": "builder/frameworks/arduino.py"
},
"mbed": {
"package": "framework-mbed",
"script": "builder/frameworks/mbed/mbed.py"
},
"simba": {
"package": "framework-simba",
"script": "builder/frameworks/simba.py"
},
"zephyr": {
"package": "framework-zephyr",
"script": "builder/frameworks/zephyr.py"
}
},
What is the exact platformio.ini
here?
Seems like you just have the typo in your platformio.ini
-I$PROJECT_PACKAGES_DIR/framework-cmsis/CMSIS/Core/include
in your build_flags
.
stefang
September 30, 2021, 11:10am
#6