当前位置:   article > 正文

ESP32学习【2】——ESP32固件烧录及相关问题解决_esp32文件烧录地址

esp32文件烧录地址

一、烧录参数资料

1、模式选择:

 

2、确保 ESP32 模组正确的进入了下载模式:

  • 1. 首先确保模组可以正常运行工作(即确保电源和串口连接正常);
  • 2. 拉低 GPIO0,打开串口工具,在波特率​115200​下观察模组的启动或复位后的打印信息;
  • 3. 若出现以下红色字符则认为模组已经进入了下载模式,可以去正常进行下载。    
  1. rst:​0x10 (RTCWDT_RTC_RESET),​boot:​0x3 (DOWNLOAD_BOOT(UART0/​UART1/​SDIO_REI_REO_V2))
  2. ​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):

  1. ets Jun 8 2016 00:22:57
  2. rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
  3. configsip: 0, SPIWP:0xee
  4. clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  5. mode:DIO, clock div:2
  6. load:0x3fff0018,len:4
  7. load:0x3fff001c,len:6824
  8. load:0x40078000,len:12072
  9. load:0x40080400,len:6708
  10. entry 0x40080778
  11. [0;32mI (72) boot: Chip Revision: 1[0m
  12. [0;32mI (72) boot_comm: chip revision: 1, min. bootloader chip revision: 0[0m
  13. [0;32mI (39) boot: ESP-IDF v3.3.1-85-gd3cc7c0da-dirty 2nd stage bootloader[0m
  14. [0;32mI (39) boot: compile time 12:02:28[0m
  15. [0;32mI (46) boot: Enabling RNG early entropy source...[0m
  16. [0;32mI (46) boot: SPI Speed : 40MHz[0m
  17. [0;32mI (50) boot: SPI Mode : DIO[0m
  18. [0;32mI (54) boot: SPI Flash Size : 4MB[0m
  19. [0;32mI (58) boot: Partition Table:[0m
  20. [0;32mI (62) boot: ## Label Usage Type ST Offset Length[0m
  21. [0;32mI (69) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m
  22. [0;32mI (77) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m
  23. [0;32mI (84) boot: 2 factory factory app 00 00 00010000 00100000[0m
  24. [0;32mI (92) boot: End of partition table[0m
  25. [0;32mI (96) boot_comm: chip revision: 1, min. application chip revision: 0[0m
  26. [0;32mI (103) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x08148 ( 33096) map[0m
  27. [0;32mI (123) esp_image: segment 1: paddr=0x00018170 vaddr=0x3ffb0000 size=0x01ebc ( 7868) load[0m
  28. [0;32mI (127) esp_image: segment 2: paddr=0x0001a034 vaddr=0x40080000 size=0x00400 ( 1024) load[0m
  29. [0;32mI (132) esp_image: segment 3: paddr=0x0001a43c vaddr=0x40080400 size=0x05bd4 ( 23508) load[0m
  30. [0;32mI (151) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x12cb0 ( 76976) map[0m
  31. [0;32mI (178) esp_image: segment 5: paddr=0x00032cd0 vaddr=0x40085fd4 size=0x02414 ( 9236) load[0m
  32. [0;32mI (187) boot: Loaded app from partition at offset 0x10000[0m
  33. [0;32mI (187) boot: Disabling RNG early entropy source...[0m
  34. [0;32mI (190) cpu_start: Pro cpu up.[0m
  35. [0;32mI (193) cpu_start: Application information:[0m
  36. [0;32mI (198) cpu_start: Project name: hello-world[0m
  37. [0;32mI (203) cpu_start: App version: v3.3.1-85-gd3cc7c0da-dirty[0m
  38. [0;32mI (210) cpu_start: Compile time: Jul 5 2020 12:02:47[0m
  39. [0;32mI (216) cpu_start: ELF file SHA256: 611fa1c956d86a56...[0m
  40. [0;32mI (222) cpu_start: ESP-IDF: v3.3.1-85-gd3cc7c0da-dirty[0m
  41. [0;32mI (229) cpu_start: Starting app cpu, entry point is 0x40080ee0[0m
  42. [0;32mI (216) cpu_start: App cpu up.[0m
  43. [0;32mI (239) heap_init: Initializing. RAM available for dynamic allocation:[0m
  44. [0;32mI (246) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
  45. [0;32mI (252) heap_init: At 3FFB2EE0 len 0002D120 (180 KiB): DRAM[0m
  46. [0;32mI (258) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
  47. [0;32mI (265) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
  48. [0;32mI (271) heap_init: At 400883E8 len 00017C18 (95 KiB): IRAM[0m
  49. [0;32mI (277) cpu_start: Pro cpu start user code[0m
  50. [0;32mI (295) cpu_start: Starting scheduler on PRO CPU.[0m
  51. [0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
  52. Hello world!
  53. This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash
  54. Restarting in 10 seconds...
  55. Restarting in 9 seconds...
  56. Restarting in 8 seconds...
  57. Restarting in 7 seconds...
  58. Restarting in 6 seconds...
  59. Restarting in 5 seconds...
  60. Restarting in 4 seconds...
  61. Restarting in 3 seconds...
  62. Restarting in 2 seconds...
  63. Restarting in 1 seconds...
  64. Restarting in 0 seconds...
  65. Restarting now.

附:运行代码

  1. void app_main()
  2. {
  3. printf("Hello world!\n");
  4. /* Print chip information */
  5. esp_chip_info_t chip_info;
  6. esp_chip_info(&chip_info);
  7. printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
  8. chip_info.cores,
  9. (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
  10. (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
  11. printf("silicon revision %d, ", chip_info.revision);
  12. printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
  13. (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
  14. for (int i = 10; i >= 0; i--) {
  15. printf("Restarting in %d seconds...\n", i);
  16. vTaskDelay(1000 / portTICK_PERIOD_MS);
  17. }
  18. printf("Restarting now.\n");
  19. fflush(stdout);
  20. esp_restart();
  21. }

 

三、烧录方式二(AiThinkerIDE_V1.0)

1、使用AiThinkerIDE_V1.0\msys32里面的mingw64 查询当前串口号:

2、进入图形界面进行参数配置

设置串口和烧录参数

3、按照构建menuconfig菜单,再配置个下载选项

4、IDE右边框双击对应的Target可以执行

 

报错:

  1. make flash
  2. Toolchain path: /d/Professional_Software/AiThinkerIDE_V1.0/msys32/opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
  3. Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
  4. Compiler version: 5.2.0
  5. Python requirements from E:/Document_Pro/ESP32/ESP-IDF/esp-idf\requirements.txt are satisfied.
  6. App "hello-world" version: v3.3.1-85-gd3cc7c0da-dirty
  7. Flashing binaries to serial port /dev/ttyS4 (app at offset 0x10000)...
  8. esptool.py v2.8
  9. Serial port /??/COM5
  10. Traceback (most recent call last):
  11. File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 3201, in <module>
  12. _main()
  13. File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 3194, in _main
  14. main()
  15. File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 2889, in main
  16. esp = chip_class(each_port, initial_baud, args.trace)
  17. File "E:/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/esptool/esptool.py", line 237, in __init__
  18. self._port = serial.serial_for_url(port)
  19. File "D:\Professional_Software\Python27\lib\site-packages\serial\__init__.py", line 88, in serial_for_url
  20. instance.open()
  21. File "D:\Professional_Software\Python27\lib\site-packages\serial\serialwin32.py", line 62, in open
  22. raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
  23. 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')
  24. make: *** [/e/Document_Pro/ESP32/ESP-IDF/esp-idf/components/esptool_py/Makefile.projbuild:71: flash] Error 1

这个报错是提示串口号被占用 或者 找不到这个串口。

 

问题解决:

图形配置界面有问题,这里需要填windows下的串口号

 

烧录成功:

  1. esptool.py v2.8
  2. Flashing binaries to serial port /dev/COM5 (app at offset 0x10000)...
  3. esptool.py v2.8
  4. Serial port D:/Professional_Software/AiThinkerIDE_V1.5.2/msys32/dev/COM5
  5. Connecting....
  6. Chip is ESP32D0WDQ6 (revision 1)
  7. Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
  8. Crystal is 26MHz
  9. MAC: 98:f4:ab:6d:b1:f0
  10. Uploading stub...
  11. Running stub...
  12. Stub running...
  13. Configuring flash size...
  14. Auto-detected Flash size: 4MB
  15. Compressed 25712 bytes to 15293...
  16. Writing at 0x00001000... (100 %)
  17. Wrote 25712 bytes (15293 compressed) at 0x00001000 in 1.4 seconds (effective 152.3 kbit/s)...
  18. Hash of data verified.
  19. Compressed 151824 bytes to 72774...
  20. Writing at 0x00010000... (20 %)
  21. Writing at 0x00014000... (40 %)
  22. Writing at 0x00018000... (60 %)
  23. Writing at 0x0001c000... (80 %)
  24. Writing at 0x00020000... (100 %)
  25. Wrote 151824 bytes (72774 compressed) at 0x00010000 in 6.4 seconds (effective 189.0 kbit/s)...
  26. Hash of data verified.
  27. Compressed 3072 bytes to 103...
  28. Writing at 0x00008000... (100 %)
  29. Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 1536.0 kbit/s)...
  30. Hash of data verified.
  31. Leaving...
  32. Hard resetting via RTS pin...
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/196184
推荐阅读
相关标签
  

闽ICP备14008679号