DEV Community

wavesnowrider
wavesnowrider

Posted on • Edited on

Build environment setup 2025

Introduction


Base setup

[Development platform] Ubunts LTS 24.04.2
Following options are taken during Ubunts installation to avoid missing package. (Maybe not related with build environment setup)
- Extended selection
- Install third-party software for graphicsand Wi-Fi hardware
- Download and install support for additional media formats
[Hardware] EsasyDIY Ebike display on nRF52840 Nordic USB Dongle.
[Software] EV_Display_Bluetooth_Ant v0.20.0
https://github.com/OpenSourceEBike/ev_display_bluetooth_ant/releases

Install

1. add your user name to dialout group

$ sudo usermod -a -G dialout USER_NAME
$ reboot

2. install VS code

Download *.deb binary from https://code.visualstudio.com/.
$ sudo apt install ./code_1.100.2-1747260578_amd64.deb

Install extentions

  • C/C++ extention: VS-code ask you installing a C++ compiler. Click "Install c C++ Compiler" button.
  • Cortex-Debug extention
  • Task manager extention

3. install open-OCD

$ sudo apt-get install npm
$ sudo npm install -global xpm@latest
$ xpm install --global @xpack-dev-tools/openocd@latest
$ sudo ln -s ~/.local/xPacks/@xpack-dev-tools/openocd/0.11.0-4.1/.content/bin/openocd /usr/bin/openocd

4. install compiler, liblary

$ sudo apt update -y
$ sudo apt-get install gdb-multiarch
$ sudo apt-get install gcc-arm-none-eabi
$ sudo apt-get install binutils-arm-none-eabi
$ sudo apt-get install libnewlib-arm-none-eabi
$ sudo apt-get install make
$ sudo apt-get install srecord

5. install Python3

Install dependencies

$ sudo apt-get install libc6-dev
$ sudo apt-get install zlib1g
$ sudo apt-get install libffi-dev

Install zlib

Download from http://www.zlib.net/
$ tar zxvf zlib-1.3.1.tar.gz
$ ./configure
$ make test
$ sudo make install

Build and install Python3

download Python-3.13.3.tgz from python.org
extract tgz file
$ sudo apt install pkg-config
$ cd ~/Downloads/Python-3.13.3
$ ./configure
$ ./configure --enable-optimizations
$ make
$ make test
$ sudo apt-get install pip
$ sudo make install

6. install nrfutil

$ sudo pip3 install nrfutil
$ pip3 install --upgrade pip

  • [Note] old version of nrfutil is installed by pip3 command. See "Re-install nrfutil" section below.
$ nrfutil.old version
nrfutil version 5.2.0
Enter fullscreen mode Exit fullscreen mode

Build source code

Download "Source code (tar.gz)" from https://github.com/OpenSourceEBike/ev_display_bluetooth_ant/releases
$ tar zxvf EV_Display_Bluetooth_Ant-0.20.0.tar.gz

Open Visual Studio Code
Open folder "EV_Display_Bluetooth_Ant-0.20.0/firmware/display".

Click "Task Manager" icon at left side bar.
You will see scheduled tasks like this:

image.png

Click "Run Task" of one of tasks. Build starts and you will get failed.
image.png


Revise source code

1. include stdint.h

Error says unit8_t is unknown.

./can/MCP2515.h:224:28: error: unknown type name 'uint8_t'
  224 | void MCP2515_RequestToSend(uint8_t instruction);
      |                            ^~~~~~~
Enter fullscreen mode Exit fullscreen mode

Add #include stdint.h at top of target source files.
Target source file:

  • ./include/MCP2515.h
  • ./include/CANSPI.h

Image description

2. replace "#elif" with "#else"

Target source file:

  • ./include/state.h

Image description

3. Uncomment #define DEVELOPMENT

Target source file:

  • ./include/main.h

Image description

If DEVELOPMENT flag is set, initialization screen is skipped which enables you debugging main screen, like button pressing, menu transition and so on.

4. Try build again

$ sh ./make_release.sh

Still got failed with nrfutil errors.
Image description


Re-install nrfutil

1.Download "nrfutil" file

2.Install related tools

$ chmod +x nrfutil

$ ./nrfutil install nrf5sdk-tools
[00:00:09] ###### 100% [Install packages] Install packages
$ ./nrfutil install completion
[00:00:05] ###### 100% [Install packages] Install packages

3. Follow official instruction below:

$ nrfutil --version
nrfutil 8.0.0 (54d8087 2025-01-07)
commit-hash: 54d8087a38b73b6e56942fb1b024b62365f06731
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
build-timestamp: 2025-01-07T14:26:42.070728557Z
classification: nrf-external
Enter fullscreen mode Exit fullscreen mode
  • Install pipenv (maybe not required)

$ sudo apt install pipenv
$ pip install nrfutil


Build again

1. Build on task manager.

  • Click "Clean" on task manager:

Image description

  • Then click " ".

Image description

  • I got .zip file in _build directory.

Image description

2. Get whole release

  • Run script in terminal
    $ cd EV_Display_Bluetooth_Ant-0.20.0/firmware/display
    $ sh ./make_release.sh

  • Success.
    Image description

  • I got whole zip files in release directory.
    Image description

  • Build environment is setup!

(end of article)

Top comments (0)