Skip to content

Commit 010a7c6

Browse files
authoredFeb 14, 2019
Update IDF to abea9e4c0 (espressif#2458)
* Update IDF to abea9e4c0 * Update esptool * Enable PSRAM for PICO D4 * Enable APP_ROLLBACK_ENABLE
1 parent c0345ea commit 010a7c6

File tree

101 files changed

+741
-307
lines changed

Some content is hidden

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

101 files changed

+741
-307
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

‎cores/esp32/esp32-hal-psram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bool psramInit(){
1919
}
2020
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
2121
uint32_t pkg_ver = chip_ver & 0x7;
22-
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
22+
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
2323
spiramFailed = true;
2424
log_w("PSRAM not supported!");
2525
return false;

0 commit comments

Comments
 (0)
Please sign in to comment.