Skip to content

Conversation

@WebDust21
Copy link

@WebDust21 WebDust21 commented Dec 22, 2025

There have been quite a few requests for CMSIS build support for ATSAM-series MCUs. Some pull requests, some issues, etc., but surprisingly, despite multiple years passing after the first request, no progress has been made.
Highlights:
#170 wasn't done right...the "cmsis.py" is literally just a copy of the one from ststm32--which obviously won't work.
#21 does not appear to have succeeded...there's still no support for CMSIS
#80 started off strong, but apparently was abandoned when changes to support CMSIS would end up breaking the existing Arduino build system

Based on the above, I've taken a slightly different approach that hopefully should make this PR successful, to finally get CMSIS support for ATSAMx MCUs on PlatformIO. The world needs an alternative to the truly lousy piece of software called MPLAB X (but better known on the Microchip forums by the more accurate moniker "Buglab X").

  • To avoid breaking any sort of compatibility with the existing build systems, I have split the CMSIS framework into a completely separate tool, "framework-cmsis-atmelsam". Several reasons:
    1. The CMSIS headers have been significantly changed since ~2015 when the present "framework-cmsis-atmel" was snapshotted...meaning that it's impossible to merge the new headers into the old build system without breaking every currently functioning build system. Might as well clean-slate a fresh start.
    2. Commit arduino/ArduinoModule-CMSIS-Atmel@9d57a18 added SAMC21 support--but with significant differences to the folder structure compared to ALL the other supported MCU families. This would wreck completely unnecessary havoc with a build script.
  • Note that support for several families, most notably the SAM3x and SAM4x has been dropped. One simple reason: I cannot find updated CMSIS PACKs for them! The processors still seem to be manufactured, though; not sure what's going on. Ideally, the entire "framework-cmsis-atmelsam" should be based on the same CMSIS version/style; as noted above, there has been a huge shift in the way the CMSIS headers were written since the 2015 snapshot. (I believe it's a direct result of Microchip's acquisition of Atmel in 2016--because that's when the "legacy" headers were removed.)
  • This PR adds no less than 254 autogenerated "genericSAMx" board definitions in the spirit of the ststm32 and other repositories. These files were generated with a custom script that pulled definitions out of the CMSIS packs, finding memory size, default clock speed at startup, core type, part number, etc.

I have verified successful compilation on a number of processor families, as well as personally verifying compilation, programming, and full software debugging with an on-board ATMEL-ICE on the ATSAMC21N-XPRO Xplained board I purchased as a development module. "Blinky LED" with timers and button control works perfectly fine, e.g. the build system does work, as far as I can test it.

There may well be some tweaks/adjustments needed based on reports from users with hardware for the other MCU families, but the basic system appears to be solid.

Note that I did not add the hundreds of megabytes of SVD files for all of the processors--although I have them, and can certainly PR them in if that is the way the maintainers here would like to move forwards. Tests with the ATSAMC21N18 are working perfectly--but heck, there's already an SVD for that in this repository!

I have submitted the new framework-cmsis-atmelsam to PlatformIO, and am waiting for it to be approved. Kinda challenging to do this here, because neither this PR nor that framework will work independent of the other! Fingers crossed...

@WebDust21
Copy link
Author

added "-Werror=implicit-function-declaration" to the "_bare.py". Seems strange to have not been included in the first place, as tracking down errors resulting from implicit functions can be very difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant