ESP32 issue when updating ESP-iDF to version 4.4.5 and higher

rooti92
Posts: 4
Joined: Fri Aug 27, 2021 10:20 am

ESP32 issue when updating ESP-iDF to version 4.4.5 and higher

Postby rooti92 » Mon Sep 25, 2023 4:21 pm

Hi guys,

I have a problem with simple code in esp32. When I use esp-idf in a version lower than version 4.4.5, everything was fine. But when I wanted to update to esp-idf v4.4.5 or v.5.1, the problem started. Firmware stops at: cpu_start: init function call: 0x4200a7e4[0m.
But when I remove the lines that make up the button and just stick with cout, it works...

I also tried creating a small class with a method to print something and it also caused cpu_start to stop. It looks like I have some problem with C++?

Code:

Code: Select all

Drivers::Button* Drivers::Button::createButton(uint8_t t_buttonNumber, uint8_t t_buttonActiveLevel)
{
    button_handle_t buttonHandle;

    button_config_t gpio_btn_cfg = 
    {
        .type = BUTTON_TYPE_GPIO,
        .gpio_button_config = 
        {
            .gpio_num = t_buttonNumber,
            .active_level = t_buttonActiveLevel,
        },
    };

    buttonHandle = iot_button_create(&gpio_btn_cfg);
    if(nullptr != buttonHandle)
    {
        return new Button(buttonHandle, t_buttonNumber, t_buttonActiveLevel);
    }
    return nullptr;
}

Code: Select all

esp_err_t Drivers::Button::registerButtonEvtCallback(button_event_t t_callbackFunctionType, button_cb_t t_callbackFunction)
{
    return ESP_OK;
}

Code: Select all

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "esp_system.h"
#include "esp_sleep.h"

#include <iostream>
#include <memory>
#include <string>

extern "C" {
    void app_main();
}

void app_main(void)
{

    // Register debug mode for no sleep mode.
    Drivers::Button* button;
    button = Drivers::Button::createButton(GPIO_NUM_4, GPIO_NUM_0);
    button->registerButtonEvtCallback(BUTTON_PRESS_REPEAT, buttonPressRepeat);

    while (1)
    {
        vTaskDelay(pdMS_TO_TICKS(100));
        std::cout << "hello world " << std::endl;
    }
}
This is the log:

Code: Select all

[Codebox=text file=Untitled.txt]=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2023.09.25 16:47:17 =~=~=~=~=~=~=~=~=~=~=~=
:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x1dc8
load:0x403cc710,len:0xa2c
load:0x403ce710,len:0x3438
entry 0x403cc710
[0;32mI (31) boot: ESP-IDF v5.1.1 2nd stage bootloader[0m
[0;32mI (31) boot: compile time Sep 21 2023 22:02:29[0m
D (31) bootloader_flash: XMC chip detected by RDID (00204016), skip.[0m
D (36) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)[0m
[0;32mI (43) boot: chip revision: v0.3[0m
D (47) boot.esp32c3: magic e9[0m
D (50) boot.esp32c3: segments 03[0m
D (53) boot.esp32c3: spi_mode 02[0m
D (57) boot.esp32c3: spi_speed 0f[0m
D (60) boot.esp32c3: spi_size 02[0m
[0;32mI (63) boot.esp32c3: SPI Speed      : 80MHz[0m
[0;32mI (68) boot.esp32c3: SPI Mode       : DIO[0m
[0;32mI (73) boot.esp32c3: SPI Flash Size : 4MB[0m
D (78) boot: Enabling RTCWDT(9000 ms)[0m
[0;32mI (81) boot: Enabling RNG early entropy source...[0m
D (87) bootloader_flash: rodata starts from paddr=0x00008000, size=0xc00, will be mapped to vaddr=0x3c000000[0m
D (97) boot: mapped partition table 0x8000 at 0x3c008000[0m
D (102) flash_parts: partition table verified, 4 entries[0m
[0;32mI (107) boot: Partition Table:[0m
[0;32mI (111) boot: ## Label            Usage          Type ST Offset   Length[0m
D (118) boot: load partition table entry 0x3c008000[0m
D (123) boot: type=1 subtype=2[0m
[0;32mI (127) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
D (134) boot: load partition table entry 0x3c008020[0m
D (139) boot: type=1 subtype=1[0m
[0;32mI (142) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
D (150) boot: load partition table entry 0x3c008040[0m
D (155) boot: type=0 subtype=0[0m
[0;32mI (158) boot:  2 factory          factory app      00 00 00010000 00100000[0m
[0;32mI (165) boot: End of partition table[0m
D (170) boot: Trying partition index -1 offs 0x10000 size 0x100000[0m
D (176) esp_image: reading image header @ 0x10000[0m
D (181) bootloader_flash: mmu set block paddr=0x00010000 (was 0xffffffff)[0m
D (187) esp_image: image header: 0xe9 0x05 0x02 0x02 40380430[0m
[0;32mI (193) esp_image: segment 0: paddr=00010020 vaddr=3c0b0020 size=3d250h (250448) map[0m
D (202) esp_image: free data page_count 0x00000080[0m
D (207) bootloader_flash: rodata starts from paddr=0x00010020, size=0x3d250, will be mapped to vaddr=0x3c000000[0m
D (258) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)[0m
[0;32mI (258) esp_image: segment 1: paddr=0004d278 vaddr=3fc8d600 size=01f78h (  8056) load[0m
D (262) esp_image: free data page_count 0x00000080[0m
D (267) bootloader_flash: rodata starts from paddr=0x0004d278, size=0x1f78, will be mapped to vaddr=0x3c000000[0m
D (278) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)[0m
[0;32mI (283) esp_image: segment 2: paddr=0004f1f8 vaddr=40380000 size=00e20h (  3616) load[0m
D (292) esp_image: free data page_count 0x00000080[0m
D (297) bootloader_flash: rodata starts from paddr=0x0004f1f8, size=0xe20, will be mapped to vaddr=0x3c000000[0m
D (308) bootloader_flash: mmu set block paddr=0x00050000 (was 0xffffffff)[0m
[0;32mI (314) esp_image: segment 3: paddr=00050020 vaddr=42000020 size=ad8d0h (710864) map[0m
D (322) esp_image: free data page_count 0x00000080[0m
D (327) bootloader_flash: rodata starts from paddr=0x00050020, size=0xad8d0, will be mapped to vaddr=0x3c000000[0m
D (453) bootloader_flash: mmu set block paddr=0x000f0000 (was 0xffffffff)[0m
[0;32mI (453) esp_image: segment 4: paddr=000fd8f8 vaddr=40380e20 size=0c604h ( 50692) load[0m
D (457) esp_image: free data page_count 0x00000080[0m
D (462) bootloader_flash: rodata starts from paddr=0x000fd8f8, size=0xc604, will be mapped to vaddr=0x3c000000[0m
D (481) bootloader_flash: mmu set block paddr=0x00100000 (was 0xffffffff)[0m
D (482) boot: Calculated hash: 38067d5cf1acf3cfc6c80448c60c0b738fd2eea1ebeb8b69b392aad3a2b6764b[0m
[0;32mI (491) boot: Loaded app from partition at offset 0x10000[0m
[0;32mI (493) boot: Disabling RNG early entropy source...[0m
D (499) boot: Mapping segment 0 as DROM[0m
D (503) boot: Mapping segment 3 as IROM[0m
D (507) boot: calling set_cache_and_start_app[0m
D (511) boot: configure drom and irom and start[0m
D (516) boot: start: 0x40380430[0m
[0;32mI (530) cpu_start: Unicore app[0m
[0;32mI (531) cpu_start: Pro cpu up.[0m
D (539) clk: RTC_SLOW_CLK calibration value: 3533069[0m
[0;32mI (544) cpu_start: Pro cpu start user code[0m
[0;32mI (544) cpu_start: cpu freq: 160000000 Hz[0m
[0;32mI (544) cpu_start: Application information:[0m
[0;32mI (547) cpu_start: Project name:     FloodSensor[0m
[0;32mI (552) cpu_start: App version:      0.2.4-b[0m
[0;32mI (557) cpu_start: Compile time:     Sep 21 2023 22:06:53[0m
[0;32mI (563) cpu_start: ELF file SHA256:  e6f5c0d9c8af570f...[0m
[0;32mI (569) cpu_start: ESP-IDF:          v5.1.1[0m
[0;32mI (574) cpu_start: Min chip rev:     v0.0[0m
[0;32mI (579) cpu_start: Max chip rev:     v0.99 [0m
[0;32mI (584) cpu_start: Chip rev:         v0.3[0m
D (589) memory_layout: Checking 5 reserved memory ranges:[0m
D (594) memory_layout: Reserved memory range 0x3fc80000 - 0x3fc8d600[0m
D (600) memory_layout: Reserved memory range 0x3fc8d600 - 0x3fc983a0[0m
D (607) memory_layout: Reserved memory range 0x3fcdf060 - 0x3fce0000[0m
D (613) memory_layout: Reserved memory range 0x50000000 - 0x50000010[0m
D (620) memory_layout: Reserved memory range 0x50001fe8 - 0x50002000[0m
D (626) memory_layout: Building list of available memory regions:[0m
D (632) memory_layout: Available memory region 0x3fc983a0 - 0x3fca0000[0m
D (639) memory_layout: Available memory region 0x3fca0000 - 0x3fcc0000[0m
D (645) memory_layout: Available memory region 0x3fcc0000 - 0x3fcdc710[0m
D (652) memory_layout: Available memory region 0x3fcdc710 - 0x3fcdf060[0m
D (659) memory_layout: Available memory region 0x50000010 - 0x50001fe8[0m
[0;32mI (665) heap_init: Initializing. RAM available for dynamic allocation:[0m
D (673) heap_init: New heap initialised at 0x3fc983a0[0m
[0;32mI (678) heap_init: At 3FC983A0 len 00044370 (272 KiB): DRAM[0m
[0;32mI (684) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM[0m
D (691) heap_init: New heap initialised at 0x50000010[0m
[0;32mI (696) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM[0m
D (702) intr_alloc: Connected src 27 to int 2 (cpu 0)[0m
D (708) spi_flash: trying chip: issi[0m
D (711) spi_flash: trying chip: gd[0m
D (714) spi_flash: trying chip: mxic[0m
D (718) spi_flash: trying chip: winbond[0m
D (722) spi_flash: trying chip: boya[0m
D (725) spi_flash: trying chip: th[0m
D (729) spi_flash: trying chip: generic[0m
[0;32mI (733) spi_flash: detected chip: generic[0m
[0;32mI (737) spi_flash: flash io: dio[0m
D (741) cpu_start: calling init function: 0x42091e2e[0m
D (747) cpu_start: calling init function: 0x4208d1f8[0m
D (752) cpu_start: calling init function: 0x42082f5c[0m
D (757) cpu_start: calling init function: 0x4208249a[0m
D (762) cpu_start: calling init function: 0x4207a42a[0m
D (767) cpu_start: calling init function: 0x42072684[0m
D (772) cpu_start: calling init function: 0x4207251c[0m
D (777) cpu_start: calling init function: 0x42072430[0m
D (782) cpu_start: calling init function: 0x42071bd2[0m
D (787) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (794) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 18 bit[0m
D (801) cpu_start: calling init function: 0x4205b4f0[0m
D (806) cpu_start: calling init function: 0x42039676[0m
D (811) cpu_start: calling init function: 0x4201746e[0m
D (816) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (823) efuse: In EFUSE_BLK2__DATA4_REG is used 10 bits starting with 20 bit[0m
D (830) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (837) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 30 bit[0m
D (844) efuse: In EFUSE_BLK2__DATA5_REG is used 8 bits starting with 0 bit[0m
D (851) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (858) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 8 bit[0m
D (865) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (872) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 18 bit[0m
D (879) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (886) efuse: In EFUSE_BLK2__DATA4_REG is used 10 bits starting with 20 bit[0m
D (893) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (900) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 30 bit[0m
D (907) efuse: In EFUSE_BLK2__DATA5_REG is used 8 bits starting with 0 bit[0m
D (914) efuse: In EFUSE_BLK2__DATA4_REG is used 2 bits starting with 0 bit[0m
D (921) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 8 bit[0m
D (928) cpu_start: calling init function: 0x42017400[0m
[0;33mW (933) ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`[0m
D (941) cpu_start: calling init function: 0x42013186[0m
D (948) cpu_start: calling init function: 0x4200fd4a[0m
D (951) cpu_start: calling init function: 0x4200fac6[0m
D (956) cpu_start: calling init function: 0x4200c870[0m
D (961) cpu_start: calling init function: 0x4200c634[0m
D (966) cpu_start: calling init function: 0x4200bdb2[0m
D (971) cpu_start: calling init function: 0x4200b234[0m
D (977) cpu_start: calling init function: 0x4200abc0[0m
D (982) cpu_start: calling init function: 0x4200aaa8[0m
D (987) cpu_start: calling init function: 0x4200a95c[0m
D (992) cpu_start: calling init function: 0x4200a8c2[0m
D (997) cpu_start: calling init function: 0x4200a816[0m
D (1002) cpu_start: calling init function: 0x4200a7e4[0m

ESP_adokitkat
Posts: 52
Joined: Thu Jun 22, 2023 12:50 pm

Re: ESP32 issue when updating ESP-iDF to version 4.4.5 and higher

Postby ESP_adokitkat » Fri Oct 06, 2023 1:37 pm

Hello.

Thank you for reporting this issue. I have notified my colleagues about it.

ESP_jakob
Posts: 49
Joined: Mon Jun 01, 2020 6:28 am

Re: ESP32 issue when updating ESP-iDF to version 4.4.5 and higher

Postby ESP_jakob » Sat Oct 07, 2023 3:45 am

Hello,

what might be the issue here is a C++ object declared static which is doing some initialization in its constructor before the necessary components are initialized. Is there something like this in the code?

Do you have a complete reproducing example? This would help us a lot with debugging.

Kind Regards,
Jakob

Who is online

Users browsing this forum: Baidu [Spider] and 156 guests