Preview release: CMake-based build system for ESP-IDF

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_Angus » Wed May 16, 2018 1:37 am

Hi Deouss,
Deouss wrote:UPDATE: I resolved the errors. Paths for needed headers were actually in Program Files folder - for some reason.

All compiled after running idf.py build. Compilation under VS Code
I'm glad you got everything working. I don't fully understand what you're telling me here - do you mean to begin with you were using VS Code and got the error, then you ran idf.py and it worked? Does VS Code work now as well?
Deouss wrote: Not sure because I was using VM and nothing was connected through USB.
So confirming that CMake works and I don't know if I can make it compile faster.
Msys32 uses some multi core features - -j8 option or something?
If you're using Ninja as the final build tool[*] then it should automatically detect the number of cores you have and parallelise automatically. If the VM itself only has one core then it can't parallelise very much, though! Depending on your VM host software, you should be able to assign additional core(s) to the VM in its configuration.

"make -j8" (or similar) will work for the MSYS-based build system or if you use CMake to generate a Makefile.

[*] If you followed the default install directions then idf.py will be using Ninja, VSCode might be using something else.

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Wed May 16, 2018 3:09 am

I was able to open project with Visual Studio Code having C++ and Native Debugger installed so IDE was fully working with intellisense and any code modification for the esp compiler.

I used CMake setup as in the guides - I am new to this compiler and environment so don't quite understand what is the difference between CMake and Make except that they use a different tool for linking and compiling I guess

Also I must add VSC is just pure IDE and building commands are set up by the users themselves.
I am trying to figure out if I can redirect the console messages to the terminal in the VSC IDE

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Wed May 16, 2018 1:43 pm

Well, I managed to connect and flash my ESP32 DevKit C. Works like a charm however I hardcoded flash command and port.
Turns out all is blasting fast and long compilation is only the first time. It is actually faster than Arduino IDE.
I am also checking PlatformIO as it supposingly has support for all major IoT frameworks.
They actually added ESP-IDF framework to their IDE - unbelievable!
I will get back with updates on that

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Thu May 17, 2018 12:05 pm

Regarding PlatformIO - looks like for now only Python and microPython is supported.
There are C files but projects require Python compiler.
So best bet is pure VSCode and CMake toolchain.

By the way - can you tell me the advantages of CMake over Make ?
In other words - what are the differences running msys32 and idf.py for building projects?

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_Angus » Fri May 18, 2018 2:08 am

Deouss wrote: By the way - can you tell me the advantages of CMake over Make ?
In other words - what are the differences running msys32 and idf.py for building projects?
The reasons for moving to CMake are given in the first post of this thread. I'm not sure that I have much new to add. If you have questions about the details of specific things mentioned there, feel free to ask them.

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Fri May 18, 2018 2:38 am

OK thanks. I just read the features of CMake build and it is really promising.
I am using it with VSCode and works very reliable and fast. Also there are some questions related to monitor and console.
When I am running idf.py through powershell - it opens a separate window in the integrated terminal - unlike cmd.exe which transparently displays all console output in same terminal window. Serial monitor extension does not seem to work but I noticed there is 'monitor' feature for idf.py. Is it for serial port monitoring? Also - do you consider writing extensions for VSC - it is all very simple in javascripts.

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Fri May 18, 2018 11:49 pm

ESP_Angus wrote: There is a new automatic conversion tool to convert simple projects from the GNU Make based build system to CMake. It's documented here: https://docs.espressif.com/projects/esp ... rsion-tool

(I recommend following the Getting Started guide and building one of the examples before trying to use the automatic conversion tool.)
I am trying to convert TFT library to CMake project
https://github.com/loboris/ESP32_TFT_library

But getting parsing and converting errors.
Maybe you could help with that
Thanks

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_Angus » Mon May 21, 2018 2:33 am

Deouss wrote: When I am running idf.py through powershell - it opens a separate window in the integrated terminal - unlike cmd.exe which transparently displays all console output in same terminal window.
Do you mean "idf.py menuconfig", or "idf.py build"? For menuconfig, we build a special mconf.exe with pdcurses that assumes it's running in a Windows Command Prompt window. So I'm not sure it's possible for PowerShell to process the API calls it makes. For the other targets, these should run in the PowerShell window itself.
Deouss wrote: Serial monitor extension does not seem to work but I noticed there is 'monitor' feature for idf.py. Is it for serial port monitoring?
It is. You can read more about it here: https://docs.espressif.com/projects/esp ... nitor.html
Deouss wrote: Also - do you consider writing extensions for VSC - it is all very simple in javascripts.
We have considered this, and should hopefully be announcing something soon...

Deouss
Posts: 278
Joined: Tue Mar 20, 2018 11:36 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby Deouss » Mon May 21, 2018 4:44 am

Anyways - I looked a bit through CMake documentation and example projects that have complex CMake components.
So I managed to convert the TFT library myself and it worked without problems)
Compilation is faster than Arduino IDE!

Commands like idf.py -p COM3 flash monitor are great tools !
Note that idf.py menuconfig will not work under cmd.exe shell - error about column number too small.
Also - menuconfig could be done in C# WPF as nice tool or just embed it under vsc extension that you will announce I hope )

Well- convert_to_cmake.py does not work basically

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_Angus » Mon May 21, 2018 6:41 am

Deouss wrote: Well- convert_to_cmake.py does not work basically
Without seeing more details of error output, etc then it's hard to tell what this means. However, one thing to note is that the convert_to_cmake.py tools assumes that you have the "old" build system (it uses "make" from the old build system to parse the project). So this might be the reason for any total failures you're seeing.

Return to “ESP32 IDF”

Who is online

Users browsing this forum: viduata and 17 guests