ESP-IDF 5.0 ESP32-S2 【LoadStoreAlignment】异常

AIoT-ESP32
Posts: 6
Joined: Wed Sep 01, 2021 2:52 pm

ESP-IDF 5.0 ESP32-S2 【LoadStoreAlignment】异常

Postby AIoT-ESP32 » Thu Feb 24, 2022 10:56 am

IDF-VER: ESP-IDF v5.0-dev-1599-gb66cc63c41

测试代码:
void app_main()
{
ESP_LOGI(TAG, "[APP] Startup..");
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_LOGI(TAG, "logo_display....");
esp_vfs_spiffs_conf_t conf = {
.base_path = "/spiffs",
.partition_label = NULL,
.max_files = 5,
.format_if_mount_failed = false};
uint8_t *buf;
size_t total = 0, used = 0;
long fsz;
FILE *fd;
/*!< Use settings defined above to initialize and mount SPIFFS filesystem. */
/*!< Note: esp_vfs_spiffs_register is an all-in-one convenience function. */
ESP_ERROR_CHECK(esp_vfs_spiffs_register(&conf));
ESP_ERROR_CHECK(esp_spiffs_info(NULL, &total, &used));

fd = fopen("/spiffs/yuv420_480.jpg", "r");

if (fd)
{
fseek(fd, 0, SEEK_END);
fsz = ftell(fd);
fseek(fd, 0, SEEK_SET);

buf = heap_caps_malloc(fsz, MALLOC_CAP_DEFAULT);
if (buf)
{
ESP_LOGI(TAG, "%s %d %08x %ld\r\n", __func__, __LINE__, (uint32_t)buf, fsz);
read_bytes = fread(buf, 1, fsz, fd);
}
}
while (1)
{
vTaskDelay(1000);
}
}
log:
I (21) boot: ESP-IDF v5.0-dev-1599-gb66cc63c41 2nd stage bootloader
I (21) boot: compile time 18:11:34
I (21) boot: chip revision: 0
I (25) qio_mode: Enabling default flash chip QIO
I (31) boot.esp32s2: SPI Speed : 80MHz
I (36) boot.esp32s2: SPI Mode : QIO
I (40) boot.esp32s2: SPI Flash Size : 4MB
I (45) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (54) boot: ## Label Usage Type ST Offset Length
I (61) boot: 0 nvs WiFi data 01 02 0000d000 00008000
I (69) boot: 1 fctry WiFi data 01 02 00015000 00004000
I (76) boot: 2 log_status WiFi data 01 02 00019000 00004000
I (84) boot: 3 otadata OTA data 01 00 0001d000 00002000
I (91) boot: 4 phy_init RF data 01 01 0001f000 00001000
I (99) boot: 5 ota_0 OTA app 00 10 00020000 00180000
I (106) boot: 6 ota_1 OTA app 00 11 001a0000 00180000
I (114) boot: 7 coredump Unknown data 01 03 00320000 00010000
I (121) boot: 8 log_info Unknown data 01 fe 00330000 00010000
I (129) boot: 9 storage Unknown data 01 82 00340000 000b6000
I (136) boot: End of partition table
I (141) boot: No factory image, trying OTA 0
I (145) esp_image: segment 0: paddr=00020020 vaddr=3f000020 size=07a64h ( 31332) map
I (159) esp_image: segment 1: paddr=00027a8c vaddr=3ffbeac0 size=01d5ch ( 7516) load
I (164) esp_image: segment 2: paddr=000297f0 vaddr=40024000 size=06828h ( 26664) load
I (177) esp_image: segment 3: paddr=00030020 vaddr=40080020 size=1a4fch (107772) map
I (198) esp_image: segment 4: paddr=0004a524 vaddr=4002a828 size=04294h ( 17044) load
I (202) esp_image: segment 5: paddr=0004e7c0 vaddr=50000000 size=00010h ( 16) load
I (209) boot: Loaded app from partition at offset 0x20000
I (282) boot: Set actual ota_seq=1 in otadata[0]
I (282) boot: Disabling RNG early entropy source...
I (293) cache: Instruction cache : size 8KB, 4Ways, cache line size 32Byte
I (293) cache: Data cache : size 8KB, 4Ways, cache line size 32Byte
I (296) spiram: Found 16MBit SPI RAM device
I (301) spiram: SPI RAM mode: sram 80m
I (305) spiram: PSRAM initialized, cache is in normal (1-core) mode.
I (531) cpu_start: Pro cpu up.
I (538) cpu_start: Pro cpu start user code
I (538) cpu_start: cpu freq: 240000000 Hz
I (538) cpu_start: Application information:
I (541) cpu_start: Project name: esp32-s2-iot
I (547) cpu_start: App version: 1
I (551) cpu_start: Compile time: Feb 24 2022 18:02:33
I (557) cpu_start: ELF file SHA256: a21660e510d723ef...
I (563) cpu_start: ESP-IDF: v5.0-dev-1599-gb66cc63c41
I (570) heap_init: Initializing. RAM available for dynamic allocation:
I (577) heap_init: At 3FFC10A8 len 0003AF58 (235 KiB): DRAM
I (583) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM
I (590) heap_init: At 3FF9E000 len 00002000 (8 KiB): RTCRAM
I (596) spi_flash: detected chip: generic
I (601) spi_flash: flash io: qio
I (605) cpu_start: Starting scheduler on PRO CPU.
I (610) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (618) main: [APP] Startup..
I (622) main: [APP] Free memory: 2306723 bytes
I (627) main: [APP] IDF version: v5.0-dev-1599-gb66cc63c41
I (633) main: logo_display....
I (670) main: app_main 49 3f501dbc 64534

Guru Meditation Error: Core 0 panic'ed (LoadStoreAlignment). Exception was unhandled.

Core 0 register dump:
PC : 0x40089259 PS : 0x00060530 A0 : 0x80086667 A1 : 0x3ffc3a80
0x40089259: spiffs_object_read at E:/project/espressif/esp-idf/components/spiffs/spiffs/src/spiffs_nucleus.c:2015

A2 : 0x3f5012cc A3 : 0x3f501b40 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x3f50196d A7 : 0x00000000 A8 : 0x00000000 A9 : 0x3ffc3a50
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3f5013c0 A13 : 0x0008a500
A14 : 0x00000100 A15 : 0x3f50193c SAR : 0x00000004 EXCCAUSE: 0x00000009
EXCVADDR: 0x3f50196d LBEG : 0x3f5013c0 LEND : 0x0008a500 LCOUNT : 0x40026434
0x40026434: _xt_user_exc at E:/project/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:643



Backtrace:0x40089256:0x3ffc3a800x40086664:0x3ffc3ac0 0x40085dd9:0x3ffc3af0 0x4008222e:0x3ffc3b10 0x4001a1cb:0x3ffc3b30 0x4001a66d:0x3ffc3b50 0x4008cc01:0x3ffc3b70 0x4008c40d:0x3ffc3b90 0x4008c49d:0x3ffc3bd0 0x40085476:0x3ffc3bf0 0x4009a278:0x3ffc3c40
0x40089256: spiffs_object_read at E:/project/espressif/esp-idf/components/spiffs/spiffs/src/spiffs_nucleus.c:2015

0x40086664: spiffs_hydro_read at E:/project/espressif/esp-idf/components/spiffs/spiffs/src/spiffs_hydrogen.c:414
(inlined by) SPIFFS_read at E:/project/espressif/esp-idf/components/spiffs/spiffs/src/spiffs_hydrogen.c:426

0x40085dd9: vfs_spiffs_read at E:/project/espressif/esp-idf/components/spiffs/esp_spiffs.c:488

0x4008222e: esp_vfs_read at E:/project/espressif/esp-idf/components/vfs/vfs.c:462 (discriminator 3)

0x4008cc01: __srefill_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s2-elf/src/newlib/newlib/libc/stdio/refill.c:117

0x4008c40d: _fread_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s2-elf/src/newlib/newlib/libc/stdio/fread.c:228

0x4008c49d: fread at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32s2-elf/src/newlib/newlib/libc/stdio/fread.c:266

0x40085476: app_main at e:\project\esp32_s2\esp32s2-iot\examples\test\build/../main/main.c:50 (discriminator 13)

0x4009a278: main_task at E:/project/espressif/esp-idf/components/freertos/FreeRTOS-Kernel/portable/port_common.c:127

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: ESP-IDF 5.0 ESP32-S2 【LoadStoreAlignment】异常

Postby Craige Hales » Thu Feb 24, 2022 1:22 pm

Code looks very similar to mine.

1) will it work if you read 10 bytes instead of 64534?
2) does using

Code: Select all

fopen(..., "rb")
help?
Craige

AIoT-ESP32
Posts: 6
Joined: Wed Sep 01, 2021 2:52 pm

Re: ESP-IDF 5.0 ESP32-S2 【LoadStoreAlignment】异常

Postby AIoT-ESP32 » Fri Feb 25, 2022 2:55 am

Code: Select all

void app_main()
{
    ESP_LOGI(TAG, "[APP] Startup..");
    ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
    ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
    ESP_LOGI(TAG, "logo_display....");
    esp_vfs_spiffs_conf_t conf = {
        .base_path = "/spiffs",
        .partition_label = NULL,
        .max_files = 5,
        .format_if_mount_failed = false};
    uint8_t *buf;
    size_t total = 0, used = 0;
    long fsz;
    FILE *fd;
    /*!< Use settings defined above to initialize and mount SPIFFS filesystem. */
    /*!< Note: esp_vfs_spiffs_register is an all-in-one convenience function. */
    ESP_ERROR_CHECK(esp_vfs_spiffs_register(&conf));
    ESP_ERROR_CHECK(esp_spiffs_info(NULL, &total, &used));

    fd = fopen("/spiffs/yuv420_480.jpg", "r");

    if (fd)
    {
        fseek(fd, 0, SEEK_END);
        fsz = ftell(fd);
        fseek(fd, 0, SEEK_SET);

        buf = heap_caps_malloc(fsz, MALLOC_CAP_DEFAULT);
        if (buf)
        {
            ESP_LOGI(TAG, "%s %d %08x %ld\r\n", __func__, __LINE__, (uint32_t)buf, fsz);
            fread(buf, 1, fsz, fd);
        }
    }
    while (1)
    {
        vTaskDelay(1000);
    }
}

Who is online

Users browsing this forum: No registered users and 93 guests