Skip to content

Commit d5697af

Browse files
committed
feat(esp_delta_ota): Added pytest for the delta OTA example
1. Added pytest for the delta OTA example
1 parent 7f2963f commit d5697af

File tree

9 files changed

+392
-4
lines changed

9 files changed

+392
-4
lines changed

esp_delta_ota/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.1.4
2+
3+
### Enhancements:
4+
- Added ability to set the new firmware upgrade URL from STDIN
5+
16
## 1.1.3
27

38
### Bugfixes:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The following lines of boilerplate have to be in your project's CMakeLists
22
# in this exact order for cmake to work correctly
3-
cmake_minimum_required(VERSION 3.5)
3+
cmake_minimum_required(VERSION 3.16)
44

55
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6-
set(COMPONENTS main)
6+
set(COMPONENTS main esp_eth)
77
project(https_delta_ota)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
idf_component_register(SRCS "main.c"
22
INCLUDE_DIRS "."
33
EMBED_TXTFILES ca_cert.pem
4-
PRIV_REQUIRES esp_http_client esp_partition nvs_flash app_update esp_timer esp_wifi console)
4+
PRIV_REQUIRES esp_http_client esp_partition nvs_flash app_update esp_timer esp_wifi console esp_eth)

esp_delta_ota/examples/https_delta_ota/main/Kconfig.projbuild

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ menu "Example Configuration"
2424
help
2525
Maximum time for reception
2626

27+
config EXAMPLE_FIRMWARE_UPG_URL_FROM_STDIN
28+
bool
29+
default y if EXAMPLE_FIRMWARE_UPG_URL = "FROM_STDIN"
30+
2731
endmenu

esp_delta_ota/examples/https_delta_ota/main/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#define BUFFSIZE 1024
3737
#define PATCH_HEADER_SIZE 64
3838
#define DIGEST_SIZE 32
39+
#define OTA_URL_SIZE 256
3940
static uint32_t esp_delta_ota_magic = 0xfccdde10;
4041

4142
static const char *TAG = "https_delta_ota_example";
@@ -156,6 +157,20 @@ static void ota_example_task(void *pvParameter)
156157
config.skip_cert_common_name_check = true;
157158
#endif
158159

160+
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPG_URL_FROM_STDIN
161+
char url_buf[OTA_URL_SIZE];
162+
if (strcmp(config.url, "FROM_STDIN") == 0) {
163+
example_configure_stdin_stdout();
164+
fgets(url_buf, OTA_URL_SIZE, stdin);
165+
int len = strlen(url_buf);
166+
url_buf[len - 1] = '\0';
167+
config.url = url_buf;
168+
} else {
169+
ESP_LOGE(TAG, "Configuration mismatch: wrong firmware upgrade image url");
170+
abort();
171+
}
172+
#endif
173+
159174
esp_http_client_handle_t client = esp_http_client_init(&config);
160175
if (client == NULL) {
161176
ESP_LOGE(TAG, "Failed to initialise HTTP connection");

0 commit comments

Comments
 (0)