Assembling ChibiStudio from scratch
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.
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.
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”
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
Select the repository associated with your release (in my case 2020-03 – http://download.eclipse.org/releases/2020-03) and install the following packages:
- 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
- Programming Languages -> C/C++ Development Tools
- Web, XML, Java EE and OSGi Enterprise Development -> Eclipse XML Editor and Tools
- 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
When you’ve done close Eclipse.
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
17.04.2010 06:53 307.712 awk.exe 19.10.2014 23:27 564.224 bash.exe 28.04.2010 09:14 24.064 cat.exe 06.07.2006 20:45 18.349 copying.txt 28.04.2010 09:13 116.736 cp.exe 28.04.2010 09:14 22.016 echo.exe 17.04.2010 05:08 107.520 egrep.exe 17.04.2010 05:08 52.736 fgrep.exe 17.04.2010 04:08 109.568 grep.exe 25.04.2014 10:58 118.784 libgcc_s_dw2-1.dll 25.04.2014 10:58 1.038.350 libiconv-2.dll 25.04.2014 10:58 101.390 libintl-8.dll 21.02.2017 14:03 287.777 make.exe 28.04.2010 09:13 29.696 mkdir.exe 22.11.2012 02:35 821.760 msys-1.0.dll 29.01.2010 03:32 10.240 msys-crypt-0.dll 29.10.2011 20:18 1.019.904 msys-iconv-2.dll 29.10.2011 13:22 48.128 msys-intl-8.dll 27.04.2011 06:23 1.156.608 msys-perl5_8.dll 02.02.2010 00:29 72.192 msys-regex-1.dll 01.02.2010 03:44 36.864 msys-termcap-0.dll 28.04.2010 08:13 125.440 mv.exe 27.04.2011 07:23 26.112 perl.exe 28.04.2010 09:13 100.352 rm.exe 28.04.2010 09:13 21.504 rmdir.exe 14.04.2010 15:56 134.144 sed.exe 19.10.2014 23:27 564.224 sh.exe 28.04.2010 08:14 21.504 sleep.exe 28.04.2010 09:14 21.504 tee.exe 26.04.2020 10:55 295 test.sh 28.04.2010 09:13 45.056 touch.exe
Adding the OpenOCD
Add OpenOCD under [ChibiStudio root]/tools/openocd checking that openocd.exe is located at [ChibiStudio root]/tools/openocd/bin/openocd.exe
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
@echo off set CHIBISTUDIO=%~dp0 set FMPP=%CHIBISTUDIO%\tools\fmpp\bin\fmpp.bat set BASH=%CHIBISTUDIO%\tools\gnutools\bin\bash.exe set OPENOCD=%CHIBISTUDIO%\tools\openocd\bin\openocd.exe set PATH=%CHIBISTUDIO%\tools\gnutools\bin;%PATH% set PATH=%CHIBISTUDIO%\tools\openocd\bin;%PATH% set PATH=%CHIBISTUDIO%\tools\GNU Tools ARM Embedded\9.0 2019q4\arm-none-eabi\bin;%PATH% set PATH=%CHIBISTUDIO%\tools\GNU Tools ARM Embedded\9.0 2019q4\bin;%PATH% cd eclipse start eclipse.exe
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
- import the ChibiOS Style XML in Preferences > C/C++ > Code Style > Formatter
- in the C/C++ perspective
- Change the view of Project Explorer 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 (under Other > Debug) and ChibiOS Debug View (under 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 check the box Refresh using native hooks or polling
- In Preferences > General > Workspace you need to add two linked resource
- CHIBIOS pointing to the release in use (e.g. C:\ChibiStudio\chibios203)
- CHIBISTUDIO pointing to you installation root (e.g. C:\ChibiStudio)
- In Preferences > C/C++ > Editor uncheck Report problems as you type.
At this point, your setup should be ready to go.
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