My setup IDF_PATH --> sudo nano ~/.zshrc
1. Toolchain Setup
ESP8266 toolchain for macOS is available for download from Espressif website:
https://dl.espressif.com/dl/xtensa-lx106-elf-macos-1.22.0-100-ge567ec7-5.2.0.tar.gz
Download this file, then extract it in ~/esp directory:
mkdir -p ~/esp
cd ~/esp
tar -xzf ~/Downloads/xtensa-lx106-elf-macos-1.22.0-100-ge567ec7-5.2.0.tar.gz
To use it, you will need to update your PATH environment variable in ~/.zshrc file. To make xtensa-lx106-elf available for all terminal sessions, add the following line to your ~/.zshrc file:
export PATH=$PATH:$HOME/esp/xtensa-lx106-elf/bin
export PATH=$PATH:$HOME/esp/xtensa-lx106-elf/bin
ESP32 toolchain for macOS is available for download from Espressif website:
https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2020r1-macos.tar.gz
Download this file, then extract it in ~/esp directory:
mkdir -p ~/esp
mkdir -p ~/esp
cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-gcc8_2_0-esp-2020r1-macos.tar.gz
To use it, you will need to update your PATH environment variable in ~/.zshrc file. To make xtensa-esp32-elf available for all terminal sessions, add the following line to your ~/.zshrc file:
export PATH=$HOME/esp/xtensa-esp32-elf/bin:$PATH
sudo nano ~/.bash_profile
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
2. Get SDK
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
2. Get SDK
~/esp directory to install the prebuilt toolchain, ESP8266_RTOS_SDK and sample applications.
cd ~/esp
git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git
or
or
git clone --recursive https://github.com/espressif/ESP8266_NONOS_SDK.git
or
git clone --recursive https://github.com/espressif/esp-idf.git
or
git clone --recursive https://github.com/espressif/esp-idf.git
https://docs.espressif.com/projects/esp-idf/en/v3.3.1/get-started/index.html#setup-path-to-esp-idf
The toolchain programs access ESP8266_RTOS_SDK using IDF_PATH environment variable.
3. Setup Path
Not all shells use .profile. If you have /bin/bash and .bash_profile exists then update this file instead. For zsh, update .zprofile. Other shells may use other profile files (consult the shell’s documentation).
sudo nano .zshrc
add
macOS Catalina 10.15.5 uses .zprofile instead of .bash_profile
Open terminal
Open terminal
sudo nano .zshrc
add
or
export IDF_PATH="~/esp/ESP8266_RTOS_SDK:$IDF_PATH"
or
export IDF_PATH="~/esp/ESP8266_NONOS_SDK:$IDF_PATH"
source ~/.zshrc
echo $IDF_PATH or printenv IDF_PATH
export PATH=$PATH:$HOME/esp/xtensa-lx106-elf/bin
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
export IDF_PATH=~/esp/ESP8266_RTOS_SDK
sudo nano ~/.bash_profile then need add source ~/.bash_profile to .zshrc
python -m pip install --user -r $IDF_PATH/requirements.txt
5. Start a Project
Copy get-started/hello_world to ~/esp directory:
cd ~/esp
look up the board
make flash
This will compile the application and all the ESP8266_RTOS_SDK components, generate bootloader, partition table, and application binaries, and flash these binaries to your ESP8266 board.
====
make all
It will compile app based on the config.
When make all finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this from make by running:
make flash
This will flash the entire project (app, bootloader and init data bin) to a new chip. The settings for serial port flashing can be configured with make menuconfig.
You don't need to run make all before running make flash, make flash will automatically rebuild anything which needs it.
The setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining IDF_PATH in the user profile.
For manually, the command:
export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
export IDF_PATH=~/esp/ESP8266_RTOS_SDK
sudo nano ~/.bash_profile then need add source ~/.bash_profile to .zshrc
sudo nano ~/.profile then always use source ~/.profile
sudo nano ~/.zprofile
sudo nano ~/.zprofile
4. Install the Required Python Packages
5. Start a Project
Copy get-started/hello_world to ~/esp directory:
cp -r $IDF_PATH/examples/get-started/hello_world
6. Connect the boardlook up the board
ls /dev/tty.*
/dev/tty.usbserial-1420
/dev/tty.wchusbserial1420
7. Configure
cd ~/esp/hello_world
Navigate to Serial flasher config > Default serial port
to configure the serial port with /dev/tty.wchusbserial1420
8. Build and Flash
/dev/tty.wchusbserial1420
7. Configure
cd ~/esp/hello_world
make menuconfig
ERROR No such file or directory ...
source ~/.profile
ERROR No such file or directory ...
source ~/.profile
to configure the serial port with /dev/tty.wchusbserial1420
8. Build and Flash
make flash
This will compile the application and all the ESP8266_RTOS_SDK components, generate bootloader, partition table, and application binaries, and flash these binaries to your ESP8266 board.
====
make all
It will compile app based on the config.
When make all finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this from make by running:
make flash
This will flash the entire project (app, bootloader and init data bin) to a new chip. The settings for serial port flashing can be configured with make menuconfig.
You don't need to run make all before running make flash, make flash will automatically rebuild anything which needs it.
8.1 Erasing Flash
The make flash target does not erase the entire flash contents. However, it is sometimes useful to set the device back to a totally erased state.
To erase the entire flash, run:
make erase_flash
9. Serial Monitor
make monitor
=== Troubleshooting ===
9. Serial Monitor
make monitor
=== Troubleshooting ===
The setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining IDF_PATH in the user profile.
For manually, the command:
export IDF_PATH=~/esp/ESP8266_RTOS_SDK