To develop with the Cascoda SDK, the development environment must be set up. This is easier on Linux systems and macOS systems, but is also possible on Windows. The core components for development are fairly standard, and based on the GCC toolchain:
Component | Description |
---|---|
gcc/g++ | Compiler for native builds |
cmake | Build system tool for generating & managing build configurations |
make | Build tool to execute the cmake-generated builds |
arm-none-eabi-gcc | Compiler for Chili platform (and other embedded arm devices) |
git | Version Control System for getting latest Cascoda SDK |
gdb | Debugger for analysing executing programs |
clang-tidy | Static analyser for detecting common code problems |
clang-format | Code formatter for consistent code styling |
doxygen | Code documentation tool for generating HTML docs describing code |
plantuml | Diagram generation tool for generating UML diagrams in documentation |
Version Requirements:
It is possible to use alternative tools such as ninja instead of make, or clang instead of gcc, but that is out of scope of this document.
On a recent Debian/Ubuntu distro, you can set up the required development environment in two steps:
First, follow this guide to install the latest version of the Arm GNU Toolchain, which is required for embedded development. *Note: if you already have a version of this that was installed using your linux distribution’s package manager, please follow the guide regardless to re-install the toolchain using the official Arm website. Not doing so has caused issues in the past and is unreliable.*
Second, run the following commands to install the remaining packages necessary:
sudo apt update
sudo apt install git cmake cmake-curses-gui gcc g++ build-essential clang-format-6.0 make libhidapi-dev
#optional
sudo apt install clang-tidy-8 doxygen graphviz ninja-build default-jre
Also optionally download the plantuml jar
In order to not require sudo to access Chili devices over USB, the permissions for cascoda devices should be loosened. This can be done by running the commands:
echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5020", ACTION=="add", MODE="0666"' | sudo tee /etc/udev/rules.d/99-cascoda.rules > /dev/null
sudo udevadm control --reload-rules && sudo udevadm trigger
UART can be used for any posix or Windows serial ports. There are no special requirements for using UART on Windows. However, on posix, in order to use UART, the environment variable CASCODA_UART
must be configured with a list of available UART ports that are connected to a supported Cascoda module. The environment variable should consist of a list of colon separated values, each containing a path to the UART device file and the baud rate to be used.
eg: CASCODA_UART=/dev/ttyS0,115200:/dev/ttyS1,9600:/dev/ttyS2,4000000
For example, on the Raspberry Pi 3 running Raspberry Pi OS, you can set up the UART as follows (this overrides the UART terminal):
# Prevent the UART being used as a Linux terminal, and enable it
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
echo "enable_uart=1" | sudo tee -a /boot/config.txt
# Reboot so changes take effect
sudo reboot
# Then add environment variable
# (warning, will not persist reboots unless you add to a startup script)
export CASCODA_UART=/dev/serial0,1000000
Using Homebrew, you can set up the required development environment with:
brew tap ArmMbed/homebrew-formulae
brew install git cmake gcc g++ arm-none-eabi-gcc llvm@6 make hidapi
#optional
brew install doxygen graphviz ninja openjdk
Also optionally download the plantuml jar
Install:
The simplest way to do this is by installing the Chocolatey Package Manager, by pasting the following into the ADMIN powershell:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Then restart the ADMIN powershell and paste the following:
choco install git -y
choco install cmake -y --installargs 'ADD_CMAKE_TO_PATH=System'
choco install mingw -y
choco install gcc-arm-embedded -y
Note that if git was installed without adding to the PATH, then the build system will not be able to detect the version and will display ‘unknown’. Add the git cmd
directory to PATH using the same method as below to solve this.
Make sure the git cmd
directory, mingw bin
directory, cmake bin
directory, and the arm-none-eabi-gcc bin
directory are added to your PATH environment variable. To add to path, take note of the installation directory during the install process. Then after installation:
bin
directories.The paths of the bin directories can be different from system to system, or version to version, but at the time of writing, they were:
C:\Program Files\CMake\bin
C:\Program Files\Git\cmd
C:\Program Files (x86)\GNU Tools ARM Embedded\8 2018-q4-major\bin
C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin
Optionally install: