MacOSX Siera + STM32VLDiscovery + CilibiOS = ?
0. Intro
This post is about developing for STM32 micro controllers using native tools on new MacOSX Siera. As far as I’m VIM-mad guy for several years I won’t speak about Eclipse or any other IDE here, but build an IDE myself from VIM, tmux and STM32 related tools. For experiments I have STM32VLDiscovery board, Mac Book Pro and GNU tools.
1. Installing tools
First of all, we need to install homebrew if you don’t have it already:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"After that you can install most of needed tools from brew repo:
brew install arm-none-eabi-gccbrew install --HEAD stlink
This is all tools you need to work with STM32 micro controllers.
In addition I recommend to install STM32CubeMX from ST team. It helps to configure your chip visual.
If you need some IDE, editor or other tool you can read about it here.
2. CilibiOS
ChilibiOS is a fantastic RTOS. It has a lot of ready to use examples and supports big range of hardware. It consists of 3 independent components (as defined on website):
- RT — the fastest RTOS solution for embedded realtime systems
- NIL — the smallest RTOS solution for embedded realtime systems
- HAL — a package containing a set of abstract device drivers allowing effective application portability across different architectures
To start development with ChilibiOS you just need to
- Download and unpack it somewhere
- Choose from tests or demos what is more suitable for your project
- Copy chosen demo to new folder
- Fix CHIBIOS in Makefile to point on directory with ChibiOS
- Make sure all this compiles and works correctly
After that you can add your functionality and remove useless stuff as you like.
3. Workflow
Now lets try all together. I assumed you have installed everything and downloaded ChibiOS.
Get T0ha’s stories in your inbox
Join Medium for free to get updates from this writer.
In this example I use ChilibiOS 16.1.5. If you have other version, you are welcome to fix in comments.
First of all:
cp -r ChibiOS_16.1.5/demos/STM32/RT-STM32F100-DISCOVERY ./first_projectcd first_project
Now open Makefile in your favourite editor an change
CHIBIOS = ../../..to
CHIBIOS = = ../ChibiOS_16.1.5/You can also change PROJECT if you like.
Now try to compile it by invoking “make”.
If compilation succeed run in another terminal tab or window
sudo st-util -1return back and do
$ arm-none-eabi-gdb build/ch.elf(gdb) target extended-remote :4242(gdb) load(gdb) run
Now, if everything is ok, you’ll see leds blinking on your discovery board.
See you next time…
Orignally published at here.








