Developing without the full toolchain

jpan127
Posts: 8
Joined: Sat Aug 26, 2017 10:11 pm

Developing without the full toolchain

Postby jpan127 » Sun Jun 10, 2018 11:05 pm

Hi, I have been using the IDF framework / toolchain for a while now and I was wondering if there was a supported way or if anyone explored developing without the full toolchain.

I guess I am not sure which, if any, part of the toolchain could be circumvented. Ideally I would like to not use MSYS2 and develop with my preferred build system and not Make. I would also like to selectively compile what I need from the IDF framework into a static library so it will never need to be recompiled and does not need as much bloat.

Some of the current scripts are awesome, like make flash, make monitor, make menuconfig. I would like to incorporate that into my own development environment but without Make.

I guess an additional question is, is using MSYS2 a must? And if not, does anyone have any pointers into creating their own development environment? I would prefer to stay on the command line and not use Eclipse too.

Thanks!

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

Re: Developing without the full toolchain

Postby ESP_Angus » Mon Jun 11, 2018 12:19 am

Hi jpan27,

If MSYS2 is the main sticking point then you might want to take a look at the CMake-based build system (currently in preview release) which doesn't require MSYS2:
https://esp32.com/viewtopic.php?f=13&t=5559&p=24109
jpan127 wrote:selectively compile what I need from the IDF framework into a static library
It's theoretically possible to build IDF into static libraries (arduino-esp32 does this, for example). We don't currently have a supported way to do this with the current build system, but it's something we'd like to support in the future (probably as part of the CMake-based build system).
jpan127 wrote:it will never need to be recompiled and does not need as much bloat.
A couple of things to note:

- Even though a lot of files are compiled as part of an IDF build, only referenced symbols (ie functions and variables which are called from your project) are linked into the final binary. So if you don't use it, it can't "bloat" the final binary (it's as if it wasn't there at all, apart from the compile time overhead).

- If you don't change the configuration then you should only need to compile IDF source files once per project. Note that when IDF is pre-built into static libraries then it's not possible to change the configuration at all, for the same reason. After the first build of a project, "make" will only compile the source files which have changed (unless you "make clean").

We know that building on Windows can be painfully slow. Part of the goal for the CMake-based build system is to address this (faster building under Windows, and some improved logic about when to make incremental builds).

jpan127
Posts: 8
Joined: Sat Aug 26, 2017 10:11 pm

Re: Developing without the full toolchain

Postby jpan127 » Tue Jun 12, 2018 4:38 am

Hi Angus,

Thanks for the reply!

This is definitely in the direction I was hoping for. MSYS2 is one of the main reasons why I want to move away, but ultimately what I want is a minimal platform for me to use my own environment. I have a preferred build system, SCons, and would like to build up my own development pipeline rather than use (all) the provided scripts / tools.

If I was able to use my own build system I can definitely make it work with static libraries. I realize that Make / CMake / etc have their own method of tracking file changes and most of the time the files won't change so recompilation is not necessary. However, it is still a simpler option when the build directory is cleaned or switching back and forth between computers and recompilation is required. Also debatably easier to check in a static lib than a submodule for esp-idf. This is not a big deal, however, should be a simple change in whatever build script.

I guess my ideal goal is to know what is the bare minimum that is necessary to link into a flashable executable, where to get the compiler (xtensa?) directly, and then I can probably pick and choose which of your useful scripts to add to my pipeline.

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

Re: Developing without the full toolchain

Postby kolban » Tue Jun 12, 2018 1:31 pm

Maybe this will help?

http://esp-idf.readthedocs.io/en/latest ... ratch.html

It is a link to the documentation page on ESP-IDF which discusses how to build the Xtensa toolchain from source that is used to compile source files to build an ESP32 executable.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

jpan127
Posts: 8
Joined: Sat Aug 26, 2017 10:11 pm

Re: Developing without the full toolchain

Postby jpan127 » Sun Jun 17, 2018 12:11 am

Thanks Kolban!

I took a look at the typical make output with make -n and saw how the xtensa-esp32-elf-gcc is used.
It also shows how esptool.py is used to flash the program and the bootloader.

I think from this I can figure out how everything is done and it doesn't seem as complex / obfuscated as I originally thought.

Who is online

Users browsing this forum: No registered users and 112 guests