Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@
[submodule "components/esp32_bc-ur"]
path = components/esp32_bc-ur
url = https://github.com/Blockstream/esp32_bc-ur
[submodule "components/cUR"]
path = components/cUR
url = https://github.com/odudex/cUR
branch = main
[submodule "components/k_quirc"]
path = components/k_quirc
url = https://github.com/odudex/k_quirc
branch = master
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED ESP_PLATFORM AND ESP_PLATFORM EQUAL 1)
set(EXTRA_COMPONENT_DIRS bootloader_components/bootloader_support)
# Jade does its own payload CBOR (TinyCBOR) - only the UR transport
# layer of the cUR component is needed
set(UR_ENVELOPE_ONLY ON CACHE BOOL "" FORCE)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})
project(jade)
Expand Down
1 change: 1 addition & 0 deletions components/cUR
Submodule cUR added at 09724a
1 change: 1 addition & 0 deletions components/k_quirc
Submodule k_quirc added at f1887f
28 changes: 19 additions & 9 deletions libjade/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ set(COMMON_INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}/../components/libwally-core/upstream/include
${CMAKE_CURRENT_SOURCE_DIR}/../components/assets
${CMAKE_CURRENT_SOURCE_DIR}/../components/esp32_bsdiff
${CMAKE_CURRENT_SOURCE_DIR}/../components/esp32-quirc
${CMAKE_CURRENT_SOURCE_DIR}/../components/esp32-quirc/lib
${CMAKE_CURRENT_SOURCE_DIR}/../components/k_quirc/include
${CMAKE_CURRENT_SOURCE_DIR}/../components/k_quirc/src
${CMAKE_CURRENT_SOURCE_DIR}/../components/libwally-core/upstream
${CMAKE_CURRENT_SOURCE_DIR}/../components/libwally-core/upstream/src
${CMAKE_CURRENT_SOURCE_DIR}/../components/libwally-core/upstream/src/ccan
Expand All @@ -105,28 +105,38 @@ set(COMMON_SRC
${IDF_PATH}/components/http_parser/http_parser.c
)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../components/esp32_bc-ur
${CMAKE_CURRENT_BINARY_DIR}/bcur)
target_include_directories(bcur PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../components/libwally-core/upstream/include)
target_link_libraries(bcur PRIVATE mbedcrypto)
# Jade does its own payload CBOR (TinyCBOR) - only the UR transport
# layer of the cUR component is needed
set(UR_ENVELOPE_ONLY ON CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../components/cUR
${CMAKE_CURRENT_BINARY_DIR}/cur)

# libjade.so
add_library(jade SHARED ${COMMON_SRC})
target_link_libraries(jade PRIVATE m z bcur cbor_target otpauth_migrate_target mbedtls mbedcrypto mbedx509)
target_link_libraries(jade PRIVATE m z ur cbor_target otpauth_migrate_target mbedtls mbedcrypto mbedx509)
target_include_directories(jade PRIVATE ${COMMON_INCLUDES})

# libjade.c textually #includes the k_quirc sources, so the QR decoder is
# configured here rather than by components/k_quirc/CMakeLists.txt (which only
# applies to the ESP-IDF component build). These must stay in step with the
# definitions that file sets for the firmware: without them the qr_qvga_*
# fixtures exercised a materially different recognition path from the one that
# actually ships. Attached to the source file, not a target, so any future
# target compiling libjade.c inherits them.
set_source_files_properties(libjade.c PROPERTIES COMPILE_OPTIONS
"-Wall;-W;-Wno-format;-Wno-unused-function;-Wno-unused-parameter;-Wno-sign-compare;-Wno-missing-field-initializers;-Wno-narrowing")
set_source_files_properties(libjade.c PROPERTIES COMPILE_DEFINITIONS
"K_QUIRC_ADAPTIVE_THRESHOLD;K_QUIRC_BILINEAR_THRESHOLD")
target_compile_definitions(jade PRIVATE LIBJADE_BUILD)

# libjade.a
add_library(jade_static STATIC ${COMMON_SRC})
target_link_libraries(jade_static PRIVATE m z mbedtls mbedcrypto mbedx509 bcur)
target_link_libraries(jade_static PRIVATE m z mbedtls mbedcrypto mbedx509 ur)
target_include_directories(jade_static PRIVATE ${COMMON_INCLUDES})
target_compile_definitions(jade_static PRIVATE LIBJADE_BUILD)

add_executable(libjade_daemon daemon.c)
target_link_libraries(libjade_daemon PRIVATE jade_static bcur cbor_target otpauth_migrate_target m z mbedtls mbedcrypto mbedx509 Threads::Threads)
target_link_libraries(libjade_daemon PRIVATE jade_static ur cbor_target otpauth_migrate_target m z mbedtls mbedcrypto mbedx509 Threads::Threads)
target_include_directories(libjade_daemon PRIVATE ${COMMON_INCLUDES})

# Assets
Expand Down
9 changes: 4 additions & 5 deletions libjade/libjade.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@
#undef ESP_PLATFORM
#include "components/esp32_deflate/deflate.c"
// qrCode encoding/decoding
#include "components/esp32-quirc/lib/decode.c"
#include "components/esp32-quirc/lib/identify.c"
#include "components/esp32-quirc/lib/quirc.c"
#include "components/esp32-quirc/lib/version_db.c"
#include "components/esp32-quirc/openmv/collections.c"
#include "components/k_quirc/src/k_quirc.c"
#include "components/k_quirc/src/k_quirc_decode.c"
#include "components/k_quirc/src/k_quirc_identify.c"
#include "components/k_quirc/src/k_quirc_version.c"
// bspatch
#include "components/esp32_bsdiff/bspatch.c"

Expand Down
2 changes: 1 addition & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ idf_component_register(SRC_DIRS "."
"${usbdir}"
"${wallydirs}"
"${secpdir}"
PRIV_REQUIRES assets libwally-core libsodium esp32-rotary-encoder esp32-quirc bootloader_support app_update nvs_flash bt autogenlang cbor esp_netif esp32_bsdiff esp32_deflate nghttp esp32_bc-ur driver mbedtls http_parser esp_hw_support efuse esp_eth esp_http_server esp_lcd usb vfs app_trace spi_flash google-otpauth-migrate ${extra_priv_requires}
PRIV_REQUIRES assets libwally-core libsodium esp32-rotary-encoder k_quirc bootloader_support app_update nvs_flash bt autogenlang cbor esp_netif esp32_bsdiff esp32_deflate nghttp cUR driver mbedtls http_parser esp_hw_support efuse esp_eth esp_http_server esp_lcd usb vfs app_trace spi_flash google-otpauth-migrate ${extra_priv_requires}
EMBED_FILES ${PROJECT_DIR}/pinserver_public_key.pub ${logo_files} ${qemu_display_file})

if(CONFIG_ETH_USE_OPENETH)
Expand Down
Loading