1

I am trying to run the spp_counter.c example in the pico-sdk. When I run make I am getting this error:

fatal error: btstack.h: No such file or directory
58 | #include "btstack.h"

The code is from the repository. CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)

# initialize the SDK based on PICO_SDK_PATH
# Include build functions from Pico SDK
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)

project(my_project)

# initialize the Raspberry Pi Pico SDK
set(PICO_BOARD pico_w)

pico_sdk_init()

# rest of your project
add_executable(test
    test.c
)

# Add pico_stdlib library which aggregates commonly used features
target_link_libraries(test pico_stdlib)

# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(test)

I'm not sure what I'm missing.

user4157124
  • 2,809
  • 13
  • 27
  • 42
David Davis
  • 23
  • 1
  • 5

2 Answers2

1

I had the same issue until I saw the standalone examples. There is a btstack_config.h that has to be included, and there are a few libraries that need to be linked as well, check out the CMakeLists.txt for what you need to add to your own CMakeLists file. All the examples are in the same file, but the core Bluetooth libraries are used linked to all executable so they're easy to spot.

target_link_libraries(picow_ble_temp_sensor # executable
    pico_stdlib # standard lib, pretty much always linked
    pico_btstack_ble # Needed for ble
    pico_btstack_cyw43 # Needed for ble
    pico_cyw43_arch_none # Needed for pico_w
    hardware_adc # don't think it's needed (but haven't tested)
    )
target_include_directories(picow_ble_temp_sensor PRIVATE
    ${CMAKE_CURRENT_LIST_DIR} # For btstack config (copy their file)
    )

Make sure you did the submodule update update git submodule update --init as well.

0

hint: try 'git submodule update --init' from your SDK directory

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 10 '23 at 15:31