esp_partition_write
Posted: Fri Aug 02, 2019 10:27 pm
I trying to erase whole 8Mb partition with esp_partition_erase_range and it cause flash corruption and boot errors. when i tryed smaller partittion (2Mb) it works without issues.
here is my code
partition.csv
app_main.c
and monitor output
here is my code
partition.csv
Code: Select all
# Name,Type,SubType,Offset,Size,Flags
# Note: if you change the phy_init or app partition offset,make sure to change the offset in Kconfig.projbuild
nvs,data,nvs,,0x006000,
phy_init,data,phy,,0x001000,
factory,app,factory,,2M,
data,data,0x90,0x0500000,8M,
- #include <stdio.h>
- #include <esp_partition.h>
- #include <string.h>
- #define ERASE_SIZE 1024*1024
- void app_main(){
- const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, 0x90, NULL);
- printf("partition %p, %d\n", (void*)(partition->address), partition->size);
- //ESP_ERROR_CHECK(esp_partition_erase_range(partition, 0, partition->size));
- size_t i=0;
- do {
- printf("erasing %d\n",i);
- ESP_ERROR_CHECK(esp_partition_erase_range(partition, i, ERASE_SIZE));
- printf("done %d\n",i);
- i += ERASE_SIZE;
- } while( i < partition->size);
- printf("done\n");
- }
Code: Select all
I (30) boot: ESP-IDF v3.3-beta1-522-g0f927791b 2nd stage bootloader
I (30) boot: compile time 00:48:23
I (30) boot: Enabling RNG early entropy source...
I (36) boot: SPI Speed : 40MHz
I (40) boot: SPI Mode : DIO
I (44) boot: SPI Flash Size : 16MB
I (48) boot: Partition Table:
I (52) boot: ## Label Usage Type ST Offset Length
I (59) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (67) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (74) boot: 2 factory factory app 00 00 00010000 00200000
I (82) boot: 3 data Unknown data 01 90 00500000 00400000
I (89) boot: End of partition table
I (93) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x078e0 ( 30944) map
I (113) esp_image: segment 1: paddr=0x00017908 vaddr=0x3ffb0000 size=0x01ea4 ( 7844) load
I (116) esp_image: segment 2: paddr=0x000197b4 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _WindowOverflow4 at /Users/geka/SoftwareDevelop/Projects/esp32/esp-idf/components/freertos/xtensa_vectors.S:1779
I (120) esp_image: segment 3: paddr=0x00019bbc vaddr=0x40080400 size=0x06454 ( 25684) load
I (140) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x12460 ( 74848) map
0x400d0018: _flash_cache_start at ??:?
I (166) esp_image: segment 5: paddr=0x00032480 vaddr=0x40086854 size=0x02160 ( 8544) load
0x40086854: prvCheckForValidListAndQueue at /Users/geka/SoftwareDevelop/Projects/esp32/esp-idf/components/freertos/timers.c:327
I (175) boot: Loaded app from partition at offset 0x10000
I (175) boot: Disabling RNG early entropy source...
I (178) cpu_start: Pro cpu up.
I (181) cpu_start: Application information:
I (186) cpu_start: Project name: test_partition
I (192) cpu_start: App version: 1
I (196) cpu_start: Compile time: Aug 3 2019 00:47:47
I (202) cpu_start: ELF file SHA256: f9343944610556cb...
I (208) cpu_start: ESP-IDF: v3.3-beta1-522-g0f927791b
I (215) cpu_start: Starting app cpu, entry point is 0x40080ec4
0x40080ec4: call_start_cpu1 at /Users/geka/SoftwareDevelop/Projects/esp32/esp-idf/components/esp32/cpu_start.c:267
I (0) cpu_start: App cpu up.
I (225) heap_init: Initializing. RAM available for dynamic allocation:
I (232) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (238) heap_init: At 3FFB2EE8 len 0002D118 (180 KiB): DRAM
I (244) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (251) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (257) heap_init: At 400889B4 len 0001764C (93 KiB): IRAM
I (263) cpu_start: Pro cpu start user code
I (281) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
partition 0x500000, 4194304
erasing 0
erase range
done 0
erasing 1048576
erase range
done 1048576
erasing 2097152
erase range
E (10410) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10410) task_wdt: - IDLE0 (CPU 0)
E (10410) task_wdt: Tasks currently running:
E (10410) task_wdt: CPU 0: main
E (10410) task_wdt: CPU 1: IDLE1
done 2097152
erasing 3145728
erase range
done 3145728
done
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d1cbc: a0b200a4 ffffffff ffffffff
0x400d1cbc: app_main at /Users/geka/SoftwareDevelop/Projects/esp32/Uboy/software/test_partition/main/app_main.c:31
Core 0 register dump:
PC : 0x400d1cc1 PS : 0x00060930 A0 : 0x800d0989 A1 : 0x3ffb4c70
0x400d1cc1: app_main at /Users/geka/SoftwareDevelop/Projects/esp32/Uboy/software/test_partition/main/app_main.c:31
A2 : 0x3ffb6a84 A3 : 0x3ffb69b0 A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00060021 A7 : 0x00000000 A8 : 0x800d1cb9 A9 : 0x3ffb4c50
A10 : 0x3ffb6a84 A11 : 0x000000ff A12 : 0x00000400 A13 : 0x06ff9ff8
A14 : 0x3ffaffd4 A15 : 0x00060023 SAR : 0x00000004 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffe
ELF file SHA256: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Backtrace: 0x400d1cc1:0x3ffb4c70 0x400d0986:0x3ffb4c90 0x40084659:0x3ffb4cb0
0x400d1cc1: app_main at /Users/geka/SoftwareDevelop/Projects/esp32/Uboy/software/test_partition/main/app_main.c:31
0x400d0986: main_task at /Users/geka/SoftwareDevelop/Projects/esp32/esp-idf/components/esp32/cpu_start.c:530
0x40084659: vPortTaskWrapper at /Users/geka/SoftwareDevelop/Projects/esp32/esp-idf/components/freertos/port.c:403
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
�eׁJ�a����SI��t��E7�)U}�A*�e1�S�%�O�J!+͡ �Y� ��q ���
�R�*U�I�o�'�ŷBA�_�P*�e1�H%=O�J!+�� �V��er. ʰ�j
�W�m�Z�)3�Lj