summaryrefslogtreecommitdiff
path: root/ota-test/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ota-test/main/main.cpp')
-rw-r--r--ota-test/main/main.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/ota-test/main/main.cpp b/ota-test/main/main.cpp
index a64f03f..08b2c2e 100644
--- a/ota-test/main/main.cpp
+++ b/ota-test/main/main.cpp
@@ -4,6 +4,7 @@
#include "esp_wifi.h"
#include "esp_spiffs.h"
#include "sdkconfig.h"
+#include "rboot-api.h"
#include <assert.h>
@@ -13,11 +14,6 @@ uint32_t user_rf_cal_sector_set();
extern "C"
void user_init();
-enum events {
- EVENTS_GOT_IP = (1 << 0),
- EVENTS_LOST_IP = (1 << 1),
-};
-
static void set_wifi_mode() {
if (wifi_get_opmode_default() != NULL_MODE) {
printf("Setting default station mode");
@@ -46,7 +42,44 @@ TaskHandle_t main_task_handle;
void user_init() {
os_printf("SDK version: %s, free: %d, app build: %s\n", system_get_sdk_version(), system_get_free_heap_size(), __TIMESTAMP__);
+ uint8_t current_rom = rboot_get_current_rom();
+ os_printf("rboot_get_current_rom=%d\n", rboot_get_current_rom());
+
+ rboot_config rboot_config = rboot_get_config();
+
+ os_printf("rboot config:\n");
+ os_printf(" count ROMs: %d\n", rboot_config.count);
+ for (int i = 0; i < rboot_config.count; i++) {
+ os_printf(" #%d: 0x%08x\n", i, rboot_config.roms[i]);
+ }
+
+ uint8_t next_rom;
+ if (current_rom == 0) {
+ next_rom = 1;
+ } else {
+ next_rom = 0;
+ }
+ os_printf("next_rom=%d\n", next_rom);
+ rboot_set_current_rom(next_rom);
+
set_wifi_mode();
assert(xTaskCreate(main_task, THREAD_NAME, THREAD_STACK_WORDS, NULL, THREAD_PRIO, &main_task_handle) == pdPASS);
}
+
+/*
+extern "C"
+uint8_t default_config(rboot_config *romconf, uint32_t flashsize);
+
+uint8_t default_config(rboot_config *romconf, uint32_t flashsize) {
+ romconf->count = 2;
+ romconf->roms[0] = SECTOR_SIZE * (BOOT_CONFIG_SECTOR + 1);
+ romconf->roms[1] = (flashsize / 2) + (SECTOR_SIZE * (BOOT_CONFIG_SECTOR + 1));
+#ifdef BOOT_GPIO_ENABLED
+ romconf->mode = MODE_GPIO_ROM;
+#endif
+#ifdef BOOT_GPIO_SKIP_ENABLED
+ romconf->mode = MODE_GPIO_SKIP;
+#endif
+}
+*/