How to create and build a standalone ESP-IDF static library?

haxpanel
Posts: 1
Joined: Mon May 21, 2018 5:03 pm

How to create and build a standalone ESP-IDF static library?

Postby haxpanel » Mon May 21, 2018 5:12 pm

I'm learning ESP-IDF platform and now want to create a library in order to be able to structure my code properly in the future.

I've done some research and found out that a component needs to be under a `components/<component-name>` folder. The documentation doesn't talk about or I missed how to create a standalone component and how to compile it to a static library, into a `.a` file which later can be linked to different projects.

- What is the minimum configuration for an ESP-IDF static library that can be built into a `.a` file?
- How to compile a component into a standalone static library?
Last edited by haxpanel on Tue May 22, 2018 7:49 pm, edited 1 time in total.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How to create and build a standalone ESP-IDF static library?

Postby ESP_Angus » Mon May 21, 2018 11:12 pm

Hi,

I'm going to copy the answer from the github issue to start with. Let me know if you'd like me to expand on or explain anything else from this answer:

For structure & modularity, IDF has the concept of "components". Each component is built into a static library as part of the build process.

The smallest possible component would contain one source file only, as well as a component.mk file to define the component and describe the location of that source file.

You can find documentation about the build system and creating components here:
https://esp-idf.readthedocs.io/en/lates ... ystem.html

Who is online

Users browsing this forum: FrankJensen, Google [Bot] and 102 guests