Developing on STM32: introducing ChibiStudio


In this article, we are going to set-up a ready-to-use Eclipse-based toolchain named ChibiStudio for the development on STM32. We will also explore this development toolchain explaining some basic operations necessary for daily development. So we will introduce the ChibiOS project, we will setup ChibiStudio taking a tour of some parts of it, we will import some ready to use projects and perform our first flash and run. Note that to proceed with this tutorial is necessary the installation of ST-Link drivers: this procedure has been shown in the previous article From 0 to STM32.

Notes about programming language

We never talked about programming language deliberately until now. Actually, programming is a matter of mindset and logic. The language is just a way to put into effect a well-defined idea. Of course, there are certain languages which are more suitable for a purpose. About embedded programming, this kind of software development is extremely close to the hardware and because of that most of embedded libraries are written in C and Assembly. In some cases, some libraries are written in C++ and more rarely in Java, PHP or Javascript.

We are going to use C.

The ChibiOS project

Until now we have referred to ChibiOS as an Embedded Library and this is the most simplistic and general way to qualify it. To be more specific, ChibiOS stands for Small Operating System (Chibi is a Japanese word which means small) but today it is much more than an OS.

History in brief


ChibiOS (formerly ChibiOS/RT) is a project born in the 80s and published on Sourceforge in 2007 by my mentor and friend Giovanni Di Sirio. In the beginning, the project was named ChibiOS/RT because it was basically a Real Time Operating System (or RTOS). After some months of development, the project starts to include a set of device drivers for testing purposes.

Growing up, the device drivers branch became self-consistent. It was split from RT and named as HAL. Prior to the version 3.0.0, the HAL and the RT were joint together and interdependent. Starting from 3.0.0, the two parts have been separated and interconnected through an Operating System Abstraction Layer (also known as OSAL) in this way HAL became able to run independently from the underlying Operating System.


The ChibiOS project has now a portfolio of four software products which could be used separately or joint-together. It now counts two different kernels: the first is RT and now the name ChibiOS/RT  refers to RT only; the second one is another OS which could be considered a subset of RT designed to be the smallest RTOS ever and is named ChibiOS/NIL).

The HAL, the hardware abstraction layer, has been renamed as ChibiOS/HAL. Starting from the latest version, ChibiOS include also a new set of complex drivers: its name is ChibiOS/EX and stands for external peripherals. We will properly describe all these products as we start to use them. For this tutorial, we are going to use some demos based on ChibiOS/RT + ChibiOS/HAL.

Useful links

Here a collection of useful links related to ChibiOS. We will deepen them later but right now is good to have all the quick references grouped in the same place:

  • The ChibiOS project has an Official Website ( and a support forum ( I suggest you to explore the website because has interesting technical information, documentation and news. Another good idea is to subscribe to the forum and get in touch with the community: it could be an irreplaceable source of knowledge.
  • This project has an Official Facebook page: like and follow it to receive news about releases or events related to the project.
  • The code comes with detailed documentation (there is a document for each sub-project): this is very useful while developing. Anyway, the documentation is auto-generated from code using a tool named Doxygen. This means that exploring the code you will be able to find all the information needed. We will deepen this point later during hands-on.
  • The project is distributed through Sourceforge. On the project page, you will find a link to the SVN repository and a directory with all the downloadable files.

As final note, PLAY Embedded has a lot of resources to learn for to work with ChibiOS. We often offer support to people who comment our articles or subscribes our forum (

We highly recommend to ask help on our forum only for problems strictly related to PLAY Embedded articles/demos.

Version number

When you ask for help the most important think is to give precise information about the version of ChibiOS you are using.

The project is released as package versioned using the method yy.m.p “codename” where:

  • yy indicates the release year (less significant two digits) and changes only on major releases;
  • m indicates the release month number and changes only on major releases as well as year;
  • p indicates the patch, a number incremented in case of small bug fixes on minor releases;
  • codename is an identifier for the current patch.

Each product (as example RT or HAL) has its own version number according to the method M.m.p where:

  • p indicates the patch, a number incremented in case of small bug fixes;
  • m indicates the minor, a number incremented in case of small changes or even addition of features which in any case do not impact on APIs;
  • M indicates the major, a number incremented in case APIs change or addition of big features which requires a change of the design.

At the time of writing the latest ChibiOS package was also indicated as ChibiOS 17.6.2 “Allegro” while ChibiOS/RT was 4.0.0, ChibiOS/HAL 5.0.0 and ChibiOS/NIL 2.0.0. ChibiOS EX instead is a collection of drivers individually versioned. Now I am reviewing this article ChibiOS package is marked as  ChibiOS 18.2.1 “Ravello” but concept explained in the articles here presented are still valid.


Each ChibiOS sub-project has its own version number identified by three numbers M.m.p. The whole package is versioned with a three number plus one word system yy.m.p “codename”.

As final note, there is full compatibility between two different patch numbers. As example code that runs on ChibiOS 17.6.0 “Adagio” runs also on ChibiOS 17.6.2 “Allegro” but maybe does not compiles on ChibiOS 18.2.1 “Ravello” even if porting is quite simple.

How to use it

Basically ChibiOS is a software library: it is a folder containing source code and other plain text files. There is no way to use ChibiOS itself without a toolchain!

Dealing with programming, more so with embedded programming, you will often hear about “toolchains”.

A toolchain is a set of distinct software development tools linked (chained) together. When you develop code for embedded systems you are compiling code which will run on a machine different from your Computer. 

So, we need

  1. specific embedded libraries able to address our MCU
  2. a compiler able to generate code which will run most likely on a different architecture: this is known as cross-compiler,
  3. a flasher to flash the binary into the STM32,
  4. in a decent development system, a debugger to test code at run-time.

All those things are provided all together in ChibiStudio, a ready to use toolchain named ChibiStudio which we are now going to install. The following figure schematise the toolchain:

In the PC side, we have the toolchain which contains the ChibiOS Embedded Software + the user application. It is compiled through the ARM GCC Cross Compiler generating a firmware.

On the Development kit side, we have the STM32 connected through the JTAG to the ST-Link debugger.

The two sides are interconnected by an HW layer (STLink + Cable) and an SW Layer (OpenOCD and GDB Server). Using this interconnection is possible to flash the firmware on the STM32 as well as execute the code step by step watching status of  MCU memories.

Development system diagram
A diagram of the development system composed by ChibiStudio + an STM32 based development board

Setup of ChibiStudio

Lets setup ChibiStudio on Microsoft Windows to better understand what we have just read. Note also that it is possible to re-assemble the same toolchain under Linux or Mac OS and you can find some guides about that on the ChibiOS website (I have seen ChibiStudio running under Mac OS X Sierra and under Linux Mint).

I am not used to Linux but I have planned to write an article about how to assemble ChibiStudio under a Linux. Right now, in case you are following this tutorial, my suggestion is to temporarily install a virtual machine. If someone wants to contribute to the Linux setup article just comment on this post: help is always welcome.

What follow is a “Learn by doing” section: from here and out is highly suggested to repeat the same steps on your own. Practice is the best way to understand!

Requirement for Windows

There are some requirements to install ChibiStudio:

  • Windows 7 or Higher with Administration Rights;
  • Java 32-bit since ChibiStudio is based on Eclipse 32-bit. Note that to install Java 32-bit you have not to uninstall Java 64-bit;
  • Install the latest version of 7-zip: ChibiStudio is compressed as .7z and this can prevent problems during the extraction.
  • Uninstall all the antiviruses and enable Windows Defender.

Let me do some clarifications about the latest point. The toolchain contains a lot of executables like make.exe from GCC or openocd.exe. These executables are so anonymous that common antiviruses detect them like viruses killing them as they are called to execute their normal functions. This generates unexpected behavior of your toolchain. Some antiviruses can be also temporarily disabled but, in my experience, they continue to work in background even if disabled.

A funny remark, in 2014 Brian Dye, a Symantec’s senior vice president for Info-Sec said that antivirus “is dead”: Dye told the Wall Street Journal that hackers increasingly use novel methods and bugs in the software of computers to perform attacks, resulting in about 55% cyberattacks going unnoticed by commercial antivirus software. My suggestion remains the same: uninstall all the antiviruses and enable Windows Defender; the best antivirus is your finger.

Step by step guide

The setup of ChibiStudio could be performed extracting the toolchain from the archive under C:\.

In case this article is out of date, install the latest version of ChibiStudio anyway. If there will be important differences between the version here used and the latest one let us know and we will promptly update this article.

Starting from 2019 the ChibiOS project has been moved from SouceForge to OSDN. To get the latest version of ChibiStudio it is highly suggested to visit the Official page of ChibiStudio on Another way to get the direct link to the latest version of ChibiStudio is to visit the link

The setup can be performed following these simple steps:

  1. Download the latest version of ChibiStudio.
  2. Extract it under C:\ using 7zip.
  3. Copy the link “Chibi Studio GCC 7.0” or “Chibi Studio GCC 5.4” on the desktop and use it to launch the toolchain.

The two links are quite the same except for the compiler version used by ChibiStudio: the first uses gcc-arm-eabi 7.0 and the second gcc-arm-eabi 5.4.

It is very important that toolchain is extracted under C:\ because batch file and Eclipse are preconfigured: the toolchain will work if the its files are placed at C:\ChibiStudio!

To make thinks simplest, this short video will show you how to execute the previous enumerated steps.

If you are not able to run ChibiStudio and an error windows prompts most likely you haven’t installed Java 32-bit correctly or something went wrong during extraction.

Exploring ChibiStudio

Some necessary concepts

Startup with ChibiStudio could be thorny, especially if you are new to Eclipse. We are going to introduce some general concept related to Eclipse pointing out which are the ChibiStudio specific customization: this would improve your experience. Feel free to jump to paragraph 4.2 if you are already experienced with ChibiStudio.


First of all, Eclipse is an Integrated Development Environment (often abbreviated IDE). An IDE is a tool which aims to simplify the development process with visual aids like code highlighting, autocomplete content assist, advanced code browsing, debugging windows and so on.

Eclipse is completely open source and is widely used but not strictly necessary: it is possible also to write code in a text editor and compile it using a shell if you prefer. Anyway, a well configured IDE is always a good help to develop code quickly, especially if you are not used to shell and scripting languages.

Workbench and workspace

Eclipse is organized in Workbenches: a workbench is practically the Eclipse main window. It is the bench where you can organize your programming instruments, hence the different views and editors. Views and editors are your instruments to manipulate sources and data. and you can arrange them at hand for specific tasks (exploring, debugging, coding, etc.).

All the configurations related to Workbench (settings, IDE related variables, perspectives, history, imported projects, etc.) are saved as metadata in a specific location which is named Workspace. The workspace folder is also the default location where new projects are saved.

ChibiStudio comes with more than a release of ChibiOS for a matter of back compatibility. For example, ChibiStudio Preview 20 comes with three different versions of ChibiOS:

  • ChibiOS 18.2.1 (located at C:\ChibiStudio\chibios182), which was the latest stable version of ChibiOS when ChibiStudio Preview 20 has been released;
  • ChibiOS 17.6.4 (located at C:\ChibiStudio\chibios176), which is the previous version of ChibiOS with the latest patch available when the toolchain has been released.
  • ChibiOS Trunk (located at C:\ChibiStudio\chibios_trunk). The Trunk represents the development version of ChibiOS which by definition is not stable updated at the latest revision number available when ChibiStudio Preview 19 has been released.

The presence of the oldest version of ChibiOS would be a kind of bridge between the old version and the new one: having the previous and the latest version of ChibiOS in the same toolchain could be the chance to port 176 projects to 182 using the same toolchain. The trunk instead could be used to test new features and is also used from us to continue the development. Note that is possible to work on trunk updating it to the latest revision following this article (we are not going to use trunk right now so you don’t need to do this now).

For each version of ChibiOS integrated into ChibiStudio there is a related Workspace. So, in ChibiStudio Preview 20, there are three different workspaces:

  • Workspace 182 (located at C:\ChibiStudio\workspace182), which is configured with all the available demos for ChibiOS 182 already pre-imported;
  • Workspace 176 (located at C:\ChibiStudio\workspace176), which is configured with all the available demos for ChibiOS 176 already pre-imported;
  • Workspace Trunk (located at C:\ChibiStudio\workspace_trunk), which could be to try trunk new features.

Additionally, there is another workspace:

  • Workspace User (located at C:\ChibiStudio\workspace_user, which is an empty workspace dedicated to the user.

In Eclipse, Workspace and workbench are different terms for different concepts: The workbench is the Eclipse main window, The workspace is a directory that holds information about workbench like the projects you work on, as well as the Eclipse preferences (from layout to behaviour). For more information you could refer to Eclipse documentation.

It is possible to switch workspace in use through the menu File->Switch Workspace and choosing a workspace from the history or selecting “Other…” to browse a new workspace like is shown in the next figure.

Switching workspace
The switching workspace menu

Taking a look at this menu you can also figure out which is the workspace in use because it would not be in the list. Refers to the previous figure, we are currently using Workspace User which is not in the history list.

Choosing another Workspace Eclipse will restart loading a new Workbench.


The organization of your Workbench could be saved to be quickly recalled at the proper moment: these presets take the name of perspectives.

ChibiStudio perspectives
ChibiStudio perspectives

Perspectives could be switched using the proper button in the top right corner of your Workbench. It is also possible to add other perspectives, save or reset the current one to default through the drop-down menu “Window” located in the menu bar.

Note that switching perspective is a matter of views organization, this will not impact your code or your files. You can switch perspective as you want without any concern.

ChibiStudio comes with two separate perspectives: C/C++ and Debug. If the on first run your do not have C/C++ and Debug perspectives on the top right corner most likely you haven’t uninstalled the antivirus or you haven’t updated 7zip: the extraction has been affected by this.

ChibiStudio perspectives
A close look to ChibiStudio perspectives. On the left the C/C++ perspective, on the right the Debug perspective.

The two perspectives reflect the way which is split the code development process. Code editing is only a phase of the whole development process: having a compiling code it does not mean it is working as expected. We are talking about functional behavior here. So, the whole development process could be split into two specific parts that are two specific moments of the development process:

  1. The software development, in other words that process related to new project creation, code editing, compiling and resolution of errors and warnings. The perspective C/C++ is oriented to this part and you can figure out this because the largest amount of workbench area is dedicated to text editor area.
  2. The debugging, in other words that moment related to testing the functionality of our code, detection of unexpected behavior or evaluation of software performances and consistency. The perspective Debug is oriented to this phase and it offers a lot of additional windows to explore code, memory and variables or to evaluate an expression, connect terminal and so on.

First launch

The Project explorer in ChibiStudio 20

At first launch, ChibiStudio usually shows a welcome window: just close it. You should be now in C/C++ perspective. The editor window is the largest windows in the middle of the workbench and should be empty. On the right, there is the Project Explorer which usually contains all the imported projects.

If you have downloaded ChibiStudio Preview 20, you will start in the User Workspace and the project explore should contain only two dummy projects representing the documentation and the tools of our toolchain as shown in Fig. 5.

Projects folders
Some ChibiOS projects

The best way to proceed at this point is to import a ready to use demo. The demos we need to import are under the folder C:\ChibiStudio\chibios182\demos\STM32. This is true because we are going to use ChibiOS 182 but there are similar folders also under ChibiOS 176 and ChibiOS Trunk directories.

In the demos\STM32 directory there are a lot of folders each of which represent a standalone project. Each project is named following the same pattern KERNEL-MCU-BOARD. As example, RT-STM32F207ZG-NUCLEO144 is a demo based on ChibiOS/RT for STM32 Nucleo F207ZG, a Nucleo-144  equipped with STM32F207ZG and it works on this specific development kit.

Importing an existing project

The next step is to import a demo for the development board you are going to use. Almost every official STM32 Discovery and STM32 Nucleo boards are supported. Since I will use both STM32 Nucleo F401RE and STM32F3 Discovery kit, I will import both RT-STM32F401RE-NUCLEO64 and RT-STM32F303-DISCOVERY.

The steps required to import an existing demo are:

  1. Select File->Import from the menu;
  2. In the newly prompted window select Existing project into workspace and press Next;
  3. Select Root directory: “C:\ChibiStudio\chibios182\demos\STM32″;
  4. Check all the project you want to import and press Finish.

The following video has been done with ChibiStudio Preview 19. If you are using ChibiStudio Preview 20 things are almost the same. The difference is that the latest version of ChibiOS is 182 thus we have to select a different demo root (“C:\ChibiStudio\chibios182\demos\STM32” instead of “C:\ChibiStudio\chibios182\demos\STM32”).

This argumentation will be more valid when a newer version of ChibiStudio will be available. It is always a good idea to use demos from the latest stable version of ChibiOS and many users are even working with Trunk. Note also that in the following video we are importing a demo named RT-STM32F303-DISCOVERY-REVC which in ChibiOS182 have been merged with RT-STM32F303-DISCOVERY (thus in case you are using F3 Discovery import this one).

Handle imported projects

At this point, the Project Explorer should contain one or more additional projects according to how many projects you have imported.

In Eclipse, a project is a blue folder containing files, links and subfolders and it actually is mirrored to a real folder. As example, the project RT-STM32F401RE-NUCLEO64 is mirrored to the directory “C:\ChibiStudio\chibios182\demos\STM32\RT-STM32F401RE-NUCLEO64\”. To be able to explore a project in Eclipse it should be open. You can open a project right clicking on it and selecting Open Project.

In Eclipse a project could be open or closed right clicking on it and choosing the proper entry from the menu. A project shows its resources only when is open. To avoid confusion, it is a good idea to work keeping all the projects closed except the one you are working with. It is possible to close all the project except one right clicking on the one you want keep open and choosing Close Unrelated Projects.

Build and clean

Build folder
the build folder: the result of a successfully make in ChibiStudio

The projects we are going to use are based on makefile: the makefile is a script file which contains a series of directives used by make to build our code. All the projects in ChibiOS come with a complete and ready to use makefile.

It could happen that the makefile has to be edited to customize the build process or include new sources and we will face this problem if necessary. Right now we do not have to edit makefile. Anyway, is interesting to know that if build procedure ends successfully the makefile is designed to create a subfolder named build under the project main folder.

As shown in the figure, the build folder contains the compiled firmware as binary (ch.bin) and as hexadecimal (ch.hex) but also the Executable and Linkable Format file (ch.elf). The ELF contains the executable but also information about how the code is organized in memory and the list of all symbols: this file is required by debugging activities.

To build a project right click on it and select Build Project. Another way is to click on it and press the hammer button in the tool bar. If the procedure ends successfully a new folder into the project will appear: it is named build and contains the output of make process as bin, hex, elf and other formats.

Note that a project could be also cleaned, the clean procedure removes the build. If we do not clean a project, in case of small edits, next build time will be shorter. This because the build folder which contains also some object files.

The object files are a kind of partial output of make process. These files are not rebuilt if Eclipse “thinks” that related sources have not been modified. This reduces the built time in case of small edits.

Rarely could happen that this mechanism fails: in this case, there could be some misalignment between code and binary. In such particular condition, a clean and rebuild will solve any issue. A good idea is to clean and rebuild the project when we do major edits to our code, especially when dealing with makefile or pre-processor directives.

There could be mutiple causes of failure during build of default demos and most common are: your antivirus, an error occured during extraction of ChibiStudio or a misplacement of ChibiStudio main folder.

Flash and run

An important part of software development is the flash and run. This procedure copies the binary into the microcontroller flash memory and starts its execution. The flash and run is automatized in ChibiStudio and involves OpenOCD on the PC side and ST-Link on the Development board side as shown in Fig.1.

OpenOCD is an open source GDB server which offers a programming interface to a hardware debugger. The debugger allows common operations like write/erase flash memories, write/clear RAM memories, set register values, set breakpoints or watchpoints, set program counter, execute the code step by step and so on. From our point of view we can say that:

The debugger is composed by an hardware part (in this case ST-Link Embed Debugger) and a software part (in this case OpenOCD). The debugger could be considered like a bridge between our IDE and the MCU. To perform any debugging operation the first step is to “create this bridge”

Launch tools
ChibiStudio launch tools

There are two buttons which we will use to execute the flash and run: these two buttons are shown in the figure and are the External Tools Menu (Orange) and the Debug Menu (Azure). Actually, we should not press on the button but on the small black arrow beside them: this will open a drop down menu.

To execute the flash and run we have to launch OpenOCD: this could be done from the External Tool Menu (Orange).

Note that, starting from ChibiStudio Preview 20, the menu will appear empty if the already imported project ChibiStudio Tools is not opened.

Starting from ChibiStudio Preview 20, this menu is slightly different and ST-Link launch option have been merged in a unique catch all launch configuration: “OpenOCD on ST-Link (prompts for .cfg target configuration)“.

Prior to ChibiStudio 20 there were up to three different configurations which depending on the version of our ST-Link. This depends on our development board and this information could be found on the development board blister and is reported in the User Manual. From the toolchain point of view this version is no more relevant.

After selecting a voice from that menu a window will prompt: in this window we have to provide a configuration script related to OpenOCD which indicates which board we are using. To do this, we have to point to folder C:\ChibiStudio\tools\openocd\scripts\board and choose the right script. Each STM32 Nucleo has is own script grouped for sub-family so has example st_nucleo_f4.cfg is suitable for STM32 Nucleo F401RE, STM32 Nucleo F410RB, STM32 Nucleo F446RE and so on.

The OpenOCD log
How look the console windows when OpenOCD starts correctly.

By choosing the configuration, OpenOCD attempt to start up and, if this operation has been successful, OpenOCD will recognize the target: in the Console window, we will get the MCU voltage, the number of breakpoints and watchpoints as shown in Fig.9.

From the Debug Menu (Azure in fig. 8), we can now launch the flash and run selecting the proper Launch Configuration. Each project has is own Launch Configuration and we will be able to associate it to the related project because they have the same name. Once we have selected it, Eclipse will build the project (if this has not been already done) and will start the procedure switching automatically to Debug: in this perspective we can press the Resume button to run the code execution as shown in Fig.10.

Debug windows + Resume
The resume button in ChibiStudio. In the debug window is possible to see that OpenOCD is running.


  1. Launch OpenOCD from the External Tool Menu choosing the proper interface (ST-Link in this case);
  2. In the newly open window, select the proper configuration script related to the board in use;
  3. Check that OpenOCD has been started properly looking to the console windows: there should be information about the MCU voltage, the number of breakpoints and watchpoints.
  4. From the Debug Menu, launch the flash and run selecting the proper Launch Configuration;
  5. In the Debug perspective press the Resume button to run the code execution.

In the following video, we are showing the procedure of flash and run on an STM32F3 Discovery.

These videos have been recorded with ChibiStudio Preview 19, all the differences  with newer versions have been pointed out in this article.

Anyway, for quick reference differences are listed below;

  • The demo RT-STM32F303-DISCOVERY-REVC have been merged with RT-STM32F303-DISCOVERY starting from ChibiOS 182,
  • The ST-Link interfaces have been unified starting from ChibiStudio Preview 20. Now to launch OpenOCD on ST-Link you can use the option “OpenOCD on ST-Link (prompts for .cfg target configuration)” regardless of your ST-Link version,
  • To see any entry in the External Tool Menu you shall keep the project ChibiStudio Tools opened.


The same procedure has been repeated also for STM32 Nucleo F401RE just to make you able to spot differences:

The first flash and run procedure is very important to check if you have set up the toolchain correctly. As example, if you are not able to launch OpenOCD maybe there is a problem with ST-Link drivers: in this case check that drivers have been installed correctly and check also that the USB cable has been connected properly using to the proper port: certain Discovery kits have more than a USB port so you have to check that you are using the port marked as ST-Link USB.

If you receive an error while switching on Debug perspective it could be that OpenOCD has not been started properly or that it has lost connection with the target so you have to relaunch it (in debug context the MCU targeted by the debugger is usually called target).

If OpenOCD starts properly, you will be able to read the target voltage, the number of breakpoints and watchpoints

Information about the target will appear in the console windows and this will look like Fig.9. While OpenOCD is running, in the Debug perspective, you will see a related entry as shown in Fig.10. Note that,

You cannot launch OpenOCD twice and you cannot launch the flash and run procedure if OpenOCD is not running. To restart the OpenOCD you have to terminate the first instance.

Resuming the code execution, one or more onboard LEDs on will start to blink. On STM32 Nucleo-64 there is a green LED, in case of STM32 Nucleo-144 there are three colored LEDs which execute a nice light game, in case of STM32F3 Discovery it is even showier since this board has 8 LEDs.

If LEDs blinks you have successfully completed this tutorial and you can jump to the next article. In case of problems, just comment on this article or subscribe to our forum.

In this article, we focused more on the IDE and the basic procedures required by software development. In the next article, we will take a deeper look to default demos focusing more on programming.

Previous and next

This article is part of a series of articles which are meant to be tutorials. I have composed them to be read in sequence. Here the previous and next article of this series:


Replies to Developing on STM32: introducing ChibiStudio

  • hi,

    Great starting article, one observation though…
    Isn’t the case that yy is actually the most significant two digits?
    I mean…it is not the information that changes most often, and…for some reason, for me the most natural order is LittleIndian :P.

    anyhow, if you are interested, and consider this info needs a quick change, there you have the string to search for:

    “yy indicates the release year (less significant two digits) and changes only on major releases;”


    • Hi Victor,
      thanks for posting. I am afraid I am missing the point. We are talking of how the version number has been explained or about the version number itself?

      In the first case, I am just describing how version number works. Let me make this more clearer with an example, if a new release has been delivered on October 2018 with the code-name “Red” than the version number will be 18.10.0 “Red” where ‘1‘ and ‘8‘ are the less significant digits of the year which is 2018. If in November 2018 a new patch will be deliverd with code-name “Azure” the newer version number will be 18.10.1 “Azure” (the year and month are not changing) and so on. The year and month will change on a new major release.

      In the second case, this is just an article. The right place to discuss about this is the Official ChibiOS forum.

      What am I missing?

  • Rocco,

    This is a really great writeup. Nice work – really. This is a tutorial I could have used 2 years ago – Ha!

    Looking forward to your next article on multi-threading..

  • Hi Rocco,
    Very nicely written and explained. Thanks for your efforts.
    I have been starting to learn STM with these articles.
    I have with me a custom board based on STM32F407ZGT6 which I bought from ebay named as RedDragon STM32F407.
    How can I develop code for this board. I mean the leds, switches are on different ports as compared to Discovery.
    How should I go ahead. Please suggest.

    Thanks in anticipation.

    • Hey there,
      you have to create a custom demo with custom board files for you board
      the step would be these:

      1. duplicate a demo for STM32F407 Discovery which is equipped with STM32F407VG
      2. make it compile
      3. go under CHIBIOS/os/hal/boards and duplicate the whole folder ST_STM32F4_DISCOVERY
      4. rename it with a name you prefer (as example RED_DRAGON_F4)
      5. in the project edit your board linked folder location (right click and properties) and link it to the new folder (according to the previous example it would be CHIBIOS\os\hal\boards\RED_DRAGON_F4)
      6. in the project edit your makefile to use the new files instead of the old one (replacing as example this line include $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/ with include $(CHIBIOS)/os/hal/boards/RED_DRAGON_F4/
      7. Enter in the linked folder delete board.c borad.h and
      8. Configure board files and regenerate them following the next video

      Creating custom board files

      Some notes about configuration:

      • Take care to set each unused pin as Input Pull Up.
      • Take care to properly configure debug pins (SWDIO SWDCLK) which on F4 are PA13 and PA14 (Alternate 0).
      • Take care to set at least LED pin as Output Push Pull an Button pin as Input Floating.

      If you are not aware of how to configure GPIO take a look to this article.

      I will write an article about this soon.

  • Hi.
    Thanks a lot for your detailed reply.
    Is there not a simple way of doing this. I have read about ST CubeMx. I am not sure, but I read it can generate the files directly for specific micro.
    Is it possible use these generated files with Chibistudio so as to create everything from scratch?

    • The generator creates the whole board.c, board.h and Once you have generated them you can use stand alone in every ChibiOS project. It seems complex but it is quite easy because, in the beginning, you have just to set few PINs plus eventually the external oscillator frequency. The goal should to create a simple demo which blinks a LED. Are you using an external debugger or a simple bootloader?

  • I am using external STLink debugger.
    My first aim is of course to blink the Leds and to read the switches.
    But as I checked with STCubeMx we can initialize all the peripherals as we want but with the duplicating approach we will be duplicating only discovery functions.
    I will try the duplicate method for my first project and then would love to try CubeMx.
    Thanks for your support.

  • As Linux developer I really hate all this stuff related setting up the development environment, learning how it works for a given board, installing IDES… and repeating all that process for each board I work with. I am developing for a STM32 platform using the gcc-arm-none-eabi, libnewlib-arm-none-eabi and gdb-arm-none-eabi packages from my Ubuntu 16.04 LTS. I load firmware to the board using dfu-util. This is a more portable and easy to install environment, even easier to maintain documentation updated. Anyway, all the documentation is really very well explained and I want to read all your posts for a better understanding of Chibios and STM32 platforms. Thanks for sharing!! 🙂

    • Yeah, we know that this is pity for a linux developer but here we are trying to address all kinds of problems especially for windows user which are not used to command line and related. Thanks for you feedback.

  • HI! Thanks for answer my question. two quick question I am using ChibiOS studio preview 20 and my External Tools Menu (Orange) doesn’t have three different configurations which was depending on the version of our ST-Link but “OpenOCD on STLink” and “OpenOCD on ICDI” and “OpenOCD no interface” so is this normal? or not If is not How do I fix it. by the way I am using ST-LINK V2. that is one number two In your article the development board is STM32 Discovery but I don’t have it I only have maplemini and I also saw that you demo folder have corresponding demo and of course I have succeed to compile it but due to the OpenOCD problem I can not download it also I do not know which configuration script I should have can you help me thank you!!!!!

    • Hello,
      question one: starting from ChibiStudio Preview 20 the external tools menu is slight changed. Please re-read paragraph 4.6

      question two: at a quick read mapple mini has a F103 with no onboard stlink. You have to use an external debugger to use openocd. Mi suggestion is to switch to a STM32 Nucleo-32 which already includes the ST-Link. Even more I would use and STM32F3 more than an STM32F1 which is obsolete. (NUCLEO-F303K8)

      Note that even if I usually reply to every comment this is not the better place to get support. I suggest you to visit


Leave a Reply