赞
踩
1、模式选择:
2、确保 ESP32 模组正确的进入了下载模式:
- 1. 首先确保模组可以正常运行工作(即确保电源和串口连接正常);
- 2. 拉低 GPIO0,打开串口工具,在波特率
115200
下观察模组的启动或复位后的打印信息;- 3. 若出现以下红色字符则认为模组已经进入了下载模式,可以去正常进行下载。
rst:0x10 (RTCWDT_RTC_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)) waiting for download
3、ESP32 烧录地址及烧录文件:
ESP32 在编译时,通过 make menuconfig 来配置 Partition Table 分别支持 Single factory app, no OTA、Factory app, two OTA definitions、Custom partition table CSV
注意1:乐鑫在不同版本的 SDK 中有可能会改变这些烧录位置,以 Console 输出信息为准。
注意2:合并后的固件内已经包含了地址信息,只需烧写到 0x0 地址即可。
app_demo.bin 和 partitions_singleapp.bin 在项目文件夹 hello_world/build 下:
bootloader.bin 在项目文件夹 hello_world/build/bootloader 下:
启动信息(波特率:74880):
- ets Jun 8 2016 00:22:57
-
- rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
- configsip: 0, SPIWP:0xee
- clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
- mode:DIO, clock div:2
- load:0x3fff0018,len:4
- load:0x3fff001c,len:6824
- load:0x40078000,len:12072
- load:0x40080400,len:6708
- entry 0x40080778
- [0;32mI (72) boot: Chip Revision: 1[0m
- [0;32mI (72) boot_comm: chip revision: 1, min. bootloader chip revision: 0[0m
- [0;32mI (39) boot: ESP-IDF v3.3.1-85-gd3cc7c0da-dirty 2nd stage bootloader[0m
- [0;32mI (39) boot: compile time 12:02:28[0m
- [0;32mI (46) boot: Enabling RNG early entropy source...[0m
- [0;32mI (46) boot: SPI Speed : 40MHz[0m
- [0;32mI (50) boot: SPI Mode : DIO[0m
- [0;32mI (54) boot: SPI Flash Size : 4MB[0m
- [0;32mI (58) boot: Partition Table:[0m
- [0;32mI (62) boot: ## Label Usage Type ST Offset Length[0m
- [0;32mI (69) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m
- [0;32mI (77) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m
- [0;32mI (84) boot: 2 factory factory app 00 00 00010000 00100000[0m
- [0;32mI (92) boot: End of partition table[0m
- [0;32mI (96) boot_comm: chip revision: 1, min. application chip revision: 0[0m
- [0;32mI (103) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x08148 ( 33096) map[0m
- [0;32mI (123) esp_image: segment 1: paddr=0x00018170 vaddr=0x3ffb0000 size=0x01ebc ( 7868) load[0m
- [0;32mI (127) esp_image: segment 2: paddr=0x0001a034 vaddr=0x40080000 size=0x00400 ( 1024) load[0m
- [0;32mI (132) esp_image: segment 3: paddr=0x0001a43c vaddr=0x40080400 size=0x05bd4 ( 23508) load[0m
- [0;32mI (151) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x12cb0 ( 76976) map[0m
- [0;32mI (178) esp_image: segment 5: paddr=0x00032cd0 vaddr=0x40085fd4 size=0x02414 ( 9236) load[0m
- [0;32mI (187) boot: Loaded app from partition at offset 0x10000[0m
- [0;32mI (187) boot: Disabling RNG early entropy source...[0m
- [0;32mI (190) cpu_start: Pro cpu up.[0m
- [0;32mI (193) cpu_start: Application information:[0m
- [0;32mI (198) cpu_start: Project name: hello-world[0m
- [0;32mI (203) cpu_start: App version: v3.3.1-85-gd3cc7c0da-dirty[0m
- [0;32mI (210) cpu_start: Compile time: Jul 5 2020 12:02:47[0m
- [0;32mI (216) cpu_start: ELF file SHA256: 611fa1c956d86a56...[0m
- [0;32mI (222) cpu_start: ESP-IDF: v3.3.1-85-gd3cc7c0da-dirty[0m
- [0;32mI (229) cpu_start: Starting app cpu, entry point is 0x40080ee0[0m
- [0;32mI (216) cpu_start: App cpu up.[0m
- [0;32mI (239) heap_init: Initializing. RAM available for dynamic allocation:[0m
- [0;32mI (246) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
- [0;32mI (252) heap_init: At 3FFB2EE0 len 0002D120 (180 KiB): DRAM[0m
- [0;32mI (258) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
- [0;32mI (265) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
- [0;32mI (271) heap_init: At 400883E8 len 00017C18 (95 KiB): IRAM[0m
- [0;32mI (277) cpu_start: Pro cpu start user code[0m
- [0;32mI (295) cpu_start: Starting scheduler on PRO CPU.[0m
- [0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
- Hello world!
- This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 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...
- Restarting in 1 seconds...
- Restarting in 0 seconds...
- Restarting now.
附:运行代码
- void app_main()
- {
- printf("Hello world!\n");
-
- /* Print chip information */
- esp_chip_info_t chip_info;
- esp_chip_info(&chip_info);
- printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
- chip_info.cores,
- (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
- (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
-
- printf("silicon revision %d, ", chip_info.revision);
-
- printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
- (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
-
- for (int i = 10; i >= 0; i--) {
- printf("Restarting in %d seconds...\n", i);
- vTaskDelay(1000 / portTICK_PERIOD_MS);
- }
- printf("Restarting now.\n");
- fflush(stdout);
- esp_restart();
- }
1、使用AiThinkerIDE_V1.0\msys32里面的mingw64 查询当前串口号:
2、进入图形界面进行参数配置
设置串口和烧录参数
3、按照构建menuconfig菜单,再配置个下载选项
4、IDE右边框双击对应的Target可以执行
报错:
- make flash
- Toolchain path: /d/Professional_Software/AiThinkerIDE_V1.0/msys32/opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
- Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
- Compiler version: 5.2.0
- Python requirements from E:/Document_Pro/ESP32/ESP-IDF/esp-idf\requirements.txt are satisfied.
-
- App "hello-world" version: v3.3.1-85-gd3cc7c0da-dirty
- Flashing binaries to serial port /dev/ttyS4 (app at offset 0x10000)...
- esptool.py v2.8
- Serial port /??/COM5
- Traceback (most recent call last):
- File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 3201, in <module>
- _main()
- File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 3194, in _main
- main()
- File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 2889, in main
- esp = chip_class(each_port, initial_baud, args.trace)
- File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 237, in __init__
- self._port = serial.serial_for_url(port)
- File "D:\Professional_Software\Python27\lib\site-packages\serial\__init__.py", line 88, in serial_for_url
- instance.open()
- File "D:\Professional_Software\Python27\lib\site-packages\serial\serialwin32.py", line 62, in open
- raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
- serial.serialutil.SerialException: could not open port '/??/COM5': WindowsError(3, '\xcf\xb5\xcd\xb3\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc2\xb7\xbe\xb6\xa1\xa3')
- make: *** [/e/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/Makefile.projbuild:71: flash] Error 1
这个报错是提示串口号被占用 或者 找不到这个串口。
问题解决:
图形配置界面有问题,这里需要填windows下的串口号
烧录成功:
- esptool.py v2.8
- Flashing binaries to serial port /dev/COM5 (app at offset 0x10000)...
- esptool.py v2.8
- Serial port D:/Professional_Software/AiThinkerIDE_V1.5.2/msys32/dev/COM5
- Connecting....
- Chip is ESP32D0WDQ6 (revision 1)
- Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
- Crystal is 26MHz
- MAC: 98:f4:ab:6d:b1:f0
- Uploading stub...
- Running stub...
- Stub running...
- Configuring flash size...
- Auto-detected Flash size: 4MB
- Compressed 25712 bytes to 15293...
-
- Writing at 0x00001000... (100 %)
- Wrote 25712 bytes (15293 compressed) at 0x00001000 in 1.4 seconds (effective 152.3 kbit/s)...
- Hash of data verified.
- Compressed 151824 bytes to 72774...
-
- Writing at 0x00010000... (20 %)
- Writing at 0x00014000... (40 %)
- Writing at 0x00018000... (60 %)
- Writing at 0x0001c000... (80 %)
- Writing at 0x00020000... (100 %)
- Wrote 151824 bytes (72774 compressed) at 0x00010000 in 6.4 seconds (effective 189.0 kbit/s)...
- Hash of data verified.
- Compressed 3072 bytes to 103...
-
- Writing at 0x00008000... (100 %)
- Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 1536.0 kbit/s)...
- Hash of data verified.
-
- Leaving...
- Hard resetting via RTS pin...
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。