在 Espressif 上安装固件的初始版本 ESP32 - 免费 RTOS

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

在 Espressif 上安装固件的初始版本 ESP32

重要

此参考集成托管在 Amazon-Free RTOS 存储库中,该存储库已弃用。当您创建新项目时,我们建议从此处开始。如果您已经有一个基于现已弃用的 Amazon-Free RTOS 存储库的免费RTOS项目,请参阅。亚马逊免费版 RTOS Github 存储库迁移指南

本指南假设您已经执行了 Espressif ESP32-DevKit C 入门中的步骤,以及更新先决 ESP-WROVER-KIT条件。Over-the-Air 在尝试OTA更新之前,您可能需要运行免费入门中所述的MQTT演示项目,RTOS以确保您的开发板和工具链设置正确。

将初始出厂映像刷写到主板
  1. 打开 freertos/vendors/vendor/boards/board/aws_demos/config_files/aws_demo_config.h,注释掉 #define CONFIG_CORE_MQTT_MUTUAL_AUTH_DEMO_ENABLED 并定义 CONFIG_OTA_MQTT_UPDATE_DEMO_ENABLEDCONFIG_OTA_HTTP_UPDATE_DEMO_ENABLED

  2. 将您在中生SHA成的-256/ ECDSA PEM 格式的代码签名证书复制到。OTA更新先决条件 vendors/vendor/boards/board/aws_demos/config_files/ota_demo_config.h应按以下方式为其设置格式。

    #define otapalconfigCODE_SIGNING_CERTIFICATE \ "-----BEGIN CERTIFICATE-----\n" \ "...base64 data...\n" \ "-----END CERTIFICATE-----\n";
  3. 选择 “OTA更新” 演示后,按照入门中概述的ESP32相同步骤构建和刷新映像。如果之前已构建并刷写了项目,则可能需要先运行 make clean。在运行 make flash monitor 后,将会看到类似于以下内容的输出。某些消息的顺序可能会有所不同,因为演示应用程序同时运行多个任务。

    I (28) boot: ESP-IDF v3.1-dev-322-gf307f41-dirty 2nd stage bootloader I (28) boot: compile time 16:32:33 I (29) boot: Enabling RNG early entropy source... I (34) boot: SPI Speed : 40MHz I (38) boot: SPI Mode : DIO I (42) boot: SPI Flash Size : 4MB I (46) boot: Partition Table: I (50) boot: ## Label Usage Type ST Offset Length I (57) boot: 0 nvs WiFi data 01 02 00010000 00006000 I (64) boot: 1 otadata OTA data 01 00 00016000 00002000 I (72) boot: 2 phy_init RF data 01 01 00018000 00001000 I (79) boot: 3 ota_0 OTA app 00 10 00020000 00100000 I (87) boot: 4 ota_1 OTA app 00 11 00120000 00100000 I (94) boot: 5 storage Unknown data 01 82 00220000 00010000 I (102) boot: End of partition table I (106) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x14784 ( 83844) map I (144) esp_image: segment 1: paddr=0x000347ac vaddr=0x3ffb0000 size=0x023ec ( 9196) load I (148) esp_image: segment 2: paddr=0x00036ba0 vaddr=0x40080000 size=0x00400 ( 1024) load I (151) esp_image: segment 3: paddr=0x00036fa8 vaddr=0x40080400 size=0x09068 ( 36968) load I (175) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0x719b8 (465336) map I (337) esp_image: segment 5: paddr=0x000b19d8 vaddr=0x40089468 size=0x04934 ( 18740) load I (345) esp_image: segment 6: paddr=0x000b6314 vaddr=0x400c0000 size=0x00000 ( 0) load I (353) boot: Loaded app from partition at offset 0x20000 I (353) boot: ota rollback check done I (354) boot: Disabling RNG early entropy source... I (360) cpu_start: Pro cpu up. I (363) cpu_start: Single core mode I (368) heap_init: Initializing. RAM available for dynamic allocation: I (375) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (381) heap_init: At 3FFC0748 len 0001F8B8 (126 KiB): DRAM I (387) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM I (393) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (400) heap_init: At 4008DD9C len 00012264 (72 KiB): IRAM I (406) cpu_start: Pro cpu start user code I (88) cpu_start: Starting scheduler on PRO CPU. I (113) wifi: wifi firmware version: f79168c I (113) wifi: config NVS flash: enabled I (113) wifi: config nano formating: disabled I (113) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (123) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (133) wifi: Init dynamic tx buffer num: 32 I (143) wifi: Init data frame dynamic rx buffer num: 32 I (143) wifi: Init management frame dynamic rx buffer num: 32 I (143) wifi: wifi driver task: 3ffc73ec, prio:23, stack:4096 I (153) wifi: Init static rx buffer num: 10 I (153) wifi: Init dynamic rx buffer num: 32 I (163) wifi: wifi power manager task: 0x3ffcc028 prio: 21 stack: 2560 0 6 [main] WiFi module initialized. Connecting to AP <Your_WiFi_SSID>... I (233) phy: phy_version: 383.0, 79a622c, Jan 30 2018, 15:38:06, 0, 0 I (233) wifi: mode : sta (30:ae:a4:80:0a:04) I (233) WIFI: SYSTEM_EVENT_STA_START I (363) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1 I (1343) wifi: state: init -> auth (b0) I (1343) wifi: state: auth -> assoc (0) I (1353) wifi: state: assoc -> run (10) I (1373) wifi: connected with <Your_WiFi_SSID>, channel 1 I (1373) WIFI: SYSTEM_EVENT_STA_CONNECTED 1 302 [IP-task] vDHCPProcess: offer c0a86c13ip I (3123) event: sta ip: 192.168.108.19, mask: 255.255.224.0, gw: 192.168.96.1 I (3123) WIFI: SYSTEM_EVENT_STA_GOT_IP 2 302 [IP-task] vDHCPProcess: offer c0a86c13ip 3 303 [main] WiFi Connected to AP. Creating tasks which use network... 4 304 [OTA] OTA demo version 0.9.6 5 304 [OTA] Creating MQTT Client... 6 304 [OTA] Connecting to broker... I (4353) wifi: pm start, type:0 I (8173) PKCS11: Initializing SPIFFS I (8183) PKCS11: Partition size: total: 52961, used: 0 7 1277 [OTA] Connected to broker. 8 1280 [OTA Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/<Your_Thing_Name>/jobs/$next/get/accepted I (12963) ota_pal: prvPAL_GetPlatformImageState I (12963) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0 9 1285 [OTA Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/<Your_Thing_Name>/jobs/notify-next 10 1286 [OTA Task] [OTA_CheckForUpdate] Request #0 11 1289 [OTA Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:<Your_Thing_Name> ] 12 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: execution 13 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: jobId 14 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: jobDocument 15 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: afr_ota 16 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: streamname 17 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: files 18 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: filepath 19 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: filesize 20 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: fileid 21 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: certfile 22 1289 [OTA Task] [prvParseJSONbyModel] parameter not present: sig-sha256-ecdsa 23 1289 [OTA Task] [prvParseJobDoc] Ignoring job without ID. 24 1289 [OTA Task] [prvOTA_Close] Context->0x3ffbb4a8 25 1290 [OTA] [OTA_AgentInit] Ready. 26 1390 [OTA] State: Ready Received: 1 Queued: 1 Processed: 1 Dropped: 0 27 1490 [OTA] State: Ready Received: 1 Queued: 1 Processed: 1 Dropped: 0 28 1590 [OTA] State: Ready Received: 1 Queued: 1 Processed: 1 Dropped: 0 29 1690 [OTA] State: Ready Received: 1 Queued: 1 Processed: 1 Dropped: 0 [ ... ]
  4. ESP32董事会现在正在听取OTA最新消息。ESP-IDF 监视器由make flash monitor命令启动。您可以按 Ctrl+] 以退出。您还可以使用自己喜欢的TTY终端程序(例如 Pu TTY、Tera Term 或 Sc GNU reen)来收听主板的串行输出。请注意,连接到主板的串行端口可能会导致主板重新启动。