Page 1 of 1

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

Posted: Mon May 21, 2018 5:12 pm
by haxpanel
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?

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

Posted: Mon May 21, 2018 11:12 pm
by ESP_Angus
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