Skip to content

Commit f997e4d

Browse files
committed
feat: port ota demo to esp8266 platform
1 parent a6564eb commit f997e4d

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

examples/system/ota/OTA_workflow.png

-768 Bytes
Loading

examples/system/ota/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ This example is a *simplified demonstration*, for production firmware updates yo
99

1010
# Aim
1111

12-
An app running on ESP32 can upgrade itself by downloading a new app "image" binary file, and storing it in flash.
12+
An app running on ESP8266 can upgrade itself by downloading a new app "image" binary file, and storing it in flash.
1313

14-
In this example, the ESP32 has 3 images in flash: factory, OTA_0, OTA_1. Each of these is a self-contained partition. The number of OTA image partition is determined by the partition table layout.
14+
In this example, the ESP8266 has 3 images in flash: factory, OTA_0, OTA_1. Each of these is a self-contained partition. The number of OTA image partition is determined by the partition table layout.
1515

1616
Flashing the example over serial with "make flash" updates the factory app image. On first boot, the bootloader loads this factory app image which then performs an OTA update (triggered in the example code). The update downloads a new image from an http server and saves it into the OTA_0 partition. At this point the example code updates the ota_data partition to indicate the new app partition, and resets. The bootloader reads ota_data, determines the new OTA image has been selected, and runs it.
1717

@@ -24,7 +24,7 @@ The OTA_workflow.png diagram demonstrates the overall workflow:
2424

2525
## Step 1: Connect to AP
2626

27-
Connect your host PC to the same AP that you will use for the ESP32.
27+
Connect your host PC to the same AP that you will use for the ESP8266.
2828

2929
## Step 2: Run HTTP Server
3030

@@ -82,7 +82,7 @@ When the example starts up, it will print "ota: Starting OTA example..." then:
8282

8383
# Troubleshooting
8484

85-
* Check your PC can ping the ESP32 at its IP, and that the IP, AP and other configuration settings are correct in menuconfig.
85+
* Check your PC can ping the ESP8266 at its IP, and that the IP, AP and other configuration settings are correct in menuconfig.
8686
* Check if any firewall software is preventing incoming connections on the PC.
8787
* Check you can see the configured file (default hello-world.bin) if you browse the file listing at http://127.0.0.1/
8888
* If you have another PC or a phone, try viewing the file listing from the separate host.

examples/system/ota/main/ota_example_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
77
CONDITIONS OF ANY KIND, either express or implied.
88
*/
9+
#include <stdlib.h>
910
#include <string.h>
1011
#include <sys/socket.h>
1112
#include <netdb.h>
@@ -28,7 +29,7 @@
2829
#define EXAMPLE_SERVER_IP CONFIG_SERVER_IP
2930
#define EXAMPLE_SERVER_PORT CONFIG_SERVER_PORT
3031
#define EXAMPLE_FILENAME CONFIG_EXAMPLE_FILENAME
31-
#define BUFFSIZE 1024
32+
#define BUFFSIZE 1500
3233
#define TEXT_BUFFSIZE 1024
3334

3435
static const char *TAG = "ota";
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default sdkconfig parameters to use the OTA
2-
# partition table layout, with a 4MB flash size
3-
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
1+
# Default sdkconfig parameters to use the ESP8266 OTA
2+
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
43
CONFIG_PARTITION_TABLE_TWO_OTA=y
4+
CONFIG_LWIP_SOCKET_MULTITHREAD=

0 commit comments

Comments
 (0)