You can chat about native SDK questions and issues here.

User avatar
By Jana Vitkova
#89807 Hello community,
I am here for an advice. I tried to write on the espressif forum, but my messages are lost during verification by the admin. I believe you can help me here.

I am trying to run OTA updates on the ESP-WROOM02 module (2MB flash). I am using RTOS SDK v3.3. Flash contains custom partitions:
Code: Select all# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,   0x4000
otadata,  data, ota,     0xd000,   0x2000
phy_init, data, phy,     0xf000,   0x1000
ota_0,    app,  ota_0,   0x10000,  0xEF000
storage0, 0x40, 0xA5,    0xFF000,  0x1000
ota_1,    app,  ota_1,   0x100000, 0xEF000
storage1, 0x40, 0xA6,    0x1FF000,  0x1000


I can successfully send OTA firmware to the module and save it to flash memory (ota_1 partition) as shown below (pseudo code):
Code: Select all1) update_partition = esp_ota_get_next_update_partition()
2) esp_ota_begin(update_partition)
3) esp_ota_write()...
4) esp_ota_end()


but after issuing:
Code: Select all5) esp_ota_set_boot_partition(update_partition)
and making restart, the module is stuck with exception:
Code: Select allFatal exception (29):
epc1=0x40211f51, epc2=0x00000000, epc3=0x4023ca04, excvaddr=0x00100000, depc=0x00000000
0x40211f51: call_start_cpu at ESP8266_RTOS_SDK/components/esp8266/source/startup.c:102

0x4023ca04: cpu_reject_sleep at ESP8266_RTOS_SDK/components/esp8266/source/esp_sleep.c:212


I uploaded via OTA the same BIN file, which is initially flashed into the module using esptoo.py and runs successfully. When checking the flash memory, I see that the uploaded firmware is binary identical to the flashed one (ota_0 == ota_1).
What can be cause of this? As I can see from boot log, everything looks fine and the module should boot from ota_1 partition.
I will be very grateful for any help.
Best regards

Full log after reboot:
Code: Select allets Jan  8 2013,rst cause:1, boot mode:(3,0)

load 0x40100000, len 7496, room 16
tail 8
chksum 0xca
load 0x3ffe8408, len 24, room 0
tail 8
chksum 0x43
load 0x3ffe8420, len 4100, room 0
tail 4
chksum 0x20
csum 0x20
I (86) boot: ESP-IDF v3.4-dev-375-g95193813-dirty 2nd stage bootloader
I (86) boot: compile time 14:10:24
I (92) qio_mode: Enabling default flash chip QIO
D (103) boot: bootloader initialize SPI flash clock and I/O
D (120) boot: magic e9
D (126) boot: segments 03
D (133) boot: spi_mode 00
D (141) boot: spi_speed 00
D (148) boot: spi_size 03
I (157) boot: SPI Speed      : 40MHz
I (170) boot: SPI Mode       : QIO
I (183) boot: SPI Flash Size : 2MB
D (193) boot: mapped partition table 0x8000 at 0x40208000
D (209) flash_parts: partition table verified, 7 entries
I (227) boot: Partition Table:
I (238) boot: ## Label            Usage          Type ST Offset   Length
D (259) boot: load partition table entry 0x3ffffe14
D (273) boot: type=1 subtype=2
I (283) boot:  0 nvs              WiFi data        01 02 00009000 00004000
D (305) boot: load partition table entry 0x3ffffe14
D (319) boot: type=1 subtype=0
I (329) boot:  1 otadata          OTA data         01 00 0000d000 00002000
D (351) boot: load partition table entry 0x3ffffe14
D (365) boot: type=1 subtype=1
I (375) boot:  2 phy_init         RF data          01 01 0000f000 00001000
D (397) boot: load partition table entry 0x3ffffe14
D (411) boot: type=0 subtype=10
I (421) boot:  3 ota_0            OTA app          00 10 00010000 000ef000
D (443) boot: load partition table entry 0x3ffffe14
D (457) boot: type=40 subtype=a5
I (468) boot:  4 storage0         unknown          40 a5 000ff000 00001000
D (489) boot: load partition table entry 0x3ffffe14
D (503) boot: type=0 subtype=11
I (514) boot:  5 ota_1            OTA app          00 11 00100000 000ef000
D (535) boot: load partition table entry 0x3ffffe14
D (549) boot: type=40 subtype=a6
I (560) boot:  6 storage1         unknown          40 a6 001ff000 00001000
I (584) boot: End of partition table
D (595) boot: OTA data offset 0xd000
D (605) boot: OTA sequence values A 0x00000002 B 0xffffffff
D (621) boot: Only OTA sequence A is valid. Mapping seq 1 -> OTA slot 1
D (641) boot: Trying partition index 1 offs 0x100000 size 0xef000
D (659) esp_image: reading image header @ 0x100000
D (673) esp_image: image header: 0xe9 0x05 0x02 0x01 40211f4c
V (689) esp_image: loading segment header 0 at offset 0x100008
V (706) esp_image: segment data length 0x80f28 data starts 0x100010
I (727) esp_image: segment 0: paddr=0x00100010 vaddr=0x40210010 size=0x80f28 (528168) map
0x40210010: _stext at ??:?

V (1009) esp_image: loading segment header 1 at offset 0x180f38
V (1009) esp_image: segment data length 0x17e40 data starts 0x180f40
I (1013) esp_image: segment 1: paddr=0x00180f40 vaddr=0x40290f38 size=0x17e40 ( 97856) map
V (1086) esp_image: loading segment header 2 at offset 0x198d80
V (1087) esp_image: segment data length 0x798 data starts 0x198d88
I (1090) esp_image: segment 2: paddr=0x00198d88 vaddr=0x3ffe8000 size=0x00798 (  1944) load
V (1117) esp_image: loading segment header 3 at offset 0x199520
V (1133) esp_image: segment data length 0x80 data starts 0x199528
I (1153) esp_image: segment 3: paddr=0x00199528 vaddr=0x40100000 size=0x00080 (   128) load
V (1179) esp_image: loading segment header 4 at offset 0x1995a8
V (1196) esp_image: segment data length 0x55e0 data starts 0x1995b0
I (1216) esp_image: segment 4: paddr=0x001995b0 vaddr=0x40100080 size=0x055e0 ( 21984) load
V (1253) esp_image: image start 0x00100000 end of last section 0x0019eb90
I (1264) boot: Loaded app from partition at offset 0x100000
Fatal exception (29):
epc1=0x40211f51, epc2=0x00000000, epc3=0x4023ca04, excvaddr=0x00100000, depc=0x00000000
0x40211f51: call_start_cpu at ESP8266_RTOS_SDK/components/esp8266/source/startup.c:102

0x4023ca04: cpu_reject_sleep at ESP8266_RTOS_SDK/components/esp8266/source/esp_sleep.c:212

Fatal exception (29):
epc1=0x40211f51, epc2=0x00000000, epc3=0x4023ca04, excvaddr=0x00100000, depc=0x00000000
0x40211f51: call_start_cpu at ESP8266_RTOS_SDK/components/esp8266/source/startup.c:102

0x4023ca04: cpu_reject_sleep at ESP8266_RTOS_SDK/components/esp8266/source/esp_sleep.c:212
User avatar
By Jana Vitkova
#89995 If anyone is interested, I've probably figured out the cause of the problem. The OTA_1 partition must be aligned with the same offset as the OTA_0 partition, only with the highest bit set. So for example: ota_0 starts at 0x10000, ota_1 = 0x110000 and not at address 0x100000.