EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: SteveThackery on October 16, 2024, 10:15:18 am

Title: New to ESP32 - best IDE?
Post by: SteveThackery on October 16, 2024, 10:15:18 am
I've done a lot of coding using Arduino, originally in the Arduino IDE, latterly using the excellent VisualMicro plug-in for Visual Studio.  https://visualmicro.com (https://visualmicro.com)

I now want to take the next step to expand my skills and work with the ESP32 family.  I'm looking for an IDE that offers the usual syntax-aware editor, a programmer, a degree of debugging facilities, and a reasonably comprehensive set of libraries for the internal (and popular external) peripherals. I want any easy-ish on-ramp to start with, and then I plan to get closer to the "metal" when my confidence has built up.  In particular I want to get away from the high level of abstraction that Arduino offers, but preferably without having to hit the metal every time I want to read an I/O port.

I have two questions:

1/ Can you recommend an IDE that will do what I want?

2/ There are dozens of ESP32 modules out there; is there one that you recommend as a good introductory and learning platform?

Many thanks for your assistance.
Title: Re: New to ESP32 - best IDE?
Post by: bookaboo on October 16, 2024, 11:27:00 am
For IDE I just use VS Code with the ESP-IDF, it can be a pain to install, but basically install the ESP-IDF from the Espressif site, check that it works in ESP-IDF cmd, then install the VS Code extension.
Fairly simple, can always fall back on the command line.

Debugging can be done with GDB and OpenOCD, but it's such a pain to set up and clunky even when its running. It's nothing near as good as Visual Micro (or even Mplabx , which for all the hate it gets does simply work well as a debugger). I gave up on single stepping long ago, I have a bit of heap tracing on a tricky bug once, but other than that it's printf.

(if you want to do quick and dirty Arduino you can use the Platformio extension in VScode, pretty simple. But don't bother with Platformio for ESP-IDF, it just limits you).


As for which Dev module, doesn't really matter, the code ports well across devices. If it's just for learning I like the Lilygo devices with the TFT already attached, the ESP32-S3 is pretty nifty, can do JTAG over USB. https://www.lilygo.cc/products/t-display-s3?variant=42351558590645 (https://www.lilygo.cc/products/t-display-s3?variant=42351558590645)

Be prepared for some learning curve, they have their quirks, but then what doesn't!
Title: Re: New to ESP32 - best IDE?
Post by: Korchahin on October 16, 2024, 05:44:06 pm
For learning Embedded C in relation to any controller, the Arduino IDE is an excellent option. With ArduinoIDE they create huge serious projects, such as firmware for 3D printers or smart home applications.
Any platform allows you to reduce the level of abstraction. The modern level of availability of high-performance microcontrollers and optimized libraries allows you not to worry about spending time on low-level optimization and focus on solving the problem in a short time. Master interrupts, timers, and working with data transfer interfaces.
Raise the level of difficulty of tasks and set realistic, practical goals. When you have completely created several completed projects, you yourself will begin to understand what is required and for what purposes.
Good luck!
Title: Re: New to ESP32 - best IDE?
Post by: SteveThackery on October 16, 2024, 09:16:29 pm
Thank you both for your comments.

I like the idea of trying a new IDE so I will definitely try the ESP-IDF in VS Code, but @Korchanin makes a strong argument for Arduino IDE.  It occurs to me that I should, and will, try both environments.

Thank you again.  Any further thoughts or advice are welcome.
Title: Re: New to ESP32 - best IDE?
Post by: bsikar on October 17, 2024, 06:20:35 am
My favorite thing about the esp32 is the lack of needing an IDE for it to work flawlessly. Any IDE you want to use will work :) For me, I either use VSCode with the idf extension or I use vim in my terminal and the idf.py command which is amazing when I want to quickly flash something or do a quick tweak. If you have a preferred IDE you can always open a new terminal instance and run some commands such as `idf.py build` or `idf.py flash` :-+
Title: Re: New to ESP32 - best IDE?
Post by: tooki on October 17, 2024, 07:14:21 am
1/ Can you recommend an IDE that will do what I want?

2/ There are dozens of ESP32 modules out there; is there one that you recommend as a good introductory and learning platform?
1. Since you know and like VisualMicro, why not keep using it? The website expressly mentions that one of the supported debuggers is Espressif’s official debugger (ESP-PROG), so it stands to reason that ESP32’s can also be programmed.

Bear in mind that the Arduino framework on ESP32 is fundamentally a lightweight wrapper for the underlying ESP-IDF framework that runs on RTOS. It’s less common to do bare metal on ESP32, and some of the ESP32’s key features, notably Wi-Fi and Bluetooth, can only be used via the official API, as they are deliberately undocumented at the register level.

Anyway, what isn’t obvious to many is that you can access the entire ESP-IDF command set from within Arduino, since ESP-IDF and FreeRTOS are always used under the hood. At most you need to provide a path for the ESP-IDF header files so the compiler knows they exist. This means you can use familiar Arduino syntax for everyday stuff, and then use direct ESP-IDF (and FreeRTOS) calls as needed.

IIRC it’s also theoretically possible to use ESP-IDF as the “primary” IDE and include the Arduino framework as you would any other library.


The other super common toolchain for ESP32 with Arduino framework is, as others have said, PlatformIO. That’s what I use most of the time. It doesn’t support quite as many boards as Arduino IDE, though.

2. There are tons of good boards, from the ubiquitous DEVKITC series of boards from Espressif, to the various clones and improved clones thereof (like Adafruit’s delightful Feather line), to more complex boards from Espressif (like the LyraT and Korvo lines for audio development and the BOX series with color LCDs for HMI applications) and others.

Regardless of which IDE you use, if you use ESP32 with the Arduino framework, beware that not all ESP32 chips are supported in the Arduino framework. The original ESP32 (no suffix), the ESP32-S2, -S3, -C3, -C6, and -H2 are supported, but the others are not. (Currently, that means the -P, -C2, -C5, and -C61 aren’t supported; you’d have to use these with ESP-IDF itself.)
Title: Re: New to ESP32 - best IDE?
Post by: bookaboo on October 17, 2024, 07:23:13 am
I could be wrong about this, but although you can access ESP-IDF functions via Arduino or Platformio, these platforms take time to get upgraded to the latest versions of ESP-IDF. For proof of concepts, quick projects etc most things will work fine, but when optimizing a "real" project eventually you will run into the need for some ESP-IDF bug-fix (plenty of these) or feature that's only available in a newer version.

This happened 90% of the way through a pretty large project, I had to port the whole thing to raw ESP-IDF. It was really only a matter of setting up cmakelists in each folder but I wish I'd just started with ESP-IDF.

I also heard Espressifs own IDE was much improved, but have not had the time to try it. 
Title: Re: New to ESP32 - best IDE?
Post by: SteveThackery on October 17, 2024, 08:51:40 am
Thank you for your excellent posts! I had no idea that Arduino on ESP32 sits on top of an RTOS (FreeRTOS, I assume), and it's great that I can move between "layers" as needed.

I definitely want to experiment with a different environment, as much as a learning exercise as anything, so I'll also have a poke around with VS Code, ESP-IDF and PlatformIO.

This has been a great thread for me - thank you again.
Title: Re: New to ESP32 - best IDE?
Post by: Salitronic on October 17, 2024, 09:55:47 am
I use VS-code with with ESP-IDF extension. You don't need to install ESP-IDF framework separately the extension will install it for you.
It all works really smoothly especially if using the USB-JTAG interface built into the ESP32.
I haven't used Espressif's own IDE in a long time so not sure if it has been improved, but VS-code + ESP-IDF is better.
Title: Re: New to ESP32 - best IDE?
Post by: radiolistener on October 18, 2024, 09:57:11 am
KDevelop as IDE debugger.
Geany as code editor, it allows to setup compile and run commands, so you can edit and run almost any language in it.