例如在HelloWorld中编译

$ cd ~/ESP/esp-idf/examples/get-started/hello_world
$ make
.......
CC build/wpa_supplicant/src/fast_crypto/fast_aes-wrap.o
CC build/wpa_supplicant/src/fast_crypto/fast_crypto_internal-cipher.o
CC build/wpa_supplicant/src/fast_crypto/fast_crypto_internal-modexp.o
CC build/wpa_supplicant/src/fast_crypto/fast_crypto_internal.o
CC build/wpa_supplicant/src/fast_crypto/fast_sha256-internal.o
CC build/wpa_supplicant/src/fast_crypto/fast_sha256.o
AR build/wpa_supplicant/libwpa_supplicant.a
CC build/xtensa-debug-module/eri.o
CC build/xtensa-debug-module/trax.o
AR build/xtensa-debug-module/libxtensa-debug-module.a
LD build/hello-world.elf
esptool.py v2.1-beta1
To flash all build output, run 'make flash' or:
python /Users/mango/ESP/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /Users/mango/ESP/esp-idf/examples/get-started/hello_world/build/bootloader/bootloader.bin 0x10000 /Users/mango/ESP/esp-idf/examples/get-started/hello_world/build/hello-world.bin 0x8000 /Users/mango/ESP/esp-idf/examples/get-started/hello_world/build/partitions_singleapp.bin
将编译好的固件下载到板子中,此处说明一下,推荐使用”make flash”命令烧写固件。强烈不推荐乐鑫的图形界面烧写。
 
$ make flash
Flashing binaries to serial port /dev/tty.SLAB_USBtoUART (app at offset 0x10000)...
esptool.py v2.1-beta1
Connecting........_
Chip is ESP32D0WDQ6 (revision 0)
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 16MB
Flash params set to 0x0240
Compressed 17536 bytes to 10296...
Wrote 17536 bytes (10296 compressed) at 0x00001000 in 0.9 seconds (effective 154.4 kbit/s)...
Hash of data verified.
Compressed 276016 bytes to 165532...
Wrote 276016 bytes (165532 compressed) at 0x00010000 in 14.6 seconds (effective 151.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 82...
Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 2189.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...