libtropic
C library for TROPIC01 chip
|
Welcome to the documentation page for libtropic, the official C library for TROPIC01 chip. This guide will help you get started with building applications using TROPIC01 and libtropic.
For detailed information about the libtropic library architecture and development, please refer to the For contributors
section.
TROPIC01
is currently available in three forms:
Samples can be requested through our website. Visit tropicsquare.com/tropic01-samples for more info.
PCB modules with TROPIC01 engineering samples
are available as Secure Tropic Click through our external partner MIKROE's webshop.
To order, visit mikroe.com.
You can interface Secure Tropic Click with your platform over SPI bus using a breadboard or wires. Additional conversion PCBs are available on the MIKROE website, including an arduino form factor extension board.
Designed for evaluation on systems where SPI is not available.
Please visit tropicsquare.com, sign-up and check availability.
Check out examples/
folder, it contains a few examples of how libtropic functions might be used.
There is also folder tests/functional/
with code used internally for testing.
Functions from examples/
and tests/functional/
are not compiled into libtropic library by default. In order to have access to all examples functions from parent project, special switch must be passed to compilation.
The purpose of this is to control inclusion of code, because example code could occupy some unnecessary space and it is not needed anymore once users get familiar with library - then this code can be switched off.
Examples code can be enabled by:
-DLT_BUILD_EXAMPLES=1
during parent project compilation, orset(LT_BUILD_EXAMPLES ON)
Functional tests code can be enabled by:
-DLT_BUILD_TESTS=1
during parent project compilation, orset(LT_BUILD_TESTS ON)
Both examples and functional tests require SH0 private key to establish a secure session with TROPIC01. CMake variable LT_SH0_PRIV_PATH
is used for that and its default value is set to path to the SH0 private key from the currently used lab_batch_package
, found in libtropic/provisioning_data/<lab_batch_package_directory>/sh0_key_pair/
. Naturally, it can be overridden with another path to SH0 private key. CMake loads the key raw data and saves it to sh0priv
C array, defined in include/libtropic_functional_tests.h
or include/libtropic_examples.h
. The variable LT_SH0_PRIV_PATH
is not expected to be used in user applications.
Standalone example projects are ready to be compiled and used as a starting point to build some other applications.
The consist of two parts:
For more info check one of projects for platforms of our choice:
Integration example for STM32 is available through this repository and contains code for:
For Unix based examples we have cmd line utility
called libtropic-util.
This is Unix program to test API calls against TROPIC01, works for:
How can you add libtropic to your existing project?
At first please read all chapters in this page so you get familiar with how library works.
Then we recommend to add libtropic as a submodule. Libtropic uses CMAKE build system, therefore it could be added to compilation of existing CMake projects in a following way:
Please note that exact CMake calls depend on configuration of a project into which libtropic is being added. For more inspiration have a look into standalone example projects.
In this case you have to add list of all libtropic *.c and *.h files manually to your makefile and then for all CMake ON option (located in libtropic's CMakeFile.txt) you define -D switch in your makefile.
Then do the same for files used in trezor_crypto.
Libtropic is configurable with CMake options. They are either passed from parent project's CMakeLists.txt, or over prompt when building is invoked.