the biggest issue with the esp32 is the ide and build system..

ianr341
Posts: 8
Joined: Fri Jan 25, 2019 10:44 pm

the biggest issue with the esp32 is the ide and build system..

Postby ianr341 » Fri May 21, 2021 6:50 am

I've been using the esp32 since it came out, and have put it into a commercial product. I'm currently doing software for another commercial product that will probably be using it.

The trouble is the IDE and build system (ie cmake).

Nobody can write complex software in the ardunio ide, most of the people I know use the sloeber eclipse plugin. This vastly simplifies managing multiple directories for a project - and you never have to edit a make file by hand. Even if you aren't using the ardunio libraries - and I moved away from them some years ago as quite a few things they do aren't suitable for what I'm writing - it makes it easy to use the IDF.

The problem is, now that I'm back to doing a esp32 project, sloeber doesn't support idf>4. And too many bug fixes are now in idf>4!

So what does? I tried the vscode extension first, and rapidly gave up. If you want to write a program that's all in one file, or just a few files that belong to one project, it's probably usable. If you have over 100 files and a complex project structure shared between projects, don't even try...

Next was the (now) official eclipse plug-in. It wasn't hard to get working (under windows) - but soon as you start adding extra directories and editing cmake files the problems start... I've ended up with project.cmake permanently open in one window so I can look and try and figure what is going on. I mean, you should be able to include things like

Code: Select all

#include "esp_log.h"
in a component and have it auto found. Nope. It's found in the main.c, but not in the components...

Why is this all so tricky? - ie why do we have to spend more time on the build system than writing code? Have any of the expressiff guys looked at sloeber and seen how the interface should work? On the official one you have to even get out of a connected terminal to upload new firmware - in sloeber it disconnects and reconnects for you... And what was this idea of breaking things into 'components' for anyway? Why should it matter what a sub or external directory is called?

I'm finding it very frustrating, and am wonder if I do this project with the esp32 - which means I probably have to completely go through the build system and write a plugin for it - or use something else..

Which is a shame, as the hardware is great. But please please please do something about the IDE.

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ESP_bignacio » Fri May 21, 2021 8:27 am

So what does? I tried the vscode extension first, and rapidly gave up. If you want to write a program that's all in one file, or just a few files that belong to one project, it's probably usable. If you have over 100 files and a complex project structure shared between projects, don't even try...
What issue did you encountered when using the vscode extension ? Would be glad to receive concrete feedback that would help us to improve the extension and the extension UX.

You mention working with complex project structure don't even try. Why ?

Visual Studio Code has a way to work with multiple folders in https://code.visualstudio.com/docs/edit ... workspaces
and our extension follows the IDE approach as mentioned in https://github.com/espressif/vscode-esp ... ROJECTS.md and the source file headers resolution depends on the Microsoft C/C++ extension as described in https://github.com/espressif/vscode-esp ... URATION.md

Thank you. With your feedback we can improve the development experience.

ns1668
Posts: 50
Joined: Tue Mar 16, 2021 2:00 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ns1668 » Fri May 21, 2021 9:18 am

I use vscode without the extension, and have edited the vscode workspace settings to point to the correct compiler.
On top of that I have vscode tasks that just run some basic build scripts - calling idf.py from within vscode, this gives me build functionality and vscode hooks into it for compiler errors/warnings.

Yes you need to manage the cmake file and it can be tedious for a very large project, but once its done its done right?

ianr341
Posts: 8
Joined: Fri Jan 25, 2019 10:44 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ianr341 » Thu May 27, 2021 1:04 am

OK, make several (say 4) directories that are not sub directories of a specific project ie directories of common classes that multiple projects are going to use. Put 50 classes (with headers) in each directory.

Now get vscode to access those directories for both including the header files, and for linking. Tell me how you do it...

In something like sloeber (the eclipse addin that works with the older esp32 idf and ardunio-esp32) it's trivial - just go to the project c++ settings and add each directory. 30 seconds or so.

After vscode (which doesn't work as well as an ide than eclipse anyway) show me how you will do it with the eclipse addin (which doesn't include the C/C++ gui options to set directories etc).

ns1668
Posts: 50
Joined: Tue Mar 16, 2021 2:00 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ns1668 » Thu May 27, 2021 7:55 am

Now get vscode to access those directories for both including the header files, and for linking. Tell me how you do it...
Edit the CMakeLists.txt file for your project, add them as follows:

Code: Select all

idf_component_register(
SRCS    "src1.c"
	"src2.c"
	"FolderN/srcN.c"
        "main.c"


INCLUDE_DIRS    "." 
                "./Folder1"
                "./Folder2"
                "./Folder3"
                "./Folder4"
                ".."
)
That will handle the compiler/linker.
To get the C/C++ indexer/intellisense working correctly in vscode you can edit c_cpp_properties.json (located at .vscode folder in your project) as follows:

Code: Select all

{
    "configurations": [
        {
            "name": "ESP32",
            "includePath": [
                "C:\\esp-idf\\components\\**",
                "C:\\Users\\YOURUSERNAME\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\lib\\gcc\\xtensa-esp32-elf\\8.4.0\\include\\**",
                "${workspaceFolder}",
                "${workspaceFolder}\\**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "${default}",
            "compilerPath": "C:\\Users\\YOURUSERNAME\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe"
        }
    ],
    "version": 4
}
You can select your current configuration from the commands panel: "Ctrl + Shift + P" > "C/C++ Select a Configuration..."

You can reset the intellisense database from the commands panel as well > "C/C++ Reset IntelliSense Database".
If you have actual esp-idf sub projects that you want to include then this will handle it too.
After vscode (which doesn't work as well as an ide than eclipse anyway) show me how you will do it with the eclipse addin (which doesn't include the C/C++ gui options to set directories etc).
I disagree - once I learnt how to use build tools correctly I have much fewer issues such as missing includes, unable to link libraries correctly, etc.

I have not used the eclipse add-on. I do use eclipse for other projects and adding files/folders via the project properties works as expected. I have avoided using the addons for vscode and eclipse because these things can get behind in terms of updates/maintenance, breaking my entire development environment - which would require me to fix it manually anyway. IMO it is less frustration over time to just do it manually.

ianr341
Posts: 8
Joined: Fri Jan 25, 2019 10:44 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ianr341 » Fri May 28, 2021 1:22 am

Code: Select all

 adding files/folders via the project properties w
- so the trick for eclipse is NOT to use the extension, so that the normal menus etc are visible? Has anyone tried that with the idf?

With vscode I'll try what you sugested, I just don't find vscode as usable as eclipse generally - but if that works (and if I can't get it working in eclipse) I'll give it a go for a large project and see how it goes.

Thanks, I'll report back soon. Though my central point remains, it this shouldn't be this hard.

ianr341
Posts: 8
Joined: Fri Jan 25, 2019 10:44 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ianr341 » Fri May 28, 2021 1:31 am

Code: Select all

SRCS    "src1.c"
	"src2.c"
	"FolderN/srcN.c"
        "main.c"
And do you really mean to list over 100 source files (and which directory) here, one by one?

ianr341
Posts: 8
Joined: Fri Jan 25, 2019 10:44 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby ianr341 » Fri May 28, 2021 3:09 am

Code: Select all

idf_component_register(
SRC    "main.c"
	"/FolderN/srcN.c"


INCLUDE_DIRS    "." 
                "/FolderN"
                ".."
)
Does indeed work, only leaving the issues of -
  • listing every source code file individually (thus losing half the power of 'make')
  • the eclipse addin won't find the system include files (say "esp_log.h") if the source code isn't in the project (or its component directory) directory. This puts errors in the 'Problems' tab even though the compile is fine.
  • you have to get out of the serial monitor to upload.
It's just all a bit half done. And getting everyone one who has to write code to learn the ins and outs, and manually build, cmake files is silly.

I'm still to try the vscode suggestion above with the c_cpp_properties.json fix. The trouble I have with vs code is that it isn't that usable if you have a lot (say 200) files in a project, and is really not good at several projects that sized open at once...

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: the biggest issue with the esp32 is the ide and build system..

Postby ESP_Dazz » Fri May 28, 2021 11:19 am

ianr341 wrote: listing every source code file individually (thus losing half the power of 'make')
Regarding adding source files one by one, you can use SRC_DIRS to list directories instead (See the doc section regarding file globbing for more details)

nonagon
Posts: 19
Joined: Thu May 06, 2021 12:56 pm

Re: the biggest issue with the esp32 is the ide and build system..

Postby nonagon » Tue Jun 22, 2021 3:48 pm

I noticed same problems, ESP32 family lacks a serious IDE, a good build system and a decent debug experience to be at the same level of other microcontrollers.
From one side I think it's the only MCU on the market that combine the specifications to run Wifi, Tcp, SSL stack etc.. with powerful API's and a good framework (ESP IDF) with very good documentation (competitors have powerful MCUs but you have to cry to run a Wifi\TCP Stack on it without an OS).
The price is simply the best on the market but.. the debugging experience is terrible. I suggest to ESP32 team to download and try some IDE like xxx Studio (I dont' want to advertise no one, i think you can guess, there are 2-3 big companies at the same level) and try it with a xxx debug tool and a xxx evalutation board, when you will reach that fluidity and debug speed (and maybe use Visual Studio on the place of Visual Studio Code -that is a toy- ) you will be the standard on the market, but for now for big projects is better to stay away from ESP32.
I hope you will follow the users feedbacks, I'm just before production with two products mounting ESP32 and ESP32-S2.
I hope to continue to be your user in future.

Who is online

Users browsing this forum: No registered users and 26 guests