If you need help with setup IDF env - have a look at my previous post https://warzycha.pl/esp32-and-cloud/

In this tutorial, I will walk you through all steps required to build, flash, and monitor your own firmware.

Examples directory

The main reason why I have chosen IDF as an environment is a vast library of ready to use examples. It ranges from simple hello-world to complex topics such as provisioning using Wi-Fi/Bluetooth and external mobile apps.

Important: Some example projects may not work with a particular IDF version, this is not frequent, but examples may need some updating/fixing. Most common should work without any changes.
ESP-IDF examples library

Configuration

Some projects required configuration to be prepared before flashing. In such cases, we can either use sdkconfig file or GUI to provide, f.e. Wi-Fi setup.

IDF Menuconfig
Info: There is also a CLI version of this UI for more command-line focused individuals.

Build

Thanks to all toolchains installed previously, we will be able to build this hello-world project safely.

Flash

During flashing previously created image is uploaded to the device, and after the restart, we can see the result in the serial port monitor.

Before flashing, select a specific port that your device resides in; this will differ between Linux, Windows, and Mac.

Monitor

To monitor device behavior, we can connect to it and review the logs provided.

To streamline this process, we can do it as a single command.

This is Gif combining all steps presented into one.