Precompile ESP32 core

nrcrast
Posts: 17
Joined: Mon Apr 16, 2018 6:07 pm

Precompile ESP32 core

Postby nrcrast » Mon Apr 16, 2018 7:03 pm

Hi guys,

I'm working on an unusual project for the ESP32, and I'm wondering if there's an easy way to precompile most of the ESP32 libraries so that I can just link them instead of compiling them every time? Stuff like bluedroid and lwip take a long time to compile, and I would prefer to just have a static lib I can link in.

Ideally, I would like to be able to run some sort of make that spits out one bit .a file that I can just link in with the few files that I'm actually working on.

The general idea is that I want to be able to zip up all of the static libs/include files/my source and send them to a server that does the compilation and then returns the final binary. I'm trying to minimize compile time on the server.

-Nick

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

Re: Precompile ESP32 core

Postby ESP_Angus » Tue Apr 17, 2018 12:05 am

There isn't really anything like this at the moment, however if you keep the "build" directory between builds then nothing unchanged should be recompiled on a second "make" unless you change config (which requires everything to be recompiled, with the new config settings).

The other thing you can do is install "ccache" on your server, this can help a lot with build times (there are a few ways to configure ccache, but the easiest is to go to "SDK Tools" in menuconfig and set the compiler prefix to "ccache xtensa-esp32-elf-".)

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

Re: Precompile ESP32 core

Postby kolban » Tue Apr 17, 2018 1:28 am

For a project I'm working on at the moment, I am doing something similar.

I have the following:

/build/esp-idf <--- The ESP-IDF
/build/esp-idf-template <--- A normal template app that I run "make" within that results in a hello world app. This owns "sdkconfig"
/build/source <--- My application source. This contains my source plus a "hand-made" linker shell script that links everything together. Basically I just copied the commands that are executed by the normal build system.

This technique means that when the source files of my project change, only they need be recompiled. This has then been dockerized so that we can compile user applications that are edited through a browser.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

nrcrast
Posts: 17
Joined: Mon Apr 16, 2018 6:07 pm

Re: Precompile ESP32 core

Postby nrcrast » Tue Apr 17, 2018 4:55 pm

ESP_Angus wrote:There isn't really anything like this at the moment, however if you keep the "build" directory between builds then nothing unchanged should be recompiled on a second "make" unless you change config (which requires everything to be recompiled, with the new config settings).

The other thing you can do is install "ccache" on your server, this can help a lot with build times (there are a few ways to configure ccache, but the easiest is to go to "SDK Tools" in menuconfig and set the compiler prefix to "ccache xtensa-esp32-elf-".)
Thanks Angus,

The issue with your first approach, in my case, is that you cannot move the build directory after building. All of .o files and stuff like that have absolute paths in them.

I will look into ccache. If it can save me enough time, then that seems like a simple way to go.

Thanks,
-Nick

Who is online

Users browsing this forum: ESP_rrtandler, Google [Bot], mikecarlos and 125 guests