Today: set up your toolchain

Setting up Firmware Toolchain


The aconno firmware codebase is highly configurable using the aconno Sensorics app.
Still, you might want to make some changes to it. For that, you will need some tools aka toolchain: compiler, editor, Nordic’s SDK (Software Development Kit),  the aconno codebase and something to transfer the code to your device, for example, a JLink or aconno programmer.

We recommend following this tutorial carefully step by step in order to set up an environment that will enable you to edit, compile and flash aconno projects.

First things first: The Compiler

In order to translate the source code into a hex file (hex file is a special binary format that your microprocessor understands- zeros and ones), you need to use a special program – the compiler. More about compilers can be found here.

Here at aconno, we use GNU GCC arm-none-eabi-gcc compiler for the cross-compiling process. Since it’s cross-compiling, you can use either Windows, MacOS or Linux based operating systems.

On Windows:

The installation process on Windows is easy. First download the software package for your platform here: Windows source and then execute the exe file and set the PATH variable.

On Linux:

Linux users are used to the apt-get tool for convenient installations of software packages but not here.

For the compiler needed it’s better not to use apt-get because the repository does not contain a stable version and it’s not updated. So you need to go for the old-style way, manually.

You can find a stable version here.

And here is the detailed installation tutorial.

Basic installation steps are shown below:

  1. Open terminal
  2. Make “opt” folder and extract downloaded compiler there
    $ tar xjf ~/Downloads/gcc-arm-none-eabi-version
  3. Change access rights for the files
    $ chmod -R -w gcc-arm-none-eabi-version
  4. After that, you want to add the toolchain path to the system/user path so you can call it from the command line without having to export variables every time you want to develop. To keep this after every restart, put it in the path on Windows, on Linux add:
    $ export PATH="$PATH:$HOME/opt/gcc-arm-none-eabi-VERSION/bin"

    To your ~/.bashrc file.

aconno codebase

The aconno codebase consists of many libraries developed by our programmers to support all the sensors that are used on our products. Together with libraries, there are also finished firmware projects related to our hardware products. For example, in our codebase, you can find firmware support for acnSENSA, acnRANGE, etc. aconno products are based on Nordic Semiconductors nRF528xx chips thus we use their SDK (Software Development Kit) as a base point for our projects. More info, APIs and examples can be found here.

The Firmware of our products is based on the RTOS (Real-Time Operating System) called freeRTOS thus some modifications are made on official Nordic SDK to fit our requirements. The modified version is part of our codebase and the source can be found here:


To make modifications to any of our projects, you need to have a source code of aconno’s version of Nordic SDK located locally on your machine you are cross-compiling on. The location of the SDK root map is not arbitrary. The aconno SDK should be located in the same folder as a project you want to work on.

The following folder tree demonstrates that scenario:

^---|---- Source
^-----------|---- main.cpp
^---|---- aconnoBLE
^---|---- aconnoConfig
^---|---- Components

Therefore, to prepare a modified version of Nordic SDK for use with aconno codebase:

  1. Clone (default to the same folder, where the projects will be loaded to)
  2. Set nRF5_SDK_"15.2.0/components/toolchain/gcc/MakeFile.posix" settings, it contains the path and prefix of the gcc arm compiler

The build system, it’s all about make

To translate C/C++ source code to hex file for your microprocessor, you will need to compile it. You could do it manually file by file if you had a lot of time, but please do not do that. Let the machine do the boring job for you – use one of the build system programs. We use and recommend the ‘make’ program. You can find a good tutorial about it here. It basically is fed with an instruction set on what to compile, where to find it and where to put, like a cooking recipe for nerds, and it saves a lot of time.

To build aconno project:

  1. Install nRF command line tools (also include J-link software in Windows installer)
  2. Install J-Link Software and Documentation Pack
  3. In terminal, navigate to your projects directory
  4. Run the following command to start a make script
    $ make all

The result is stored into acnProject/build/_build map. The command will compile all the source files and make one single hex file from it. It will then search for the SoftDevice (hex file that allows you to use BLE part of the nRF chip) and merge its hex with your application into one hex file. The result is a merged hex file. Next, the script will try to flash that hex file. If a Segger is connected to the PC and the module and ONE power supply is active (Segger OR battery!) it will connect, erase and then flash.
Start JLinkRTTClient to see the log output.

All open-sourced aconno projects and libraries can be found here.

Change the code, use an Editor

Now that you learn how to compile the source code into a usable hex you can compile yourself a firmware, great huh. It would be even cooler if we changed some of the code to fit the requirements.
To change the source we need any software that can change the source, so you could even do it with VI but then you would need to know how to exit it.
Today we have more comfortable tools then just a pure text editor, we have IDEs.

An IDE brings you the comfort of having a debugger, a C++ checker, automated build systems, automated flashing, faster code browsing, an overview function usage and tons of other useful functions.

We recommend the use of these IDEs: Visual Studio Code, free and light, CLion, a C++ monster, best you can get, Keil, old industry standard (we do not really recommend this, it’s just listed as everybody uses it without knowing why) and Embedded Studio by Segger.

Here we will showcase you the installation and configuration of the Visual Studio Code if you would like to use another IDE either RTFM or wait for somebody of us to find a free time to write a document about it, but seriously, the net is full of such docs, ask Mr. Google.

Visual Studio Code editor

At aconno, we use the VS Code editor. You could ask why we do not use the well known Keil editor… Well, VSCode editor is equipped with advanced features such as code completion, static code analysis, black background (dark theme is super important) and tons of other free add-ons available. Here’re configuration steps to install the editor together with ARM development support:

  1. Install Visual Studio Code
  2. Install Visual Studio Code Cortex-Debug from marus25 via Extensions
  3. Clone the FreeRTOS project
  4. Set SDK_ROOT in {projectDir}/build/Makefile to where you cloned nRF5_SDK_15.2.0 (should already be the proper relative path)
  5. Get nRF52 SoftDevice
  6. Within projects .vscode folder create tasks.json and paste the code from below
  7. Within projects .vscode folder create launch.json and paste and paste the code from below
  8. Within projects .vscode folder modify existing c_cpp_properties.json to look like the example below, then add in correct paths for your system
  9. Start JLinkRTTClient for serial output, it will automatically connect with the debugger
  10. Press F5 in Visual Studio Code for debugging


 // See
   // for the documentation about the tasks.json format
   "version": "2.0.0",
   "tasks": [
           "label": "all",
           "dependsOn": "compile_erase_merge",
           "type": "shell",
           "linux": {
               "command": "cd ${workspaceFolder}; make all;"
           "windows": {
               "command": "cd ${workspaceFolder}; make all;"
   "presentation": {
               "echo": true,
               "reveal": "always",
               "focus": false,
               "panel": "shared"
           "group": {
               "kind": "build",
               "isDefault": true


   // Use IntelliSense to learn about possible attributes.
   // Hover to view descriptions of existing attributes.
   // For more information, visit:
   "version": "0.2.0",
   "configurations": [
           "name": "Cortex Debug",
           "cwd": "${workspaceRoot}",
           "windows": {
               "executable": ".\_build\nrf52832_xxaa.out"
           "linux": {
               "executable": "./_build/nrf52832_xxaa.out"
           "request": "launch",
           "type": "cortex-debug",
           "servertype": "jlink",
           "device": "nRF52832_xxAA",
           "interface": "swd",
           "ipAddress": null,
           "serialNumber": null,
           "preLaunchTask": "all",

C_cpp_properties.json (pay attention to compiler Path!)

"configurations": [
       "name": "Linux",
       "includePath": [
           <nrf sdk path>,
           <freeRTOS path>,,
       "defines": [],
       "compilerPath": “whereever your embedded compiler is”,
       "cStandard": "c11",
       "cppStandard": "c++2a",
       "intelliSenseMode": "clang-x64"
"version": 4