Skip to content

How to build everything from source instead of static libraries? #3098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
piotrkundu opened this issue Aug 16, 2019 · 7 comments
Closed

How to build everything from source instead of static libraries? #3098

piotrkundu opened this issue Aug 16, 2019 · 7 comments

Comments

@piotrkundu
Copy link

piotrkundu commented Aug 16, 2019

This project is based on pre-built static libraries, which means you can't make any changes.
I would like to change the UUID for BT SPP and use it in Arduino https://github.com/espressif/esp-idf/blob/master/components/bt/host/bluedroid/api/esp_spp_api.c#L26

The function I want to modify is esp_spp_start_discovery and the source is here:
https://github.com/espressif/esp-idf/blob/6517c5033aab27afe491e433d6beeba93dfb1aa7/components/bt/host/bluedroid/api/esp_spp_api.c#L71

How?
Ideally I would like to rebuild everything from source in Arduino every-time I build. Alternatively I would like to build ~/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib/libbt.a from source.

@atanisoft
Copy link
Collaborator

Short answer... Not possible in Arduino IDE...

Longer answer.. You have two options:

  1. Use Arduino as an IDF component, documented here.
  2. Use PlatformIO IDE with the development version of the Espressif32 platform using the framework setting as "espidf, arduino" and having the sdkconfig.h in your src directory.

Option 2 is a lot easier to setup and maintain over the long term. As an added bonus you will get a full fledged IDE.

@lbernstone
Copy link
Contributor

lbernstone commented Aug 16, 2019

option 2
option 3) If you copy the relevant c-code and headers from esp-idf and place them in your sketch folder, they will override the functions in the libraries.

@atanisoft
Copy link
Collaborator

for option 3, make sure to use the correct version of esp-idf... currently set to the 3.2 release branch..

@piotrkundu
Copy link
Author

I tried to build libbt.a in CLion and then copy them to ~/Library/Arduino15/packages/esp32 folder structure. Since my esp-idf is latest master (v4) and the Arduino libs are v3.x I got a lot of missing symbols so I had to build and copy another 3 libs. Of course once I got a ELF file built and flashed it didn't work, so I kind of dropped that for now.

@atanisoft Arduino is great for hobbyists or some rapid prototyping. I was just surprised that the binaries (libs) are checked into git in arduino-esp32 and the folder structure is flattened to just sdk/lib. When you build these libraries with cmake, idf.py or CLion the libs are build into a folder structure of esp-idf/component_name/libxxx.a. I guess I could copy *.a from esp-idf to ~/Library/Arduino15/packages/esp32

For Option 2, I've actually installed Visual Studio Code, PlatformIO and ESP32 component. That's a good free option as well.

@atanisoft
Copy link
Collaborator

Since you have CLion, I'd suggest use the PIO plugin for it and you can follow the same options for #2.

@piotrkundu
Copy link
Author

Got everything I need up and running in CLion - no luck with Arduino IDE.

@RdlP
Copy link

RdlP commented Jul 18, 2020

I am facing a similar problem. I want to re-compile libbt and replace it in the arduino library folder. But my problem is how I can build the libbt.a library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants