Available framework
values are always documented for each board. See https://docs.platformio.org/en/latest/boards/atmelsam/due.html#frameworks. Here, it’s either arduino
, simba
, zephyr
or implicltly no framework = ...
line, which will prevent any framework being compiled in, giving you a baremetal project. Baremetal in the sense that the only headers you have access to come from the compiler toolchain or the ones in your own project.
(On a minor note, I think you refer to cmsis
here, not cmsys
.)
For Arduino Uno / AVR baremetal that works out nicely because the device header is part of the toolchain, avr-gcc
. This is not the case with the toolchain used for the Due, which is a standard gcc-arm-none-eabi. It does not have the ARM CMSIS headers for that Atmel chip – and also isn’t supposed to have it. The AVR toolchain is a rather special case here, they have the files for convience and the rather limited amount of known devices. The gcc-arm-none-eabi toolchain hower doesn’t have device headers of every known ARM device under the sun, in fact, it has none.
In any case, when you compile an Arduino project for the due and look at the start of compilation, it shows the used packages
HARDWARE: AT91SAM3X8E 84MHz, 96KB RAM, 512KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink, stlink)
PACKAGES:
- framework-arduino-sam 1.6.12
- framework-cmsis 1.40500.0 (4.5.0)
- framework-cmsis-atmel 1.2.2
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Whereas in the framework-cmsis-atmel
package there is
$ ls ~/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL/
sam3.h sam4c sam4n samc.h samd21 same51 samg54 sam.h saml21b samr.h
sam3u sam4e sam4s samd10 samd51 same70 samg55 sam-headers-version.txt saml.h sams70
sam3xa sam4.h samc21 samd11 samd.h same.h samg.h saml21a1 samr21 sams.h
all these device headers, e.g. for the Due’s AT91SAM3X8E
, there’s sam3xa/include/sam3x8e.h
.
In framework-cmsis
there is
$ ls ~/.platformio/packages/framework-cmsis/CMSIS/Core/Include/
cachel1_armv7.h cmsis_compiler.h core_armv81mml.h core_cm0plus.h core_cm35p.h core_cm7.h mpu_armv8.h
cmsis_armcc.h cmsis_gcc.h core_armv8mbl.h core_cm1.h core_cm3.h core_sc000.h pmu_armv8.h
cmsis_armclang.h cmsis_iccarm.h core_armv8mml.h core_cm23.h core_cm4.h core_sc300.h tz_context.h
cmsis_armclang_ltm.h cmsis_version.h core_cm0.h core_cm33.h core_cm55.h mpu_armv7.h
more of the general CMSIS stuff, like the general core_cm3.h
header etc.
To include these headers and build certain files (like, the startup file and startup_sam3xa.c
), one can use a little bit of Advanced scripting. For other platforms (such as ST-STM32), PlatformIO directly offers framework = cmsis
for this, but not for the Atmel-SAM platform, so I had to roll my own here.
I’ve setup a basic compiling project at GitHub - maxgerhardt/pio-baremetal-atmel-cmsis.
Read the caveats regarding the bootloader carefully. Since I have no Arduino Due board to test, I can’t verify the functionality. Comments and testing is appreciated.