Environment setup
In my development I use currently MacOS. I have set up environment using guide from Read the Docs. Jump to this page and check for update, I put quick list which is copy of their list
- Instal pip package manager
sudo easy_install pip
- Install pyserial for accessing serial port
sudo pip install pyserial
- Download ESP32 toolchain from Espressif website and extract to esp directory
cd curl -O https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-61-gab8375a-5.2.0.tar.gz mkdir -p ~/esp cd ~/esp tar -xzf ~/xtensa-esp32-elf-osx-1.22.0-61-gab8375a-5.2.0.tar.gz
- Update your PATH variable either by creating alias or setting updating .profile file
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
- Get ESP32 API and libraries from Espressif’s ESP-IDF repository.
cd ~/esp git clone --recursive https://github.com/espressif/esp-idf.git - Set IDF_PATH variable so toolchain has access to ESP-IDF
export IDF_PATH=~/esp/esp-idf - Check device name of serial connection to ESP32. As I am using Mac I run the command below twice – with unplugged and plugged board to identify correct device

ESP32 connected to Mac ls /dev/tty.* /dev/tty.usbserial-DN01DXXH
Note name of the port as it will be needed later.
- When plugged check if chip is working using for example screen command
screen /dev/tty.usbserial-DN01DXXH 115200Example output of serial from ESP32
Getting Hello World
ESP-IDF comes with several example projects, here we start traditionally with Hello World. Let’s copy it to esp directory to test it.
cd ~/esp cp -r $IDF_PATH/examples/get-started/hello_world .
Jump to the directory and using make command execute configuration utility menuconfig.
cd ~/esp/hello_world
make menuconfig

Set serial port to correct one for your machine.

Now just build, flash and see if it works
make flash Flashing binaries to serial port /dev/tty.usbserial-DN01DXXH (app at offset 0x10000)... esptool.py v2.0-beta3 Connecting...... Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 4MB Flash params set to 0x0220 Compressed 15824 bytes to 9221... Wrote 15824 bytes (9221 compressed) at 0x00001000 in 0.8 seconds (effective 152.2 kbit/s)... Hash of data verified. Compressed 355088 bytes to 167202... Wrote 355088 bytes (167202 compressed) at 0x00010000 in 14.9 seconds (effective 191.1 kbit/s)... Hash of data verified. Compressed 3072 bytes to 82... Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 1548.1 kbit/s)... Hash of data verified. Leaving... Hard resetting...
and if everything went fine
make monitor I (1143) cpu_start: Starting scheduler on PRO CPU. Hello world! I (202) cpu_start: Starting scheduler on APP CPU. This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 0, 4MB external flash Restarting in 10 seconds... Restarting in 9 seconds... Restarting in 8 seconds... Restarting in 7 seconds... Restarting in 6 seconds... Restarting in 5 seconds... Restarting in 4 seconds... Restarting in 3 seconds... Restarting in 2 seconds...
What next
Definitely important reading is project and components structure. I will try and address it during next exercises.
Furthermore some more reading on memory and partitions and application entry points.
void app_main() { printf("Hello world!\n"); /* Print chip information */ esp_chip_info_t chip_info; esp_chip_info(&chip_info);
It is app_main.
Coming back to reading, flashing and hopefully I’ll manage to explain it more and better.
/Rook

One thought on “ESP32 – Hello world!”