Skip to content

Commit e9f68e1

Browse files
committed
DEBUG: add debug logs - THIS COMMIT WILL BE DELETED
Signed-off-by: Almir Okato <almir.okato@espressif.com>
1 parent 7f41008 commit e9f68e1

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

drivers/flash/flash_esp32.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,26 @@ static bool flash_esp32_is_aligned(off_t address, void *buffer, size_t length)
113113
}
114114
#endif
115115

116+
bool aligned_flash_read_(off_t address, void *buffer, size_t length, bool read_encrypted)
117+
{
118+
int ret = 0;
119+
120+
if (read_encrypted) {
121+
LOG_INF("Flash read ENCRYPTED - address 0x%lx size 0x%x", address, length);
122+
ret = esp_flash_read_encrypted(NULL, address, buffer, length);
123+
} else {
124+
LOG_INF("Flash read RAW - address 0x%lx size 0x%x", address, length);
125+
ret = esp_flash_read(NULL, buffer, address, length);
126+
}
127+
128+
if (ret != 0) {
129+
LOG_ERR("Flash read error: %d", ret);
130+
return false;
131+
}
132+
133+
return true;
134+
}
135+
116136
static int flash_esp32_read_check_enc(off_t address, void *buffer, size_t length)
117137
{
118138
int ret = 0;

subsys/dfu/boot/mcuboot.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "mcuboot_priv.h"
2929

30-
LOG_MODULE_REGISTER(mcuboot_dfu, LOG_LEVEL_DBG);
30+
LOG_MODULE_REGISTER(mcuboot_dfu, LOG_LEVEL_INF);
3131

3232
/*
3333
* Helpers for image headers and trailers, as defined by mcuboot.
@@ -305,10 +305,18 @@ bool boot_is_img_confirmed(void)
305305

306306
rc = boot_read_swap_state(fa, &state);
307307
if (rc != 0) {
308+
LOG_ERR("boot_read_swap_state ERROR");
308309
return false;
309310
}
310311

312+
LOG_INF("boot_is_img_confirmed flash_area id: 0x%x offset: 0x%lx", fa->fa_id, fa->fa_off);
313+
314+
LOG_INF("boot_is_img_confirmed swap_state magic=0x%x swap_type=0x%x copy_done=0x%x image_ok=0x%x image_num=0x%x",
315+
state.magic, state.swap_type, state.copy_done, state.image_ok, state.image_num);
316+
311317
if (state.magic == BOOT_MAGIC_UNSET) {
318+
LOG_INF("boot_is_img_confirmed MAGIC UNSET, treating as CONFIRMED ");
319+
312320
/* This is initial/preprogramed image.
313321
* Such image can neither be reverted nor physically confirmed.
314322
* Treat this image as confirmed which ensures consistency
@@ -329,6 +337,8 @@ int boot_write_img_confirmed(void)
329337
return -EIO;
330338
}
331339

340+
LOG_INF("boot_write_img_confirmed flash_area id: 0x%x offset: 0x%lx", fa->fa_id, fa->fa_off);
341+
332342
rc = boot_set_next(fa, true, true);
333343

334344
flash_area_close(fa);

0 commit comments

Comments
 (0)