Skip to content

Commit d3534b3

Browse files
committed
Enable APP_ROLLBACK_ENABLE
1 parent b318ff7 commit d3534b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+30
-12
lines changed

cores/esp32/esp32-hal-misc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include "esp_partition.h"
2222
#include "esp_log.h"
2323
#include "esp_timer.h"
24+
#ifdef CONFIG_APP_ROLLBACK_ENABLE
25+
#include "esp_ota_ops.h"
26+
#endif //CONFIG_APP_ROLLBACK_ENABLE
2427
#ifdef CONFIG_BT_ENABLED
2528
#include "esp_bt.h"
2629
#endif //CONFIG_BT_ENABLED
@@ -145,6 +148,9 @@ void initVariant() {}
145148
void init() __attribute__((weak));
146149
void init() {}
147150

151+
bool verifyOta() __attribute__((weak));
152+
bool verifyOta() { return true; }
153+
148154
#ifdef CONFIG_BT_ENABLED
149155
//overwritten in esp32-hal-bt.c
150156
bool btInUse() __attribute__((weak));
@@ -153,6 +159,20 @@ bool btInUse(){ return false; }
153159

154160
void initArduino()
155161
{
162+
#ifdef CONFIG_APP_ROLLBACK_ENABLE
163+
const esp_partition_t *running = esp_ota_get_running_partition();
164+
esp_ota_img_states_t ota_state;
165+
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
166+
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
167+
if (verifyOta()) {
168+
esp_ota_mark_app_valid_cancel_rollback();
169+
} else {
170+
log_e("OTA verification failed! Start rollback to the previous version ...");
171+
esp_ota_mark_app_invalid_rollback_and_reboot();
172+
}
173+
}
174+
}
175+
#endif
156176
//init proper ref tick value for PLL (uncomment if REF_TICK is different than 1MHz)
157177
//ESP_REG(APB_CTRL_PLL_TICK_CONF_REG) = APB_CLK_FREQ / REF_CLK_FREQ - 1;
158178
#ifdef F_CPU

tools/sdk/bin/bootloader_dio_40m.bin

1.58 KB
Binary file not shown.

tools/sdk/bin/bootloader_dio_80m.bin

96 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_dout_40m.bin

112 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_dout_80m.bin

96 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qio_40m.bin

112 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qio_80m.bin

112 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qout_40m.bin

112 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qout_80m.bin

112 Bytes
Binary file not shown.

tools/sdk/include/config/sdkconfig.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
#define CONFIG_IPC_TASK_STACK_SIZE 1024
2727
#define CONFIG_FATFS_PER_FILE_CACHE 1
2828
#define CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY 1
29-
#define CONFIG_ESPTOOLPY_FLASHFREQ "80m"
29+
#define CONFIG_ESPTOOLPY_FLASHFREQ "40m"
3030
#define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1
3131
#define CONFIG_UDP_RECVMBOX_SIZE 6
3232
#define CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT 1
3333
#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0
3434
#define CONFIG_MBEDTLS_AES_C 1
3535
#define CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED 1
3636
#define CONFIG_A2DP_SINK_TASK_STACK_SIZE 2048
37-
#define CONFIG_SPIRAM_OCCUPY_HSPI_HOST 1
3837
#define CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN 752
3938
#define CONFIG_MBEDTLS_GCM_C 1
4039
#define CONFIG_ESPTOOLPY_FLASHSIZE "4MB"
@@ -52,6 +51,7 @@
5251
#define CONFIG_BT_STACK_NO_LOG 1
5352
#define CONFIG_ESP_GRATUITOUS_ARP 1
5453
#define CONFIG_MBEDTLS_ECDSA_C 1
54+
#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1
5555
#define CONFIG_HTTPD_MAX_REQ_HDR_LEN 512
5656
#define CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE 0
5757
#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1
@@ -76,6 +76,7 @@
7676
#define CONFIG_CONSOLE_UART_BAUDRATE 115200
7777
#define CONFIG_SPIRAM_SUPPORT 1
7878
#define CONFIG_LWIP_MAX_SOCKETS 10
79+
#define CONFIG_APP_ROLLBACK_ENABLE 1
7980
#define CONFIG_LWIP_NETIF_LOOPBACK 1
8081
#define CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT "pthread"
8182
#define CONFIG_EMAC_TASK_PRIORITY 20
@@ -198,17 +199,16 @@
198199
#define CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN 0
199200
#define CONFIG_LWIP_DHCP_RESTORE_LAST_IP 1
200201
#define CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN 2
201-
#define CONFIG_SPIRAM_SPEED_80M 1
202202
#define CONFIG_PICO_PSRAM_CS_IO 10
203203
#define CONFIG_EMAC_TASK_STACK_SIZE 3072
204204
#define CONFIG_MB_QUEUE_LENGTH 20
205205
#define CONFIG_SW_COEXIST_PREFERENCE_VALUE 0
206206
#define CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA 1
207207
#define CONFIG_OV2640_SUPPORT 1
208208
#define CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER 1
209-
#define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1
210209
#define CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK 1
211210
#define CONFIG_PPP_SUPPORT 1
211+
#define CONFIG_SPIRAM_SPEED_40M 1
212212
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
213213
#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1
214214
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000

tools/sdk/lib/libapp_trace.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libapp_update.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libasio.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libbootloader_support.a

1.32 KB
Binary file not shown.

tools/sdk/lib/libbt.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libcoap.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libconsole.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libcxx.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libdriver.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp-tls.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp32-camera.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp32.a

-652 Bytes
Binary file not shown.

tools/sdk/lib/libesp_adc_cal.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_event.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_http_client.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_http_server.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_https_ota.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_https_server.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libesp_ringbuf.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libethernet.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libexpat.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libface_detection.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libface_recognition.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libfatfs.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libfreemodbus.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libfreertos.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libheap.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libimage_util.a

0 Bytes
Binary file not shown.

tools/sdk/lib/liblibsodium.a

0 Bytes
Binary file not shown.

tools/sdk/lib/liblog.a

0 Bytes
Binary file not shown.

tools/sdk/lib/liblwip.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libmbedtls.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libmdns.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libmqtt.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libnewlib.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libnghttp.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libnvs_flash.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libopenssl.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libprotobuf-c.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libprotocomm.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libpthread.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libsdmmc.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libsmartconfig_ack.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libsoc.a

16 Bytes
Binary file not shown.

tools/sdk/lib/libspi_flash.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libspiffs.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libtcp_transport.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libtcpip_adapter.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libulp.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libunity.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libvfs.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libwear_levelling.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libwifi_provisioning.a

0 Bytes
Binary file not shown.

tools/sdk/lib/libwpa_supplicant.a

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

tools/sdk/sdkconfig

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ CONFIG_LOG_BOOTLOADER_LEVEL_INFO=
5656
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG=
5757
CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE=
5858
CONFIG_LOG_BOOTLOADER_LEVEL=0
59+
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V=
5960
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
6061
CONFIG_BOOTLOADER_FACTORY_RESET=
6162
CONFIG_BOOTLOADER_APP_TEST=
6263
CONFIG_BOOTLOADER_WDT_ENABLE=y
6364
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=
6465
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
65-
CONFIG_APP_ROLLBACK_ENABLE=
66+
CONFIG_APP_ROLLBACK_ENABLE=y
6667

6768
#
6869
# Security features
@@ -88,11 +89,11 @@ CONFIG_FLASHMODE_QOUT=
8889
CONFIG_FLASHMODE_DIO=y
8990
CONFIG_FLASHMODE_DOUT=
9091
CONFIG_ESPTOOLPY_FLASHMODE="dio"
91-
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
92-
CONFIG_ESPTOOLPY_FLASHFREQ_40M=
92+
CONFIG_ESPTOOLPY_FLASHFREQ_80M=
93+
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
9394
CONFIG_ESPTOOLPY_FLASHFREQ_26M=
9495
CONFIG_ESPTOOLPY_FLASHFREQ_20M=
95-
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
96+
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
9697
CONFIG_ESPTOOLPY_FLASHSIZE_1MB=
9798
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=
9899
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
@@ -267,15 +268,12 @@ CONFIG_SPIRAM_TYPE_AUTO=y
267268
CONFIG_SPIRAM_TYPE_ESPPSRAM32=
268269
CONFIG_SPIRAM_TYPE_ESPPSRAM64=
269270
CONFIG_SPIRAM_SIZE=-1
270-
CONFIG_SPIRAM_SPEED_40M=
271-
CONFIG_SPIRAM_SPEED_80M=y
271+
CONFIG_SPIRAM_SPEED_40M=y
272272
CONFIG_SPIRAM_CACHE_WORKAROUND=y
273273
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
274274
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
275275
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=y
276276
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=
277-
CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y
278-
CONFIG_SPIRAM_OCCUPY_VSPI_HOST=
279277
CONFIG_PICO_PSRAM_CS_IO=10
280278
CONFIG_MEMMAP_TRACEMEM=
281279
CONFIG_MEMMAP_TRACEMEM_TWOBANKS=

0 commit comments

Comments
 (0)