5. And you need to have all those CMSIS, Startup, Device, System
I knew folks who would be interested in PTL would be able to figure it out. That's not exactly "5th step", because I tried to list just Windows-specific generic build env setup, whereas sorting out CMSIS stuff needed on any OS, and I hoped describe that straight in Getting Started.
So, to give a perspective on Cortex-M support in PTL: STM32 VLDiscovery was the first Cortex-M target supported, and initially was done with http://libopencm3.org
. But as I was learning more about Cortex-M, I figured that libopencm3 just adds extra layer between PTL and hardware, and also doesn't support all targets I was interested in.
So, I went for CMSIS, but of course found all that vendor mess and inconsistency. I kept learning, in particular I figured out that writing startup for Cortex-M is oh-so-damn-easy, you don't even need asm for that, it was specifically designed to make it possible to write startup/interrupt handlers in pure C. That's how https://github.com/pfalcon/cortex-uni-startup
was born. It was split from PTL to release it as public domain and to raise awareness of how simple Cortex-M is (note that code is based on other guy's samples who agreed it makes sense it to be just public domain).
One issue down from CMSIS, but there were still bunch of others, including licensing - most of CMSIS implementations from vendors come with proprietary license, which compromise OpenSource projects which use them. I remembered some guy on libopencm3 list talked about libopencmsis, and tracked it down. He was interested in EFM32, and did some bindings for it, but later EnergyMicro released its CMSIS under BSD license, which was first big win, so that guy gave up on his headers (which was generated from metadata) and even removed all his stuff from libopencmsis. I asked if he'd be willing under such circumstances to re-release it under BSD. He said yes, and that's how https://github.com/pfalcon/libperipha
was born. Soon after I started, there was second big win - ARM itself released CMSIS for Cortex-M standard core as BSD. That's now integrated into libperipha.
Please note that all of PTL, cortex-uni-startup, libperipha don't try to wrap all the features of each MCU. The aim is actual orthogonal - to support core features which any MCU supports, across as many MCUs as possible. The idea is that you can take any CPU (any board) and get typical (Arduino-level) app running on any of them (w/o any changes, that's the aim). If users (me or someone else) is satisfied with some MCU, they can go on and wrap more its functionality. The core MCU functionality we're talking here about is GPIO and timing support (using CPU and freerunning timer).
So, that's it - currently, PTL doesn't depend on vendor CMSIS for any supported targets, because I added (basic!) GPIO binding for all of supported chips to libperipha. All Cortex-M have SysTick timer, so that's covered too. Vendor CMSIS can be used too if more complete target coverage is desired on-spot (but I don't poke at their stuff to stay clean-room, so there may be discrepancies, and I'd need a bugreport to fix that).
I updated GettingStarted
with instructions for installing cortex-uni-startup/libperipha and actual example app building.