OTA issue

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

OTA issue

Postby iosixllc » Mon May 08, 2017 6:12 am

It seems my erase and write process is working well, but when I get to the end I get the following:

E (114474) esp_image: Segment 1 has load address 0x3f400010, conflict with segment data at 0x00118010
E (114661) esp_image: Segment 7 has load address 0x400d0018, conflict with segment data at 0x00148018
I (114947) upgrade: OTA END: 0 [this is result from esp_ota_end]
E (115011) esp_image: Segment 1 has load address 0x3f400010, conflict with segment data at 0x00118010
E (115199) esp_image: Segment 7 has load address 0x400d0018, conflict with segment data at 0x00148018
E (115479) upgrade: Failed to activate boot partition ota_1, error 2 [this is result from esp_ota_set_boot_partition]

I can't find a reference for error code 2, nor do I have any idea what these esp_image errors are. All of the erase/write calls have no errors at all. I'm loading the "app-template.bin" file produced by 'make' - is this correct or do I have to generate an OTA image a different way? Thanks!

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Mon May 08, 2017 9:31 pm

To follow up, it looks like the image is loading correctly, as esp_image_basic_verify attests:

E (145783) upgrade: Image verify: 0, size: 570432
E (145784) upgrade: Find part: 3FFB99D8; 1 0 D000 2000 otadata 0
E (145785) upgrade: OTA part: 3FFB9A68; 0 11 108000 F8000 ota_1 0
E (145785) upgrade: Rewrite OTA: 2, type: 11

However, it seems the source of the '2' response is esp_rewrite_ota_data. I can't figure out how '2' is coming out as a response, at all... Ideas? '11' is the argument 'subtype' being passed into esp_rewrite_ota_data.

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Mon May 08, 2017 9:52 pm

If I change the partition table to rename the OTA partition to #0, the above step succeeds, but it doesn't boot correctly:

I (12) boot: ESP-IDF v2.0-rc1-725-g07b61d54-dirty 2nd stage bootloader
I (12) boot: compile time 22:59:14
I (13) boot: Enabling RNG early entropy source...
I (14) qio_mode: Enabling QIO for flash chip ISSI
I (16) boot: SPI Speed : 80MHz
I (18) boot: SPI Mode : QIO
I (19) boot: SPI Flash Size : 2MB
I (21) boot: Partition Table:
I (22) boot: ## Label Usage Type ST Offset Length
I (25) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (28) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (31) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (34) boot: 3 factory factory app 00 00 00010000 000f8000
I (36) boot: 4 ota_0 OTA app 00 10 00108000 000f8000
I (40) boot: End of partition table
I (41) boot: Disabling RNG early entropy source...
I (43) boot: Loading app partition at offset 00108000
E (120) esp_image: Segment 1 has load address 0x3f400010, conflict with segment
data at 0x00118010
E (344) esp_image: Segment 7 has load address 0x400d0018, conflict with segment
data at 0x00148018
0x400d0018: _flash_cache_start at ??:?

I (694) boot: segment 0: paddr=0x00108018 vaddr=0x00000000 size=0x0ffe8 ( 65512)

I (695) boot: segment 1: paddr=0x00118008 vaddr=0x3f400010 size=0x0b1a4 ( 45476)
map
I (696) boot: segment 2: paddr=0x001231b4 vaddr=0x3ffb0000 size=0x02b08 ( 11016)
load
I (701) boot: segment 3: paddr=0x00125cc4 vaddr=0x40080000 size=0x00400 ( 1024)
load
0x40080000: _iram_start at ??:?

I (703) boot: segment 4: paddr=0x001260cc vaddr=0x40080400 size=0x13a04 ( 80388)
load
I (723) boot: segment 5: paddr=0x00139ad8 vaddr=0x400c0000 size=0x00000 ( 0)
load
I (724) boot: segment 6: paddr=0x00139ae0 vaddr=0x00000000 size=0x0e528 ( 58664)

I (726) boot: segment 7: paddr=0x00148010 vaddr=0x400d0018 size=0x4b424 (308260)
map
0x400d0018: _flash_cache_start at ??:?

Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception
was unhandled.
Register dump:
PC : 0x4012234c PS : 0x00060130 A0 : 0x8008102e A1 : 0x3f
fe3c30
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000004 A5 : 0x00
000000
A6 : 0x00000004 A7 : 0x3ff9eb14 A8 : 0x800df3d1 A9 : 0x3f
fe3c20
A10 : 0x00000000 A11 : 0x00000004 A12 : 0x0000000a A13 : 0x00
000000
A14 : 0x00000000 A15 : 0x00000030 SAR : 0x00000010 EXCCAUSE: 0x00
000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0xff
ffffff

Backtrace: 0x4012234c:0x3ffe3c30 0x4008102e:0x3ffe3c60 0x40078855:0x3ffe3ca0 0x4
0078a5e:0x3ffe3cd0 0x40078ff0:0x3ffe3d50 0x400800f9:0x3ffe3e70 0x40007c34:0x3ffe
3eb0 0x40000740:0x3ffe3f20
0x4008102e: call_start_cpu0 at C:/ESP32/esp-idf/components/esp32/cpu_s
tart.c:168

0x400800f9: _WindowUnderflow8 at ??:?


CPU halted.

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Mon May 08, 2017 9:59 pm

Just in case I wasn't reproducing the binary correctly, I tried to write the OTA section with the flash tool as well:

python /c/ESP32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /COM4 --baud 2000000 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 2MB 0x1000 /c/ESP32/esp32_eld/build/bootloader/bootloader.bin 0x10000 /c/ESP32/esp32_eld/build/app-template.bin 0x108000 /c/ESP32/esp32_eld/build/app-template.bin 0x8000 /c/ESP32/esp32_eld/build/partitions.bin

This also did not boot, with the same error:

I (12) boot: ESP-IDF v2.0-rc1-725-g07b61d54-dirty 2nd stage bootloade
r
I (12) boot: compile time 22:59:14
I (13) boot: Enabling RNG early entropy source...
I (14) qio_mode: Enabling QIO for flash chip ISSI
I (16) boot: SPI Speed : 80MHz
I (18) boot: SPI Mode : QIO
I (19) boot: SPI Flash Size : 2MB
I (21) boot: Partition Table:
I (22) boot: ## Label Usage Type ST Offset Length
I (25) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (28) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (31) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (34) boot: 3 factory factory app 00 00 00010000 000f8000
I (36) boot: 4 ota_0 OTA app 00 10 00108000 000f8000
I (40) boot: End of partition table
I (41) boot: Disabling RNG early entropy source...
I (43) boot: Loading app partition at offset 00108000
E (120) esp_image: Segment 1 has load address 0x3f400010, conflict with segment
data at 0x00118010
E (344) esp_image: Segment 7 has load address 0x400d0018, conflict with segment
data at 0x00148018
0x400d0018: _flash_cache_start at ??:?

I (694) boot: segment 0: paddr=0x00108018 vaddr=0x00000000 size=0x0ffe8 ( 65512)

I (694) boot: segment 1: paddr=0x00118008 vaddr=0x3f400010 size=0x0b174 ( 45428)
map
I (696) boot: segment 2: paddr=0x00123184 vaddr=0x3ffb0000 size=0x02b08 ( 11016)
load
I (701) boot: segment 3: paddr=0x00125c94 vaddr=0x40080000 size=0x00400 ( 1024)
load
0x40080000: _iram_start at ??:?

I (703) boot: segment 4: paddr=0x0012609c vaddr=0x40080400 size=0x13a04 ( 80388)
load
I (723) boot: segment 5: paddr=0x00139aa8 vaddr=0x400c0000 size=0x00000 ( 0)
load
I (724) boot: segment 6: paddr=0x00139ab0 vaddr=0x00000000 size=0x0e558 ( 58712)

I (726) boot: segment 7: paddr=0x00148010 vaddr=0x400d0018 size=0x4b3f0 (308208)
map
0x400d0018: _flash_cache_start at ??:?

Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception
was unhandled.
Register dump:
PC : 0x40122318 PS : 0x00060130 A0 : 0x8008102e A1 : 0x3f
fe3c30
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000004 A5 : 0x00
000000
A6 : 0x00000004 A7 : 0x3ff9eb14 A8 : 0x800df3cd A9 : 0x3f
fe3c20
A10 : 0x00000000 A11 : 0x00000004 A12 : 0x0000000a A13 : 0x00
000000
A14 : 0x00000000 A15 : 0x00000030 SAR : 0x00000010 EXCCAUSE: 0x00
000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0xff
ffffff

Backtrace: 0x40122318:0x3ffe3c30 0x4008102e:0x3ffe3c60 0x40078855:0x3ffe3ca0 0x4
0078a5e:0x3ffe3cd0 0x40078ff0:0x3ffe3d50 0x400800f9:0x3ffe3e70 0x40007c34:0x3ffe
3eb0 0x40000740:0x3ffe3f20
0x4008102e: call_start_cpu0 at C:/IOSiX_ELD/ESP32/esp-idf/components/esp32/cpu_s
tart.c:168

0x400800f9: _WindowUnderflow8 at ??:?


CPU halted.

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Tue May 09, 2017 4:35 am

Also, here is my partition table [2MB flash]:

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 0xF8000
ota_0, app, ota_0, 0x108000, 0xF8000

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Wed May 10, 2017 4:28 am

It would be amazing to get some sort of response here...........

When I adjust the flash tool to flash both regions and then manually switch, I get the following:

I (118603) setupgrade: OTA Partition: 3FFB9A68
E (118662) esp_image: Segment 1 has load address 0x3f400010, conflict with segment data at 0x00118010
E (118842) esp_image: Segment 7 has load address 0x400d0018, conflict with segment data at 0x00148018
0x400d0018: _flash_cache_start at ??:?
I (119128) setupgrade: Boot partition activated: ota_0


This is the code:
#define tag "setupgrade"
const esp_partition_t *OtaPartition;
err_t err;
OtaPartition = esp_ota_get_next_update_partition(NULL);
ESP_LOGI(tag, "OTA Partition: %lX", (u32)OtaPartition);

err = esp_ota_set_boot_partition(OtaPartition);
if (err == ESP_OK) {
ESP_LOGI(tag, "Boot partition activated: %s", OtaPartition->label);
} else {
ESP_LOGE(tag, "Failed to activate boot partition %s, error %d", OtaPartition->label, err);
}

So esp_ota_set_boot_partition is returning a valid result in this case, but when I go to boot:

I (12) boot: ESP-IDF v2.0-rc1-725-g07b61d54-dirty 2nd stage bootloader
0x400f55b8: lmacProcessTxopSuccess at ??:?

0x400f619d: lmacProcessTxComplete at ??:?

0x400fa5cd: ppTask at ??:?

I (12) boot: compile time 22:59:14
I (13) boot: Enabling RNG early entropy source...
I (14) qio_mode: Enabling QIO for flash chip ISSI
I (16) boot: SPI Speed : 80MHz
I (18) boot: SPI Mode : QIO
I (19) boot: SPI Flash Size : 2MB
I (21) boot: Partition Table:
I (22) boot: ## Label Usage Type ST Offset Length
I (25) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (28) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (31) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (34) boot: 3 factory factory app 00 00 00010000 000f8000
I (36) boot: 4 ota_0 OTA app 00 10 00108000 000f8000
I (40) boot: End of partition table
I (41) boot: Disabling RNG early entropy source...
I (43) boot: Loading app partition at offset 00108000
E (120) esp_image: Segment 1 has load address 0x3f400010, conflict with segment data at 0x00118010
E (344) esp_image: Segment 7 has load address 0x400d0018, conflict with segment data at 0x00148018
0x400d0018: _flash_cache_start at ??:?

I (694) boot: segment 0: paddr=0x00108018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (694) boot: segment 1: paddr=0x00118008 vaddr=0x3f400010 size=0x0b0a8 ( 45224) map
I (696) boot: segment 2: paddr=0x001230b8 vaddr=0x3ffb0000 size=0x02b08 ( 11016) load
I (701) boot: segment 3: paddr=0x00125bc8 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at ??:?

I (703) boot: segment 4: paddr=0x00125fd0 vaddr=0x40080400 size=0x13a04 ( 80388) load
I (723) boot: segment 5: paddr=0x001399dc vaddr=0x400c0000 size=0x00000 ( 0) load
I (724) boot: segment 6: paddr=0x001399e4 vaddr=0x00000000 size=0x0e624 ( 58916)
I (726) boot: segment 7: paddr=0x00148010 vaddr=0x400d0018 size=0x4b39c (308124) map
0x400d0018: _flash_cache_start at ??:?

Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x401222cf PS : 0x00060130 A0 : 0x8008102e A1 : 0x3ffe3c30
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000004 A5 : 0x00000000
A6 : 0x00000004 A7 : 0x3ff9eb14 A8 : 0x800df3cd A9 : 0x3ffe3c20
A10 : 0x00000000 A11 : 0x00000004 A12 : 0x0000000a A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000030 SAR : 0x00000010 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0xffffffff

Backtrace: 0x401222cf:0x3ffe3c30 0x4008102e:0x3ffe3c60 0x40078855:0x3ffe3ca0 0x40078a5e:0x3ffe3cd0 0x40078ff0:0x3ffe3d50 0x400800f9:0x3ffe3e70 0x40007c34:0x3ffe
3eb0 0x40000740:0x3ffe3f20
0x4008102e: call_start_cpu0 at C:/ESP32/esp-idf/components/esp32/cpu_start.c:168

0x400800f9: _WindowUnderflow8 at ??:?


CPU halted.

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Wed May 10, 2017 5:37 am

In case anyone is following along, looks like this is the operative paragraph:

App partitions have to be at offsets aligned to 0x10000 (64K). If you leave the offset field blank, the tool will automatically align the partition. If you specify an unaligned offset for an app partition, the tool will return an error.

It was 32K aligned in my partition file. Note no error was returned from the partition tool, just non-descript errors on the device. Hopefully if someone else gets this error they will find this thread. :)

As an aside, using HTTP Upload, I can now erase and flash ~570K in ~25 seconds.

ESP_Sprite
Posts: 8999
Joined: Thu Nov 26, 2015 4:08 am

Re: OTA issue

Postby ESP_Sprite » Thu May 11, 2017 2:03 am

In case you run into another bug like this: it's usually better to put these issues on Github because we have a workflow for tracking them there. If any, I'll see if we can fix the fact that the partition tool doesn't error out on an unaligned partition.

iosixllc
Posts: 71
Joined: Fri Mar 17, 2017 12:13 am

Re: OTA issue

Postby iosixllc » Thu May 11, 2017 9:13 pm

Good to know, thanks!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: OTA issue

Postby ESP_Angus » Fri May 12, 2017 2:34 am

Thanks for reporting this, iosixllc. A fix for the issue is in our internal review & merge queue.

Who is online

Users browsing this forum: raywo_esp and 123 guests