Using BSEC 2 library for bme688 with Thingy53

I'm developing a custom project for thingy53. 

I'm trying to use the bsec2 library to use the bme688 in Thingy53, but there's no reference example anywhere.

With the library provided by bosch, the libalgobsec.a and bsec_interface.h and bsec_datatypes.h files, I succeed to compile together.

But I don't know how to program them including config files.

I find the example with bme680 which is integrated in Thingy91, the asset tracker.

However, that was meaningless because the bsec library version is different (bme680 -> bsec v1.4x / bme688 -> bsec v2.0x) and because of different version, the structure of library is also different.

I think the Thingy53's edge-impulse example uses bme688. But also, unlike Thiny52, Thingy53's source code is not distributed.

So, is there example that adopts bme688's bsec lib. v2.0x for the custom project?

If not, How could I integrate bsec v2.0x library to my custom project?

Here's my CMakeList.txt. I built my project based on Nordic_LBS example from NCS v2.0.0 (zephyr) with Thingy53.

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.20.0)

set(PM_STATIC_YML_FILE
  ${CMAKE_CURRENT_SOURCE_DIR}/boards/pm_static_${BOARD}.yml
  )

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(THINGY53_AMG88XX_BLE_APP)

# NORDIC SDK APP START
target_sources(app PRIVATE src/main.c)

# Preinitialization related to Thingy:53 DFU
target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP app PRIVATE
  boards/thingy53.c
)
target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP_NS app PRIVATE
  boards/thingy53.c
)


# NORDIC SDK APP END
zephyr_library_include_directories(.)
zephyr_library_include_directories({ZEPHYR_BASE}/drivers/sensor/amg88xx)

# zephyr_library_sources(amg88xx.c)
# zephyr_library_sources_ifdef(CONFIG_AMG88XX_TRIGGER amg88xx_trigger.c)


#External library config
# The external static library that we are linking with does not know
# how to build for this platform so we export all the flags used in
# this zephyr build to the external build system.
#
# Other external build systems may be self-contained enough that they
# do not need any build information from zephyr. Or they may be
# incompatible with certain zephyr options and need them to be
# filtered out.
zephyr_get_include_directories_for_lang_as_string(       C includes)
zephyr_get_system_include_directories_for_lang_as_string(C system_includes)
zephyr_get_compile_definitions_for_lang_as_string(       C definitions)
zephyr_get_compile_options_for_lang_as_string(           C options)

set(external_project_cflags
  "${includes} ${definitions} ${options} ${system_includes}"
  )

include(ExternalProject)

# Add an external project to be able download and build the third
# party library. In this case downloading is not necessary as it has
# been committed to the repository.
set(lib_gt2_src_dir   ${CMAKE_CURRENT_SOURCE_DIR}/lib_gt2)
set(lib_gt2_build_dir ${CMAKE_CURRENT_BINARY_DIR}/lib_gt2)

set(LIB_GT2_LIB_DIR     ${lib_gt2_build_dir}/lib)
set(LIB_GT2_SOURCE_DIR  ${lib_gt2_build_dir}/src)
set(LIB_GT2_INCLUDE_DIR ${lib_gt2_src_dir}/include)

if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
# https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
set(submake "$(MAKE)")
else() # Obviously no MAKEFLAGS. Let's hope a "make" can be found somewhere.
set(submake "make")
endif()

ExternalProject_Add(
  lib_gt2_grideye_project                 # Name for custom target
  PREFIX     ${lib_gt2_build_dir} # Root dir for entire project
  SOURCE_DIR ${lib_gt2_src_dir}
  BINARY_DIR ${lib_gt2_src_dir} # This particular build system is invoked from the root
  CONFIGURE_COMMAND ""    # Skip configuring the project, e.g. with autoconf
  BUILD_COMMAND
  ${submake}
  PREFIX=${lib_gt2_build_dir}
  CC=${CMAKE_C_COMPILER}
  AR=${CMAKE_AR}
  CFLAGS=${external_project_cflags}
  INSTALL_COMMAND ""      # This particular build system has no install command
  BUILD_BYPRODUCTS ${LIB_GT2_LIB_DIR}/lib_gt2.a
  BUILD_BYPRODUCTS ${LIB_GT2_SOURCE_DIR}/libalgobsec.a
  DEPENDS zephyr_interface
  )

# Create a wrapper CMake library that our app can link with
add_library(lib_gt2_grideye STATIC IMPORTED GLOBAL)
add_dependencies(
  lib_gt2_grideye
  lib_gt2_grideye_project
  )
set_target_properties(lib_gt2_grideye PROPERTIES IMPORTED_LOCATION              ${LIB_GT2_LIB_DIR}/lib_gt2.a)
# set_target_properties(lib_gt2_grideye PROPERTIES IMPORTED_LOCATION              ${LIB_GT2_SOURCE_DIR}/libalgobsec.a)
set_target_properties(lib_gt2_grideye PROPERTIES INTERFACE_INCLUDE_DIRECTORIES  ${LIB_GT2_INCLUDE_DIR})

# BSEC static library configuration
add_library(lib_bsec STATIC IMPORTED GLOBAL)
# add_dependencies(lib_bsec)
set_target_properties(lib_bsec PROPERTIES IMPORTED_LOCATION                     ${LIB_GT2_SOURCE_DIR}/libalgobsec.a)
set_target_properties(lib_bsec PROPERTIES INTERFACE_INCLUDE_DIRECTORIES         ${LIB_GT2_INCLUDE_DIR})

target_link_libraries(app PUBLIC lib_gt2_grideye)

Parents Reply Children
No Data
Related