feat: vendor libltkc

This commit is contained in:
2026-03-09 09:01:17 -04:00
parent 1f75b6f396
commit 24059f9660
45 changed files with 29068 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.9)
project(docsamples)
add_subdirectory(docsample1)

49
vendor/libltkc/examples/README.md vendored Normal file
View File

@@ -0,0 +1,49 @@
# Impinj Example Application
## Overview
This example illustrates using CMake to build an Impinj Reader application for
host (i.e. x86\_64) and Impinj Reader CPU architectures. The example
application uses Impinj LTK libraries that are found inside the ETK. The
'build.sh' script is intended to be run from within the Impinj ETK.
The ETK contains:
* a cross compilation toolchain that targets an Impinj Reader architecture
* libraries built for an Impinj Reader architecture
* host architecture versions of libraries to allow host builds for faster
development and debugging)
## Building
To build the project, call the build script from the command line:
```bash
[user@machine]$ ./build.sh
```
The script accepts overrides for certain variables. See 'build.sh' for more
information.
## Running
To run on the host machine, simply run the exectuable:
```bash
[user@machine]$ output/host/docsample1/docsample1 ${READER_HOSTNAME}
```
To run on an Impinj Reader, e.g. an R700, copy the binary to the Reader and
execute it:
```bash
[user@machine]$ ssh root@r700
Password: ********
>
# drop in to osshell
> osshell <code>
# copy the binary and execute it
root@r700:~# scp user@machine:/path/to/output/target/docsample1/docsample1 /tmp
root@r700:~# /tmp/docsample1 localhost
```

49
vendor/libltkc/examples/build.sh vendored Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash -eu
#
# Example build script for use with Impinj ETK
#
# The target libraries are contained inside the sysroot at
# "$ETK_ROOT/arm-buildroot-linux-gnueabihf/sysroot/lib". The host libraries
# are contained in "$ETK_ROOT/lib".
#
# For a host build, CMake must be configured to correctly search for host
# headers and libraries in the correct location inside the ETK.
#
# For a target build, CMake must be configured to use the correct cross
# compiler and informed about the sysroot location in the ETK.
#
# The script allows overriding some variables when building, e.g.:
#
# [user@machine]$ BUILD_TYPE=Release VERBOSE=ON ./build.sh
#
SCRIPT_PATH=$(dirname $(realpath $0))
OUTPUT_PATH=${SCRIPT_PATH}/output
# defaults when building with ETK; override on command line for custom setup
ETK_PATH=${ETK_PATH:-$(realpath ${SCRIPT_PATH}/../../arm-toolchain)}
BUILD_TYPE=${BUILD_TYPE:-Debug}
VERBOSE=${VERBOSE:-OFF}
# host build; override on command line for custom setup
INC=${INC:-${ETK_PATH}/include}
LIB=${LIB:-${ETK_PATH}/lib}
cmake ${SCRIPT_PATH} -B"${OUTPUT_PATH}/host" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${VERBOSE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_C_FLAGS="-isystem ${INC}" \
-DCMAKE_LIBRARY_PATH=${LIB}
cmake --build "${OUTPUT_PATH}/host"
# target build
CC=$(find ${ETK_PATH}/bin -name arm-*-linux-*-gcc)
CC=${CC%gcc}
SYSROOT_PATH="$(${CC}gcc -print-sysroot)"
cmake ${SCRIPT_PATH} -B"${OUTPUT_PATH}/target" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${VERBOSE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_C_COMPILER=${CC}gcc \
-DCMAKE_CXX_COMPILER=${CC}g++ \
-DCMAKE_FIND_ROOT_PATH=${SYSROOT_PATH}
cmake --build "${OUTPUT_PATH}/target"

View File

@@ -0,0 +1,28 @@
#
# This example statically links when possible. While not required, it is meant
# to illustrate how to handle both static and dynamic linking. Note that
# producing a fully statically linked application (i.e. linking with '-static')
# will raise a _lot_ of issues, if it works at all, and is not recommended.
#
cmake_minimum_required(VERSION 3.9)
project(docsample1)
find_library(LIBLTKC libltkc.a REQUIRED)
find_library(LIBLTKC_IMPINJ libltkcimpinj.a REQUIRED)
# it is not recommended to statically link for ssl and crypto libraries
find_library(LIBSSL ssl REQUIRED)
find_library(LIBCRYPTO crypto REQUIRED)
# The ETK does not contain a host static library for xml2. Add the generic
# name 'xml2' to link against the dynmaic library when compiling for host.
find_library(LIBXML2 NAMES libxml2.a xml2 REQUIRED)
set(LIBS
${LIBLTKC}
${LIBLTKC_IMPINJ}
${LIBXML2}
${LIBCRYPTO}
${LIBSSL}
)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c)
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS})

1921
vendor/libltkc/examples/docsample1/docsample1.c vendored Executable file

File diff suppressed because it is too large Load Diff