This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMake script for add eternal libaray ( BSEC ) to test Bosch sensor raeding?

hello,

i have downloaded    ( BSEC )    library from https://www.bosch-sensortec.com/software-tools/software/bsec/  for read sensor data . now want to test the code by build and flashing it with VS code for thingy 91 borad.

CMamke  file have 

FILE(GLOB bsec_integration src/*.c)

target_sources(app PRIVATE src/bsec_integration.c)
target_sources(app PRIVATE src/bme680.c)

i have add c file and header file in scr folder .

on build shows error 

FATAL ERROR: command exited with status 1: 'c:\Users\mohit\ncs\v1.9.1\toolchain\opt\bin\cmake.EXE' '-DWEST_PYTHON=c:\Users\mohit\ncs\v1.9.1\toolchain\opt\bin\python.exe' '-Be:\Nordic_Acadmey\bsec_integration\build_1' '-Se:\Nordic_Acadmey\bsec_integration' -GNinja -DBOARD=thingy91_nrf9160 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE.

please suggest

  • These are the lines from the compiler that is telling you what you need to look into:

    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: app/libapp.a(bsec_integration.c.obj): in function `bme680_bsec_update_subscription':
    C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:140: undefined reference to `bsec_update_subscription'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: app/libapp.a(bsec_integration.c.obj): in function `bme680_bsec_process_data':
    C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:417: undefined reference to `bsec_do_steps'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: app/libapp.a(bsec_integration.c.obj): in function `bsec_iot_init':
    C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:186: undefined reference to `bsec_init'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:207: undefined reference to `bsec_set_state'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:196: undefined reference to `bsec_set_configuration'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: app/libapp.a(bsec_integration.c.obj): in function `bsec_iot_loop':
    C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:539: undefined reference to `bsec_get_state'
    c:/users/mohit/nrf/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\mohit\nrf\v1.9.1\Nordic_Acadmey\bsec\src\bsec_integration.c:521: undefined reference to `bsec_sensor_control'

    I am not familiar with the bosch sensor libraries, so I don't know these files in and out, but you should be able to figure this one out.

    In line 140 in bsec_integration.c you call bsec_update_subscription, but the compiler can't see where this is declared.

    The same applies to:

    bsec_integration.c line 417 with bsec_do_steps

    bsec_integration.c line 186 with bsec_init

    bsec_integration.c line 207 with bsec_set_state

    bsec_integration.c line 196 with bsec_set_configuration

    bsec_integration.c line 539 with bsec_get_state

    bsec_integration.c line 521 with bsec_sensor_control

    These all look quite similar, so solving one will either solve all, or at least show how to solve all, so let us look at the first one, on line 140 in bsec_integration.c.

    You are using a parameter/function called bsec_update_subscription. What is this? Is it a function or a parameter? And where is it defined? I see that you include bsec_integration.h from main.c. Do you include bsec_integration.h from bsec_integration.c as well?

    It may also be that the compiler is not looking in the src folder for header files (not sure if this is set by default). Try adding this last line to your CMakeLists.txt file:

    cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(hello_world)
    target_sources(app PRIVATE src/main.c)
    target_sources(app PRIVATE src/bsec_integration.c)
    target_sources(app PRIVATE src/bme680.c)
    zephyr_library_include_directories(src)

    Also, I noticed that you have some spaces (whitespace) after the lines "target_sources(app PRIVATE src/main.c)       "

    Try removing these. These files are a bit sensitive. The same applies to your prj.conf file if you are going to do changes there in the future.

    If I am going to be able to tell more exactly why it is failing, then I would need to see more from your project. At least bsec_integration.h and bsec_integration.c.

  • cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(hello_world)
    target_sources(app PRIVATE src/main.c)
    target_sources(app PRIVATE src/bsec_integration.c)
    target_sources(app PRIVATE src/bme680.c)
    zephyr_library_include_directories(src)

    by adding last line problem not solved. This link is available on nordic official , by this you get more details about  bsec_integration.h and bsec_integration.c.

    i on this page , how to set configuration for BSEC is also available , but i am enable to understand . please go through to the link. i need your support to understand it.  

    developer.nordicsemi.com/.../sensor_module.html

  • Mohit Nama said:
    i on this page , how to set configuration for BSEC is also available , but i am enable to understand . please go through to the link. i need your support to understand it.  

    I think you should focus on getting the project to compile before you start tweaking configurations. 

    I still don't have access to the bsec files. 

    Edvin said:

    These all look quite similar, so solving one will either solve all, or at least show how to solve all, so let us look at the first one, on line 140 in bsec_integration.c.

    You are using a parameter/function called bsec_update_subscription. What is this? Is it a function or a parameter? And where is it defined? I see that you include bsec_integration.h from main.c. Do you include bsec_integration.h from bsec_integration.c as well?

    Can you please check this?

  • sir , i have set the path of header file , but sample code have dependency of Configuration file ,I want set path for configuration folder  , can you please suggest the way. or is any person of your team how can can help me to do this  ???

    nordic  officially support Bosch Sensor data that's why i am trying  nordic thingy91  board . if there was no soliton available then why nordic says about support.  

  • Mohit Nama said:
    but sample code have dependency of Configuration file

    What dependencies is that? Can you show me something, like a screenshot or a file?

    I am trying to help you with this, but I don't have your project or your files, and hence, I don't know how to reproduce the issues that you are seeing, and therefore, I don't know the solution yet.

    Best regards,

    Edvin

Related