OT: using the ESP-IDF extension for Visual Studio Code

151 views
Skip to first unread message

newxito

unread,
Jan 10, 2025, 4:38:31 AM1/10/25
to neonixie-l
I like PlatformIO, but unfortunately, they do not support newer versions of the arduino-esp32 framework which are required for newer hardware (financial disagreement with espressif).
Since I use espressif MCUs with the arduino-esp32 framework in all my nixie projects, I’m currently looking for alternatives. I found these options:
- Arduino IDE
- PlatformIO using pioarduino
- pioarduino extension for Visual Studio Code
- ESP-IDF extension for Visual Studio Code
- ESP-IDF Eclipse plugin
I have not made a decision yet, but I spent some time migrating the firmware of a project to the ESP-IDF extension for vscode. Maybe the following will be useful for someone. It’s not a tutorial, just some reformatted notes on how it worked for me. As always use at your own risk.

Using the ESP-IDF Extension for Visual Studio Code with the arduino-esp32 component
-----------------------------------------------------------------------------------

+ Install Visual Studio Code
+ Install the ESP-IDF extension
+ Click "Configure ESP-IDF extension" and select EXPRESS
 - Set download server to github
 - Select the latest version of ESP-IDF that supports the latest version of the arduino-esp32 component
  (https://github.com/espressif/arduino-esp32/releases)
 - Click install

+ After installation create an ESP arduino project as follows:
 - Click "Components Manager" or run command "Show ESP Component Registry"
 - Search and select arduino-esp32
 - Go to examples, select hello_world and click "Create Project from this example"
 - Build the project
 - Close vscode and rename the project directory to the desired project name
 - Start vscode and use "open folder" to open the project folder
 - Copy the source files (c, cpp, hpp) to the main directory
 - Create an include directory
 - Copy the header files to the include directory

+ Edit CMakeList.txt in the main directory:
 - Register all c, cpp and hpp files in the directory, ignore h files
 - Specify include directories
 - Specify requirements

For example:

idf_component_register(SRCS
    "main.cpp"
    “driver.cpp”
    "helper.hpp"

    INCLUDE_DIRS "." "../include"
        "../components/Adafruit_BusIO"
        "../components/RTCLib"

    REQUIRES arduino-esp32
    REQUIRES nvs_flash
    )

+ Manually add arduino libraries:
 - Use command "Create New ESP-IDF Component"
 - Enter the name of the component, e.g. RTCLib
 - Delete everything in the components\RTCLib directory except CMakeList.txt
 - Manually copy the library code files (c, cpp, h, hpp) to the component\RTCLib directory
 - Edit CMakeList.txt file

Example CMakeList.txt file for RTCLib:

idf_component_register(SRCS
    "RTClib.cpp"
    "RTC_DS1307.cpp"
    "RTC_DS3231.cpp"
    "RTC_Micros.cpp"
    "RTC_Millis.cpp"
    "RTC_PCF8523.cpp"
    "RTC_PCF8563.cpp"

    INCLUDE_DIRS "." "../Adafruit_BusIO"
    REQUIRES arduino-esp32)

If the library depends on other libraries add an idf_component.yml file, for example:

dependencies:
  # Define local dependency with relative path
  Adafruit_BusIO:
    path: ../AdaFruit_BusIO

Some sdk options: (change with the "SDK Configuration Editor")

+ Compiler options for debugging, performance and size:
 - Assertion Level
 - Optimization Level

+ Arduino options (not set if creating the arduino project manually without using the example):
 - Kernel
   set ConfigTICK_RATE_HZ = 1000
 - TLS Key Exchange Methods
   Select "Enable pre-shared-key ciphersuites"
 - Arduino Configuration
   Select "Autostart Arduino setup and loop on boot"

+ A useful terminal command:
 - idf.py update-dependencies

+ Some useful vscode shortcuts:
 - Ctrl-Shift-P to "Show and Run Commands"
 - Alt-Shift-F  to format code

I used this to do a clean reinstall on windows:

+ vscode:
 - uninstall vscode
 - delete directory "%userprofile%\AppData\Roaming\Code"
 - delete directory "%userprofile%\.vscode"

+ esp-idf extension:
 - delete directory "%userprofile%\.espressif"
 - delete directory "%userprofile%\esp"



gregebert

unread,
Jan 10, 2025, 3:43:22 PM1/10/25
to neonixie-l
I evaluated Arduino about 15 years ago and decided against it because I thought there was only enough RAM/ROM for very simple projects.  So for a few years I used FPGAs, then Raspberry Pi Zero W, and now I have the ecosystem in-place to use FPGA, RasPi, or both. 

I'm curious how many lines of source code (it's similar enough to C) can be compiled onto an average Arduino device. 



newxito

unread,
Jan 10, 2025, 4:46:12 PM1/10/25
to neonixie-l
I use ESP32 WROOM modules for my projects. They cost less than $3, have Wi-Fi and Bluetooth, enough RAM and flash for nixie projects, and they are easy to solder. For the firmware I use the Arduino framework because of the dozens of very useful libraries. 

newxito

unread,
Jan 10, 2025, 5:11:03 PM1/10/25
to neonixie-l
That's the memory usage of my calculator project:
RAM:   [=         ]   7.2% (used 23640 bytes from 327680 bytes)
Flash:  [===       ]  27.9% (used 365721 bytes from 1310720 bytes)

Which tools and development environment do you use to program the Raspi Zero W?
And for the FPGA?

gregebert schrieb am Freitag, 10. Januar 2025 um 21:43:22 UTC+1:

gregebert

unread,
Jan 11, 2025, 12:24:13 AM1/11/25
to neonixie-l
For the RasPi, I just use C (gcc). Since it's a full Linux device, there's tons of stuff out there for free.
512MB of RAM, but a good chunk of that is for Linux. I usually have 32GB micro SD cards.
I write all of my own code, except the GPIO stuff (digitalRead, digitalWrite) is thru wiringPi.
It is handy, though, because I can just login to the RasPi from anywhere to do software development work, and I never need to plug-in cables, etc.

For FPGAs, I mostly use the Altera EP2C5 (25USD) , and sometimes the EPM240 (12USD). Both are available on PCBs on Ebay.
The Quartus software is free for compiling the FPGA code, and I use Modelsim for simulating the FPGA code (Verilog). I do have to physically plug the JTAG programmer into the USB port on my Linux server to update the FPGA code, but I try to minimize FPGA code changes (essentially freeze the "hardware"), and make all changes thru software. Sometimes that's not possible.

The RasPi + FPGA can do anything imaginable, but as I said, the main drawback is the boot time. Fortunately, our electric utility is pretty reliable, so unplanned reboots happen less than once per year.

David Pye

unread,
Jan 11, 2025, 4:45:35 AM1/11/25
to neoni...@googlegroups.com
A vote here for the Pi Pico.

Arm MCU, with good, well documented libraries.

WiFi version (Pico w) available and relatively cheap too.

I personally don't like the overhead of running a full Linux OS, and feel that a Pi of any sort is excessively overpowered for a (relatively simple) clock device.  

David

--
You received this message because you are subscribed to the Google Groups "neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neonixie-l+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/neonixie-l/b9391c7a-52b6-47d9-9d89-2b2ae1d8f9b6n%40googlegroups.com.

gregebert

unread,
Jan 11, 2025, 3:35:35 PM1/11/25
to neonixie-l
I considered moving to the PiPico2W, but the flash is only 4Mbytes so I'm nervous about running out of space for larger projects, especially if I need WiFi. I've gotten used to dumping lots of runtime info into logfiles for debugging & logging, and that requires having a filesystem or some sort of tethered development system. So as of today, no disruptive technology has emerged that has convinced me to change; maybe I'm too entrenched with the RasPi. 

For those of you who remember working on a VAX-11/780 mainframe, the RasPi outperforms it. Who in their right mind would have thought of using a VAX to run a nixie-tube clock ?

Mac Doktor

unread,
Jan 11, 2025, 6:13:26 PM1/11/25
to neonixie-l

On Jan 11, 2025, at 3:35 PM, gregebert <greg...@hotmail.com> wrote:

Who in their right mind would have thought of using a VAX to run a nixie-tube clock ?

it should run more than one, right? I was compiling FORTRAN back in the day along with who knows how many other people at the same time. I have no idea about the storage.


Terry Bowman, KA4HJH
"The Mac Doctor"

https://www.astarcloseup.com

"Every kid starts out as a natural-born scientist, and then we beat it out of them. A few trickle through the system with their wonder and enthusiasm for science intact."—Carl Sagan, Psychology Today, 1996

gregebert

unread,
Jan 11, 2025, 7:22:29 PM1/11/25
to neonixie-l
> it should run more than one, right? I was compiling FORTRAN back in the day along with who knows how many other people at the same time. I have no idea about the storage.

Definitely. Most clocks average 1-2% CPU usage when none of the GUI is being used, and that includes all the Linux overhead. Once you start moving the cursor around, scrolling text, etc, the usage jumps way up. Even holding the spacebar down pumps CPU utilization up to 50%. The RasPi is handy for control applications, but it really STINKS for most interactive work. Web-browsing on a RasPi is basically death-by-torture.

Generally, I have 1 RasPi for each clock. My incandescent clock (6 DTF104B numitrons, and 6 IEE single-plane displays) has a dongle cable so I can run them from the same RasPi, but that tether cable is kind of a nuisance, so I'm going to stay with 1 clock-per-RasPi. It does burn a bit more power, but not as much as a VAX.

Reply all
Reply to author
Forward
0 new messages