I just started to swap the hardware abstraction layer that runs the low level stuff on OpenGround. On modern 32 bit processors you usually get a small abstraction library from the manufacturer. This library maps complex commands such as initializing e.g. the SPI subsystem to the underlaying low-level register access commands. For the stm32 series you can get a library for that from st, the so called st peripheral library. When I started with OpenGround this was the obvious choice as it came directly from the chip manufacturer. This library is documented to some extend, you find some examples from ST and there are other people on the web that share their experience. The bad thing is that it comes with a very strict license.
I recently stumbled upon libopencm3, an open and LGL licensed library that supports a variety of arm cortex based processors (STM32*, LPC, EFM32, …). It is a bit less documented as the st library but comes with a cleaner interface. It seems like is barely used for STM32F0 processors as we do but my porting progress looks quite good so far. This library comes under the LGPL license so it can be legally and easy included into the OpenGround git. They also have a git repository so integration using a git submodule is a piece of cake.
So you might think why should one use that one? Well, it’s not that much less documented as the ST library but it comes with an opensource license which I really like. The interface looks even cleaner to me. When I had a look on how to add USB support (Joystick HID) the ST usb library looks quite bloated and to complicated for our simple use. On the other hand, the USB HID implementation of libopencm3 looks quite structured and clean. I must admit that I did not test the USB part of that library yet.
You can find my port under the opencm3 branch of OpenGround. I made some good progress, the following parts are working:
- everything is ported to the lib
- linking and basic chip setup is working
- Screen works
- ADC + DMA works
- Buttons work
- LEDs light up on my command 😉
The flash storage needs some tuning in the linker file and I got stuck at the I2C part for the touchscreen. But this was merely because I was running out of time today 😉
I will continue with that port, if I succeed I will completely switch to libopencm3. Maybe I will do the same in the future for OpenSky, we will see 🙂