Building a firmware binary with the Thingsquare firmware SDK

The Thingsquare firmware SDK allows developing custom firmware for running on the devices. Custom firmware applications are developed in the C programming language. The SDK can be used both to build firmware for gateways and non-gateway devices.

The SDK is a directory with files that contain all the necessary firmware code, include files, and a set of example C files.

The firmware SDK can be used to create both firmware binaries that can be directly flashed to the board, and firmware images that can be programmed over the air.

To use the SDK, you need to set up an environment and install a few tools. See the documentation on Installation for detailed instructions on this.

SDK directory structure

The SDK directory structure is as follows:

  • examples/
  • include/
  • libs/

The examples/ directory contains starting points for custom firmware applications.
The include/ directory contains header files needed for custom firmware builds. Look here if you are developing your own drivers.
The libs/ directory contains pre-compiled code archives that is the foundation of the firmware. This is used automatically in the build process and you don't need to do anything with this directory.

Build a custom firmware image from the examples

To build a custom firmware from the example directory, go to the examples/ directory and run:

cd examples
make TARGET=thsq-cc1310lp-etsi client-launchpad.bin

This will build a firmware image for the TI CC1310 Launchpad in ETSI (868 MHz) configuration called client-launchpad.bin. This can be flashed to a CC1310 Launchpad board using the SmartRF Flasher 2 tool available from Texas Instruments.

Build a custom firmware image in a user directory

The above method of building an example firmware image is not recommended for development projects.
It's better to separate the SDK from your projects and drivers, to ease version control and updating the SDK.

Instead, if you followed the installation procedure, the installation script will have set up a directory structure such as,

c:\development\sdk
c:\development\projects
c:\development\tools

Thus, copy the contents of the SDK examples/ directory into eg c:\development\projects\sdk-examples\ and update the Makefile to point to the SDK location as follows. Edit the file called Makefile and change the line starting with SDK = into

SDK = ../../sdk/

Note that in the Makefile, the path should use forward-slash (as in Linux), not back-slash (as in Windows), even if you are using a Windows computer.

Now it should be possible to build a custom firmware in the new directory with the command,

make TARGET=thsq-cc1310lp-etsi client-feather.bin

(Note that the value after TARGET= reflects the customer base hardware platform and may need to be changed according to the hardware you are working with.)