Introduction
- Great article by casainho of TSDZ2 EasyDIY OpenSource Ebike display.
- Since it was as of 2022 casainho wrote instruction on Github, some of them are out of date. This article shows actual command lines which is for instllation of build environment.
- Reference: https://opensourceebike.github.io/easy_diy_display_ebike_display/development/development-flash_and_debug_firmware.html
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
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:
Click "Run Task" of one of tasks. Build starts and you will get failed.
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);
| ^~~~~~~
Add #include stdint.h at top of target source files.
Target source file:
- ./include/MCP2515.h
- ./include/CANSPI.h
2. replace "#elif" with "#else"
Target source file:
- ./include/state.h
3. Uncomment #define DEVELOPMENT
Target source file:
- ./include/main.h
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.
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:
https://docs.nordicsemi.com/bundle/nrfutil/page/guides/installing.html
Install libusb
$ sudo apt install libusb-1.0-0Download the latest .deb file here:
https://github.com/NordicSemiconductor/nrf-udev/releasesInstall deb file
$ sudo dpkg -i nrf-udev_1.0.1-all.debDownload nrfutil binary here:
https://www.nordicsemi.com/Products/Development-tools/nRF-UtilAdd execute attribute and move to bin directory
$ chmod +x nrfutil
$ sudo mv /usr/local/bin/nrfutil /usr/local/bin/nrfutil.old
$ sudo move nrfutil /usr/local/bin/Expected version is below (or higher).
$ 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
- Install pipenv (maybe not required)
$ sudo apt install pipenv
$ pip install nrfutil
Build again
1. Build on task manager.
- Click "Clean" on task manager:
- Then click " ".
- I got .zip file in _build directory.
2. Get whole release
Run script in terminal
$ cd EV_Display_Bluetooth_Ant-0.20.0/firmware/display
$ sh ./make_release.shBuild environment is setup!
(end of article)
Top comments (0)