Development on Mac
Install Prerequisites
brew install cmake ninja dfu-util
Get ESP-IDF
See https://idf.espressif.com/ for links to detailed instructions on how to set up the ESP-IDF depending on chip you use.
Need to install esp-idf
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
Aside from the ESP-IDF, you also need to install the tools used by ESP-IDF, such as the compiler, debugger, Python packages, etc, for projects supporting ESP32.
cd ~/esp/esp-idf
./install.sh esp32s3
... All done! You can now run: . ./export.sh
he scripts introduced in this step install compilation tools required by ESP-IDF inside the user home directory: $HOME/.espressif on Linux.
$ . ./export.sh
Checking "python3" ...
Python 3.12.2
"python3" has been detected
Activating ESP-IDF 5.5
Setting IDF_PATH to '/Users/riguz/esp/esp-idf'.
* Checking python version ... 3.12.2
* Checking python dependencies ... OK
* Deactivating the current ESP-IDF environment (if any) ... OK
* Establishing a new ESP-IDF environment ... OK
* Identifying shell ... zsh
* Detecting outdated tools in system ... OK - no outdated tools found
* Shell completion ... Autocompletion code generated
compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_services
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
Set up the Environment Variables
vim ~/.zshrc:
alias get_idf='. $HOME/esp/esp-idf/export.sh'
Hello world
cd workspace
cp -r $IDF_PATH/examples/get-started/hello_world .
Connect to board (USB):
ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem14201
cd hello_world
idf.py set-target esp32s3
idf.py menuconfig # could be skipped for hello world
idf.py build
flash to chip, need to change baud rate to 115200, otherwise an error occurs[4]:
([Errno 16] could not open port /dev/cu.usbmodem14201: [Errno 16] Resource busy: '/dev/cu.usbmodem14201')
$ idf.py -p /dev/cu.usbmodem14201 -b 115200 flash
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Done
Monitor the output( use Ctrl+]
to exit):
$ idf.py -p /dev/cu.usbmodem14201 monitor
Hello world!
This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision v0.2, 2MB external flash
Minimum free heap size: 393436 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Vscode extension
- Install ESP-IDF Extension
- Execute "ESP-IDF: Configure ESP-IDF Extension" command
- Choose "Express" and continue
Tips:
- Use "ESP-IDF: Add vscode Configuration Folder" to create vscode config, then the include files could be located in vscode
- Use "ESP-IDF: Select port to use" to configure device
- Use “ESP-IDF: Set Espressif target" and set to esp32s3, with build-in usb-jtag
- Set flash method to UART
Arduino (WIP)
First, install Arduino-ESP32. Open Preference -> Additional board manager urls, and input[5]:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
# use mirror if download slow:
# https://shiinakaze.github.io/arduino-esp32-mirror/package_esp32_index.json
After that, select Tools -> board manager, and search esp32, install "Espressif Systems ESP32".
MANUAL install[6]:
mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32/tools && \
python get.py
- ↑ https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html#get-started-prerequisites
- ↑ https://docs.espressif.com/projects/esp-idf/en/v5.4.1/esp32s3/get-started/linux-macos-setup.html#get-started-set-up-tools
- ↑ https://github.com/espressif/vscode-esp-idf-extension/blob/master/README.md
- ↑ https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/establish-serial-connection.html
- ↑ https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
- ↑ https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#macos