How to compile single component

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

How to compile single component

Postby Gfast2 » Sun Dec 03, 2017 8:53 pm

Hi ESP-IDF,

Is there ways to let ESP-IDF only compile one of my own component (in "projectRoot/components/myComp").

This will accelerate my working flow.

Cheers

Gfast

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: How to compile single component

Postby kolban » Sun Dec 03, 2017 10:07 pm

It should be that the source of a component is only compiled/recompiled when the source of it changes. Are you asking about creating "libraries" of pre-built components as opposed to the idea of compiling a single component?

The down-side of building a pre-made library is that the component code leverages per project configuration from "make menuconfig". If you compile a component using one SDKCONFIG that may not match the settings in an SDKCONFIG for your current project and time spent hunting that down would wipe away (and then some) any small workflow improvements.

This all said ... I'd still love to hear your thinking ... it is VERY possible that you are seeing something I don't and you are on to a good thing.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: How to compile single component

Postby ESP_Angus » Sun Dec 03, 2017 10:52 pm

It's not documented and may change in the future, but you can type (for example) "make component-esp32-build" to build only the "esp32" component. Note that this does not re-link the project .elf or .bin file, it just compiles those parts of the source.

(In IDF V2.1 and earlier the target is named differently, I think it would be "make esp32-build")

However, as kolban says, the only time a component is recompiled should be if its source code changes or if the project-wide configuration changes.

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: How to compile single component

Postby Gfast2 » Mon Dec 04, 2017 8:55 pm

kolban wrote:It should be that the source of a component is only compiled/recompiled when the source of it changes. Are you asking about creating "libraries" of pre-built components as opposed to the idea of compiling a single component?

The down-side of building a pre-made library is that the component code leverages per project configuration from "make menuconfig". If you compile a component using one SDKCONFIG that may not match the settings in an SDKCONFIG for your current project and time spent hunting that down would wipe away (and then some) any small workflow improvements.

This all said ... I'd still love to hear your thinking ... it is VERY possible that you are seeing something I don't and you are on to a good thing.
Hi Kolban, ESP_Angus,

Thanks for yor advices, they are very informative!

My goal is eventually port this brain burning library Open62541 (related question is HERE)

My question is actually this one:

This library deployed cmake to build itself first, after successful build, though I'v got my "libopen62541.a", but its header file is not generated ("open62541.h"). When I wanna include this header file in other units, I just surely can not pass the compiling. This is my component.mk. Is something still missing?


Thanks

Gfast2

Who is online

Users browsing this forum: No registered users and 111 guests