The Cascoda SDK takes advantage of open source tools, such as Git, GCC, CMake and Doxygen. It is possible to build the Cascoda SDK natively, or cross compile for embedded platforms. Several different compilers and targets are supported, and this process is driven by CMake. CMake is the build tool used for configuring the build system for a given compiler and target, and also selecting build options.
To build the Cascoda SDK, first configure your environment as detailed here, then follow the instructions below:
Either type, or copy and paste the following into a bash terminal:
# Make a working directory (this can be anywhere, named anything)
mkdir cascoda
cd cascoda
# Clone the Cascoda SDK
git clone https://github.com/Cascoda/cascoda-sdk.git
# Create a build directory for native build, and build the SDK
mkdir sdk-posix
cd sdk-posix
cmake ../cascoda-sdk
make -j12
# Built for current system! To change configuration, the 'ccmake .' command can be used
#Go back to working directory
cd ..
#Now cross compile for the Chili2
mkdir sdk-chili2
cd sdk-chili2
cmake ../cascoda-sdk -DCMAKE_TOOLCHAIN_FILE="toolchain/arm_gcc_m2351.cmake"
make -j12
# Built for Chili 2! To change configuration, the 'ccmake .' command can be used
Constructed directory layout:
cascoda #Working directory
|-cascoda-sdk # Source directory, shared by both build directories. see 'Directory Layout' section below
|-sdk-posix # Native build directory of SDK.
| |-lib # Static libraries are built in here for native use.
| |-bin # Executables are built in here for native use. See 'hosted applications' below
|-sdk-chili2 # Chili2 build directory of SDK
| |-lib # Static libraries are built in here for Chili2 use.
| |-bin # Firmware binaries are built in here for the Chili2. See 'Embedded applications' section.
Either type, or copy and paste the following into a git bash terminal:
(Make sure that the path is set up correctly, as explained in the development setup guide.)
# Make a working directory (this can be anywhere, named anything)
mkdir cascoda
cd cascoda
# Clone the Cascoda SDK (This must be done in git bash)
git clone https://github.com/Cascoda/cascoda-sdk.git
# After cloning the repo as above, run the following commands in powershell/cmd:
# Create a build directory for native build, and build the SDK
mkdir sdk-win
cd sdk-win
cmake.exe ../cascoda-sdk -G "MinGW Makefiles"
mingw32-make.exe -j8
# Built for current system! To change configuration, the 'cmake-gui.exe .' command can be used
#Go back to working directory
cd ..
#Now cross compile for the Chili2
mkdir sdk-chili2
cd sdk-chili2
cmake.exe ../cascoda-sdk -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="toolchain/arm_gcc_m2351.cmake"
mingw32-make.exe -j8
# Built for Chili 2! To change configuration, the 'cmake-gui.exe .' command can be used
Constructed directory layout:
cascoda #Working directory
|-cascoda-sdk # Source directory, shared by both build directories. see 'Directory Layout' section below
|-sdk-win # Native build directory of SDK.
| |-lib # Static libraries are built in here for native use.
| |-bin # Executables are built in here for native use. See 'hosted applications' below
|-sdk-chili2 # Chili2 build directory of SDK
| |-lib # Static libraries are built in here for Chili2 use.
| |-bin # Firmware binaries are built in here for the Chili2. See 'Embedded applications' section.
Libraries will be built into the lib/
directory, while application binaries will be built into the bin/
directory. For the Chili platforms, both elf format and binary .bin format files will be created.
These can then be flashed to the device by following the flashing guide.
For a description of the different built binaries & executables, see the embedded applications section for chili platforms, and the hosted applications for Windows/Linux/macOS.
In order to compile for the Chili 1, or to use a different compiler, the CMAKE_TOOLCHAIN_FILE argument can be pointed to a different configuration file in the toolchain directory.
If you are looking to test existing functionality of the Cascoda SDK, start here. This is a list of the demos within the Cascoda SDK, alongside a short description of what each of them do.
Binary Name | Description |
---|---|
ot-cli | The OpenThread command line interface running on a Chili. Interfaces with the Cascoda sensordemo application layer. Works with the serial-adapter POSIX application. More information. |
ot-cli-lwip | A demonstration of the Lightweight IP Stack running on top of OpenThread. More information. |
ot-cli-lwip-freertos | Same as above, but taking advantage of the POSIX socket API and FreeRTOS. More information. |
ot-cli-actuator | Similar to ot-cli, but also has actuator commands. More information. |
ot-cli-lwm2m | Similar to ot-cli, but with LWM2M client support using wakaama. More information |
Binary Name | Description |
---|---|
ot-sed-thermometer | Sleepy end device that interfaces with the Cascoda sensordemo application layer. Only reports temperature. More information. |
ot-sed-thermometer-freertos | Same as above, but taking advantage of FreeRTOS concurrency features. More information. |
ot-sed-sensorif | Sleepy end device that interfaces with the Cascoda sensordemo application layer. Connects to various I2C and SPI sensors. More information. |
ot-sed-eink-freertos | Display images onto an e-ink screen. The images are transmitted over a Thread network. The system sleeps while idle. Used in conjunction with ot-eink-server. More information. |
Binary Name | Description |
---|---|
ocf-light | Use a Chili as a controller for an OCF-over-Thread smart lightbulb. More information. |
ocf-reed-light | Use a Router Enabled Chili as a controller for an OCF-over-Thread smart lightbulb. |
ocf-sensorif | Use a Chili as a OCF-over-Thread device connected to various I2C and SPI sensors. |
ocf-cli-thermometer | Use a Chili as a OCF-over-Thread smart thermometer. This demo uses the in-built thermometer of the M2351, so no external hardware is required. |
ocf-sleepy-thermometer | Same as above, but the device sleeps between temperature readings. |
ocf-storage-test | Test the flash storage API of Iotivity-Lite. Useful for developers. |
Binary Name | Description |
---|---|
devboard-blinky | Example app demonstrating intrinsic devboard features: LEDs and buttons. More information. |
devboard-click | Example app demonstrating how the devboard can communicate with externally connected peripherals. More information. |
Binary Name | Description |
---|---|
mac-dongle | Use a Chili as a IEEE 802.15.4 MAC dongle, enabling hosted platforms to communicate using this protocol. Used by most POSIX applications. More information. |
eink-test-x-x | Tests the connection between a Chili and a E-Ink display (where x-x is replaced by the size, e.g. 2-9 meaning 2.9 inches) by showing an image. Does not commmunicate over IEEE 802.15.4. More information. |
sensorif-test | Tests the sensorif API by attempting communication with all connected sensors. More information. |
mikrosdk-test | Tests the mikrosdk API by attempting communication with all connected MikroElekronica sensors/actuators. More information. |
pwm-led-dimming | Tests and demonstrates the PWM API. More information. |
mac-tempsense | Legacy temperature demo running directly on top of IEEE 802.15.4 MAC. More information. |
ot-ncp | The OpenThread network co-processor interface running on a Chili. Works with the serial-adapter POSIX application. |
ot-barebone-mtd | Barebones OpenThread demo, designed for the Chili 1. More information. |
ot-barebone-ftd | The FTD version of ot-barebone-mtd. More information. |
chili2-default-secure | The basic secure FreeRTOS & TrustZone binary, containing FreeRTOS secure code and the secure parts of the BSP. More information. |
These applications run on POSIX, Windows or OSX systems. They interface with Chili devices connected by USB or UART. More information..
Binary Name | Description |
---|---|
chilictl | Generic Chili control application allowing listing and flashing of any connected Chili2 devices. More information. |
serial-adapter | Exposes the serial interface of examples such as: ot-cli, ocf-, ot-ncp. More information. |
knx-gen-data | Generate persistent manufacturer data for KNX-IoT Chilis. More information. |
sniffer | Captures raw 802.15.4 traffic. Compatible with WireShark. Requires a mac-dongle Chili to be connected to the host. More information. |
ot-cli-posix-ftd | The OpenThread command line application, running on a host. Requires a mac-dongle Chili to be connected to the host. |
ot-cli-posix-mtd | Same as above, but acts as a Minimal Thread Device. Requires a mac-dongle Chili to be connected to the host. |
ot-ncp-posix | Enable a computer to act as a Thread Border Router. Requires a mac-dongle Chili to be connected to the host. |
ot-eink-server | Server that transmits image files, to be used with the ot-sed-eink-freertos embedded application. Requires a mac-dongle Chili to be connected to the host. More information. |
ot-sensordemo-server | Interfaces with the Cascoda sensordemo application layer. It prints the sensor readings it receives from the network. Requires a mac-dongle Chili to be connected to the host. More information. |
ocfctl | Control application for OCF devices, useful mainly for certification. More information. |
evbme-get | Prints all the EVBME parameters of a connected Chili, including application name, version and joiner credentials. More information. |
security-test | Tests the advanced security mode of the CA-8211. |
stress-test | Requires several mac-dongle Chilis to be connected to the host. Creates heavy 802.15.4 traffic. More information. |
serial-test | Stress test of the serial connection between the host and the connected Chili. Requires a Chili to be connected to the host. More information. |
The Chilis support flashing and debugging via the Segger J-Link using JTAG SWD. When using the GCC toolchain, the SEGGER GDB Server and arm-none-eabi-gdb can be used to flash and debug the Chili. Simply setup the JLink GDB server for the NANO120 (Chili 1) or M2351 (Chili 2) with SWD, then target remote 127.0.0.1:2331
in arm-none-eabi-gdb to connect to it. If debugging is not required, then the Segger J-Flash lite tool can flash plain binary files.
The Chilis can also be debugged with a NuLink Pro. This is a cheaper alternative, but the developer experience is inferior - you cannot flash the Chili from within GDB, and setting & getting to breakpoints is slower.
ca821x-api contains the cross-platform API which abstracts all of the functionality of the CA-8210 and CA-8211. It is required for every project.
baremetal contains the cross-platform baremetal drivers, some example applications, and a set of platform abstractions. The baremetal drivers implement useful, cross-platform functionality, and should be your go-to API when trying to interact with peripherals and outside world.
The platform abstractions (sometimes referred to in the source code as the Board Support Package) are what enables the baremetal drivers to be cross-platform. They provide a set of functions which abstract away the specifics of what platform you are dealing on, such as how to set up the device and how to communicate with peripherals.
While you could use the BSP functions (declared in cascoda_interface.h
) to control the chip from your top-level application, it is a lot easier to rely on the functionality provided by the baremetal drivers, such as the functions in cascoda_time.h
, cascoda_evbme.h
and so on.
docs
contains the guides outlined above.
toolchain
contains the platform configuration files to enable cross compilation for different systems and compilers. These are used to first set up the CMake toolchain for a specific platform, as seen in the Instructions settings. There is extra info on how to compile for different platforms in docs, such as cross compiling for the raspberry pi.
posix contains the Posix-specific drivers and tools, as well as some example applications that can be run from a Linux system.
Useful documents:
cascoda-utils
Contains a cross-platform library of useful utilities, such as tasklets for simple scheduling and hash functions for basic hashing functionality.
openthread
contains the glue configuration to download the openthread repository from https://github.com/Cascoda/openthread, and configure it to be built with the SDK.
etc
contains miscellaneous resources.
Useful CMake target libraries to include:
Target | Description |
---|---|
ca821x-api | The core Cascoda API, including C function representations of all CA-821x functionality. |
cascoda-bm | The baremetal Cascoda Drivers, abstracting away the platform to a common interface, and providing a suite of helper functions. |
cascoda-utils | Cross-platform utility functions. |
ca821x-posix | The posix Cascoda driver interface, supporting USB, UART or SPI communications to a connected Cascoda device |
sensorif | A library containing drivers for interfacing with I2C sensors |
ca821x-openthread-bm-ftd | OpenThread baremetal library for FTDs (Full Thread Devices) |
ca821x-openthread-bm-mtd | OpenThread baremetal library for MTDs (Minimal Thread Devices) |
ca821x-openthread-posix-ftd | OpenThread posix library for FTDs |
ca821x-openthread-posix-mtd | OpenThread posix library for MTDs |
openthread-cli-ftd | OpenThread CLI library for FTDs |
openthread-cli-mtd | OpenThread CLI library for MTDs |
openthread-ncp-ftd | OpenThread NCP library for FTDs |
openthread-ncp-mtd | OpenThread NCP library for MTDs |
freertos | The main FreeRTOS code |