IDF build as library ?

PatrickVisser
Posts: 5
Joined: Tue Mar 28, 2023 5:47 am

IDF build as library ?

Postby PatrickVisser » Mon Jul 03, 2023 8:07 am

Is it possible to have a IDF build output as a library?

My problem is that we want to give a BSP type library to a customer.
so that they can have access to the business logic without needing the source for all the low level items.

But is this even possible?
If so can you direct me in the correct direction on how to implement this

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

Re: IDF build as library ?

Postby bidrohini » Mon Jul 03, 2023 8:39 am

It is possible to create a library from an IDF (ESP-IDF) build output.
Set up your IDF project with all the necessary components, libraries, and configurations required for your business logic.

Adjust the build configuration to generate a static library instead of an executable binary. This can be done by modifying the CMakeLists.txt file in your project.

Use the IDF build system (idf.py or make) to build the project. The build process will generate the library file with the desired business logic.
Once the build process is complete, you will find the library file (usually with a .a extension) in the build output directory. You can provide this library file to your customer, along with any necessary header files and documentation.

PatrickVisser
Posts: 5
Joined: Tue Mar 28, 2023 5:47 am

Re: IDF build as library ?

Postby PatrickVisser » Mon Jul 03, 2023 11:01 am

good to read that it should be possible.

now i just need to find out how to modify the CMakeLists.txt to generate a static library

PatrickVisser
Posts: 5
Joined: Tue Mar 28, 2023 5:47 am

Re: IDF build as library ?

Postby PatrickVisser » Tue Jul 04, 2023 9:12 am

Is there any documentation or examples on how to modify the CMakeLists.txt to generate a static library?

a2800276
Posts: 75
Joined: Sat Jan 23, 2016 1:59 pm

Re: IDF build as library ?

Postby a2800276 » Wed Jul 05, 2023 1:30 pm

PatrickVisser wrote:
Tue Jul 04, 2023 9:12 am
Is there any documentation or examples on how to modify the CMakeLists.txt to generate a static library?
Half-baked answer:

You don't need to change anything. All components that constitute a firmware are compiled to static library archives that are located under `build/esp-idf` in your project.

What I have not been able to figure out is how to build only the library without an entire firmware ... you'll also need to package the `*.a` lib with the corresponding header manually. (why I'm considering the answer half-baked)

There's clearly a way to do this, e.g. the closed wifi and ble functionality are distributed in this manner, but I've not been able to find it -- not that I have put that much effort into it :)

I'd start with the idf build system docs to dig deeper.

PatrickVisser
Posts: 5
Joined: Tue Mar 28, 2023 5:47 am

Re: IDF build as library ?

Postby PatrickVisser » Thu Jul 06, 2023 8:08 am

I would like to only have to give a single .a file, but that is not something that i have been able to achieve yet.
my goal is to have a lib that has only a few external functions that will be implemented by the customer.
and then just have to link the lib with the complied c file from him.

just need to figure out how to alter the build system to achieve this. :ugeek:

Who is online

Users browsing this forum: Google [Bot] and 142 guests