Assembling ChibiStudio from scratch

About

Recently I had to assemble ChibiStudio for Windows from scratch and I decided to write down a simple to-do list to be consistent over time. Locking back to the list, it was so detailed I start to think about an article to share this experience and enable everyone to assembly its own environment and maybe get feedback from experts out there and improve our process.

Premise

The need for an IDE

ChibiStudio was an idea by Giovanni (the creator of ChibiOS) to enable the community to easily ramp-up with ChibiOS. It’s basically an ensemble of free and open-source software and some custom configurations.

When I had to take over this process I was pointed to the “Elder Scroll“, an article from the old wiki of chibios.org written in 2008 and later updated in 2012. Even if aged, the article still provides some references.

The path constraint

If you ever installed ChibiStudio on Windows, you’ll surely remember that you need to extract it having its root folder located at C:\ChibiStudio. This constraint comes from some hard-coded configuration in the Eclipse file that cannot be modified programmatically: for some of them, you need to do some specific procedure from the Eclipse’s GUI.

If you are going to create your own ChibiStudio setup decide the location of your toolchain before starting the procedure because would be complicated to relocate it after. from here and out we will refer to this location as [ChibiStudio root]

A small side note, I actually created a semi-automatic mechanism that allows relocating your ChibiStudio setup but I will talk about that in another How-to.

Let’s start

Eclipse installation

ChibiStudio is built starting from Eclipse IDE for Java Developers subsequently extended with the C/C++ Development Tools. The Java version comes with some features that ChibiStudio uses to generate the board files. Picking up the version for C/C++ Developers you need to install and configure more things.

Nowadays Eclipse comes with an installer we strongly discourage in this case because the setup is not portable. My suggestion is to pick up the package from here.

At the moment the latest version of ChibiStudio is 2020-04 built on top of Eclipse IDE 2020-03 for Java Developers 64-bit.

Depending on the version of Eclipse you will need Java Runtime 32-bit or 64-bit

Extract Eclipse in the directory [ChibiStudio root]/eclipse

Installing additional packages

Launch eclipse from [ChibiStudio root]/eclipse/eclipse.exe. At the first launch, he will ask about a workspace: it’s time to prepare things for a later step: choose the folder of your final workspace and check “Use this as the default and to not ask again”

Creating the first workspace
Creating the first workspace

In my case, I am preparing the Workspace User that would be later finalized and duplicated to create all the additional workspaces released with ChibiStudio. The next step is to install all the required packages to Eclipse.

Go in the dropdown menu Help -> Install new Software

Install new software window in Eclipse
Install new software window in Eclipse

Select the repository associated with your release (in my case 2020-03 – http://download.eclipse.org/releases/2020-03) and install the following packages:

  • Programming Languages -> C/C++ Development Tools
  • General Purpose Tools -> TM Terminal
  • General Purpose Tools -> TM Terminal Serial Connector Extensions
  • Mobile and Device Development -> C/C++ GDB Hardware Debugging
  • Mobile and Device Development -> C/C++ Memory View Enhancements
  • Web, XML, Java EE and OSGi Enterprise Development -> Eclipse XSL Developer Tools

You do not need to restart Eclipse every time. We will do a single restart in the end!

As we are using ChibiStudio to prepare even the ChibiOS Debug View plugin we use to install another plugin

From The Eclipse Project Updates – http://download.eclipse.org/eclipse/updates/4.15 install

  • Eclipse Plugin Development Tools -> Eclipse Plug-in Development Environment

Additional things are required from external repositories. Is it possible to add repositories clicking on Add…

Add http://download.jboss.org/jbosstools/neon/stable/updates and install

  • JBoss Application Development -> FreeMarker IDE

Add http://chibios.org/eclipse/chibistudio_new and install

  • ChibiStudio Eclipse Components -> ChibiOS Eclipse Tools

Add http://embsysregview.sourceforge.net/update and install

  • embsysregview -> Embedded System Register View (SFR)
  • embsysregview -> EmbSysRegView Data

If you plan to relocate your IDE, I suggest you install from the MarketPlace

  • ProjectLocationUpdater

When you’ve done close Eclipse.

Tools preparation

The next step is to set-up the tool folder. Create a folder [ChibiStudio root]/tools.

Adding GCC for ARM

We usually add the latest version of GCC for ARM from here under the folder [ChibiStudio root]/tools/GNU Tools ARM Embedded/v.v YYYYqQ where

  • v.v is the release version (e.g. 9.0)
  • YYYY it the release year (e.g. 2019)
  • qQ is the release quarter (e.g. q4)

In the past, it happened that the latest version of GCC suffered some bug on some specific architecture. So we usually prefer to bring in together with the latest version even the  version we largely used in the previous release of ChibiStudio. For example, ChibiStudio 2020-04 comes with 3 GCC for ARM:

  • 5.4 2016q3
  • 7.0 2017q4
  • 9.0 2019q4

For every version of GCC you need to do a small edit: copy .\bin\arm-none-eabi-gcc-x.x.x.exe as .\arm-none-eabi\bin\gcc.exe

Adding the gnutools

This could be tricky because there is not a simple way to list all the bin utils you need. The suggested way is to copy it from ChibiStudio or to add the step by step every time that an error pops out. We use to pick them from MinGW\binutils and MinGW\msys

These tools should be placed under [ChibiStudio root]/tools/gnutools/bin. Here the list of the tools added to the latest version of ChibiStudio

Adding the OpenOCD

Download the latest version of OpenOCD that I periodically build from the download page of this website or eventually build your own looking at Building OpenOCD under Windows using MSYS2.

Add OpenOCD under [ChibiStudio root]/tools/openocd checking that openocd.exe is located at [ChibiStudio root]/tools/openocd/bin/openocd.exe

Adding ChibiOS

Add the latest stable version of ChibiOS. You can download it from the ChibiOS official release page on OSDN or directly check-out from the SVN repository. There is a stable branch for each release. For example, the branch of ChibiOS 20.3.x is at https://svn.osdn.net/svnroot/chibios/branches/stable_20.3.x.

We usually add the latest stable releases (the zip file instead of the SVN repo) and the latest snapshot of the trunk from https://svn.osdn.net/svnroot/chibios/trunk. For every ChibiOS release added we create an additional workspace.

Creating the launchers

For every GCC version, we need to create a launcher. The launcher is a batch file that temporarily sets some variable

Configuring the first Workspace

The next step is about configuring our workspace and test our setup. Let’s launch ChibiStudio through the launcher. This will configure the environment variables and make the IDE ready to perform the basic operations.

All the configurations we are going to apply in the next steps will be stored into the metadata of the workspace.

Here the things to do

  • add the perspectives C and Debug removing Java clicking Open perspective in the top right corner
  • disable all the Code Analysis options in Preferences -> C/C++ -> Code Analysis -> (Disable all options)
  • import the ChibiOS preferences in Preferences -> C/C++ -> Code Style -> Formatter (you’ll find the list in the ChibiOS style guide or at the end of this list)
  • in the C/C++ perspective
    • Move the view of project explore from hierarchical to flat in the three-dot menu -> Projects Presentation -> Flat
    • Save the perspective as  “C/C++” replacing the existing one
  • in the debug perspective
    • close the project explorer
    • move the Debug window on top of the Editor
    • close the Debug Shell
    • from Windows -> Show View open Registers, Memory, Disassembly, Terminal, EmbSysReg (Other -> Debug) and ChibiOS Debug View (Other -> ChibiOS\RT)
    • move Registers in the top left window
    • move Disassembly in the top left window splitting it horizontally
    • save the perspective as “Debug” replacing the existing one
  • Set C/C++ perspective as the default in Preferences -> General -> Perspectives
  • Import the demos you need from the ChibiOS release you intend to use within this workspace (they are under [chibios]/demos, [chibios]/testhal and [chibios]/testex)
  • Import ChibiOS tools that are located in under [chibios]/tools
  • In Preferences -> General -> Workspace you need to add two linked resource
    • CHIBIOS  pointing to the release in use (e.g. C:\ChbiStudio\chibios203)
    • CHIBISTUDIO pointing to you installation root (e.g. C:\ChbiStudio)

ChibiOS Style XML

At this point, your setup should be ready to go.

Additional operation

We use to perform some optional additional operations

  • We change the name of the workspace with the name of the current ChibiStudio version and the version of ChibiOS in use. This in Preferences -> General -> Workspace:
    • Enable Show Name (e.g. “ChibiStudio 2020-04 – ChibiOS 20.3.x”)
    • Enable Show full workspace path
    • Disable Show Product Name
  • Copy the Documents Project from an old workspace
  • Copy and update the readme (C:/ChibiStudio/readme.txt)
  • Import Documents

After testing the first workspace we also duplicate it for every release we have in ChibiStudio. Usually, we create the Workspace User first as it is the more generic and then we duplicate it 3 times (e.g. workspace203, workspace191, workspace_trunk)
For each workspace:

  • import the demos from the right release
  • update the linked resources changing CHIBIOS
  • Update the name indicating the release of ChibiOS in use

Replies to Assembling ChibiStudio from scratch

  • Hello Sir,
    I wanted to design small application on Chibios so to get knowledge of it. I am using Ubuntu so could you please help me how configure it on Ubuntu. What are the tools I required for configuration.
    Thanks in advance!

Leave a Reply