Error while building bt_spp_initiator project

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: Error while building bt_spp_initiator project

Postby TomasCZ » Thu Aug 10, 2023 4:00 pm

MicroController wrote:
Wed Aug 09, 2023 1:00 pm
You did mention, and your blog confirmed, that you need wireless communication between two ESPs. The easiest way for ESP<->ESP RF comm is ESP-NOW. If you don't need to TX/RX with non-ESP devices (smartphone?) and don't care about any of the features Bluetooth offers, i.e. security, multiple services on a device &c., then I see no reason not to go with ESP-NOW.

OTOH, it shouldn't be difficult to adapt the SPP example and remove functionality (security/PIN,...) you don't need, or just use the example code as-is with the standard PIN.
Yet, the complexity and amount of code you'll need even for the most basic SPP functionality over BT is much greater than ESP-NOW.
Thaynk ou for your reply. I decided to try BT SPP for the reason I can learn something more about BT and as well I might use the code for some other projects. There is also a posibility to sen the tuner's data to my PC or Mobile phone.

I will try to go step by step with a friend of mine. Fortunately he knows a lot about BT and is exprienced programmer but not with ESP and IDF. I hope we will find the way

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: Error while building bt_spp_initiator project

Postby TomasCZ » Fri Aug 11, 2023 4:59 pm

I tried this projects:
https://github.com/espressif/esp-idf/bl ... Muu8yhQ#L1

And I have the same result when I build the project:

Code: Select all

static assertion failed with "please enable bluetooth in menuconfig to use esp_bt.h"
On top as a bonus I have this message in red on my terminal:

Code: Select all

E (652) GAP: app_main enable controller failed: ESP_ERR_INVALID_ARG
May be guys, could some tell me how to start a project like this focusing in BT from beginning using VS Code ? Maybe there is something wrong on the steps I am doing (I mean like like menucongig, set target, which template to use)

Thank you in advance

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Error while building bt_spp_initiator project

Postby MicroController » Fri Aug 11, 2023 5:35 pm

Just tried to reproduce:
VS code -> F1 -> >ESP-IDF: New Project -> ... -> Board: some ESP32 -> Template "bt_spp_initiator" -> create ...
Project built with no issues without me modifying anything.
Are you starting from the "clean" example project too or did you add/modify any (component, include,...) paths?

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: Error while building bt_spp_initiator project

Postby TomasCZ » Sat Aug 12, 2023 7:08 am

MicroController wrote:
Fri Aug 11, 2023 5:35 pm
Just tried to reproduce:
VS code -> F1 -> >ESP-IDF: New Project -> ... -> Board: some ESP32 -> Template "bt_spp_initiator" -> create ...
Project built with no issues without me modifying anything.
Are you starting from the "clean" example project too or did you add/modify any (component, include,...) paths?
Thank you I will try again. This time I tried with the template “sample_project”, then set BT classic in the Menuconfig and set target to esp32.

Previuosly I tried directly the bt_spp_initiator but I still had the problem with esp_bt.h.

Could there be any problems with versions of I don’t know the library, VS Code…. ?

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: Error while building bt_spp_initiator project

Postby TomasCZ » Sat Aug 12, 2023 5:13 pm

MicroController wrote:
Fri Aug 11, 2023 5:35 pm
Just tried to reproduce:
VS code -> F1 -> >ESP-IDF: New Project -> ... -> Board: some ESP32 -> Template "bt_spp_initiator" -> create ...
Project built with no issues without me modifying anything.
Are you starting from the "clean" example project too or did you add/modify any (component, include,...) paths?
So I was able to to flesh and test the the code and it discovered out TV bud anyway there are still the same problems:
esp_bt.h problem.jpg
esp_bt.h problem.jpg (307.4 KiB) Viewed 2171 times

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Error while building bt_spp_initiator project

Postby MicroController » Sat Aug 12, 2023 6:17 pm

So the build succeeded at one point?
If building from the command line via idf.py works, building via the ESP-IDF extension in VS Code should also work (most of the time).
Some thoughts:
0. "Simple" compiling of source files directly from VS Code often won't work. ESP-IDF uses the cmake build system, so to build, VS Code needs to run cmake.
1. You have the ESP-IDF extension installed in VS Code?
2. Can you build an IDF project via the extension, i.e. via the "ESP-IDF build project" button in the toolbar or F1 -> >ESP-IDF: build your project?
3. Can you build the bt_spp_initiator sample project this way?
4. If not done already, you may want to install the "CMake Extension" into VS code to get some interoperability between IDF's cmake build system and VS Code. This helps VS Code to figure out the paths needed by your project.

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: Error while building bt_spp_initiator project

Postby TomasCZ » Mon Aug 14, 2023 7:14 am

MicroController wrote:
Sat Aug 12, 2023 6:17 pm
So the build succeeded at one point?
If building from the command line via idf.py works, building via the ESP-IDF extension in VS Code should also work (most of the time).
Some thoughts:
0. "Simple" compiling of source files directly from VS Code often won't work. ESP-IDF uses the cmake build system, so to build, VS Code needs to run cmake.
1. You have the ESP-IDF extension installed in VS Code?
2. Can you build an IDF project via the extension, i.e. via the "ESP-IDF build project" button in the toolbar or F1 -> >ESP-IDF: build your project?
3. Can you build the bt_spp_initiator sample project this way?
4. If not done already, you may want to install the "CMake Extension" into VS code to get some interoperability between IDF's cmake build system and VS Code. This helps VS Code to figure out the paths needed by your project.

So the build succeeded at one point?

Yes, it looks so.

If building from the command line via idf.py works, building via the ESP-IDF extension in VS Code should also work (most of the time).
Some thoughts:
0. "Simple" compiling of source files directly from VS Code often won't work. ESP-IDF uses the cmake build system, so to build, VS Code needs to run cmake.


One question here. I am not with my PC now but there are two options when creating the project. There are two options if I want "Look for kits..." and the second I don't remember exactly but it is something with Cmake. I tried both within my test and both worked. But with the second option there was some error which disappeared within the build.

1. You have the ESP-IDF extension installed in VS Code?

I hope so because I can choose ESP-IDF extensions but then I have to choose some template. Without it I can't move fwd. I could't find anything like empty project.

2. Can you build an IDF project via the extension, i.e. via the "ESP-IDF build project" button in the toolbar or F1 -> >ESP-IDF: build your project?

Yes, as described above. I do everything via those buttons on the bottom bar.

3. Can you build the bt_spp_initiator sample project this way?

Yes, I can with the same error message regarding esp_bt.h. All the tests with bt_spp_initiator, bt_spp_acceptor, bt_ discovery work but the same error message.

Code: Select all

static assertion failed with "please enable bluetooth in menuconfig to use esp_bt.h"
4. If not done already, you may want to install the "CMake Extension" into VS code to get some interoperability between IDF's cmake build system and VS Code. This helps VS Code to figure out the paths needed by your project.

I am not sure how to check if everything is installed correctly.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Error while building bt_spp_initiator project

Postby MicroController » Tue Aug 15, 2023 8:44 pm

I am confused.

Code: Select all

static assertion failed ...
is a compile failure. The compiler will exit with an error and not compile the offending file, which in turn makes the whole build process abort with an error.
But by some method you did manage to build the application, else there would be no binary to flash/run, so there must be a working way in your setup which builds without the assertion failure...

Who is online

Users browsing this forum: No registered users and 116 guests