m5stack / uiflow-micropython

uiflow micropython project
https://uiflow2.m5stack.com
MIT License
45 stars 27 forks source link

WIP: esp32c3 support #5

Closed imliubo closed 2 years ago

imliubo commented 2 years ago

Hi @lovyan03 ,

At this commit 1760a2a with esp32c3 support.

If enable this MODULE_M5UNIFIED_ENABLED will cause the below error, what do you think?

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40380726
0x40380726: esp_restart_noos at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/port/soc/esp32c3/system_internal.c:146 (discriminator 1)

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xe3c
load:0x403ce000,len:0x6f4
load:0x403d0000,len:0x28ec
entry 0x403ce000
I (281) cpu_start: Pro cpu up.
D (282) efuse: In EFUSE_BLK1__DATA3_REG is used 3 bits starting with 18 bit
D (282) efuse: In EFUSE_BLK1__DATA5_REG is used 5 bits starting with 5 bit
D (288) efuse: In EFUSE_BLK1__DATA4_REG is used 7 bits starting with 7 bit
D (295) efuse: In EFUSE_BLK1__DATA4_REG is used 7 bits starting with 14 bit
D (302) efuse: In EFUSE_BLK1__DATA4_REG is used 8 bits starting with 21 bit
D (309) efuse: In EFUSE_BLK1__DATA4_REG is used 3 bits starting with 29 bit
D (316) efuse: In EFUSE_BLK1__DATA5_REG is used 5 bits starting with 0 bit
D (331) clk: RTC_SLOW_CLK calibration value: 3820621
I (339) cpu_start: Pro cpu start user code
I (339) cpu_start: cpu freq: 160000000
I (339) cpu_start: Application information:
I (342) cpu_start: Compile time:     Mar  1 2022 12:08:51
I (348) cpu_start: ELF file SHA256:  888ff4bb807f579e...
I (354) cpu_start: ESP-IDF:          v4.4-beta1-286-g014ee65f1f
D (361) memory_layout: Checking 4 reserved memory ranges:
D (366) memory_layout: Reserved memory range 0x3fc80000 - 0x3fc92e00
D (373) memory_layout: Reserved memory range 0x3fc92e00 - 0x3fc9d860
D (379) memory_layout: Reserved memory range 0x3fcdf060 - 0x3fce0000
D (385) memory_layout: Reserved memory range 0x50000000 - 0x50000830
D (392) memory_layout: Building list of available memory regions:
D (398) memory_layout: Available memory region 0x3fc9d860 - 0x3fca0000
D (405) memory_layout: Available memory region 0x3fca0000 - 0x3fcc0000
D (411) memory_layout: Available memory region 0x3fcc0000 - 0x3fcdf060
D (418) memory_layout: Available memory region 0x50000830 - 0x50002000
I (424) heap_init: Initializing. RAM available for dynamic allocation:
D (432) heap_init: New heap initialised at 0x3fc9d860
I (437) heap_init: At 3FC9D860 len 000227A0 (137 KiB): D/IRAM
I (443) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
D (450) heap_init: New heap initialised at 0x50000830
I (455) heap_init: At 50000830 len 000017D0 (5 KiB): RTCRAM
D (462) FLASH_HAL: extra_dummy: 0
D (465) spi_flash: trying chip: issi
D (468) spi_flash: trying chip: gd
D (472) spi_flash: trying chip: mxic
D (476) spi_flash: trying chip: winbond
D (480) spi_flash: trying chip: boya
D (483) spi_flash: trying chip: generic
I (487) spi_flash: detected chip: generic
I (492) spi_flash: flash io: dio
D (496) cpu_start: calling init function: 0x42112cd4
0x42112cd4: _GLOBAL__sub_I___cxa_get_globals_fast at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_globals.cc:145

D (501) cpu_start: calling init function: 0x421125fe
0x421125fe: _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:745
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/ext/concurrence.h:135
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:36
 (inlined by) _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:125

D (506) cpu_start: calling init function: 0x421124a6
0x421124a6: _GLOBAL__sub_I__ZN9__gnu_cxx9__freeresEv at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:348

D (511) cpu_start: calling init function: 0x42112302
0x42112302: _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:745
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/ext/concurrence.h:135
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:33
 (inlined by) _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:71

D (516) cpu_start: calling init function: 0x4209a266
0x4209a266: esp_reset_reason_get_hint at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/port/soc/esp32c3/reset_reason.c:107
 (inlined by) esp_reset_reason_init at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/port/soc/esp32c3/reset_reason.c:68

D (521) cpu_start: calling init function: 0x420931f2
0x420931f2: adc2_init_code_calibration at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/driver/esp32c3/adc2_init_cal.c:24

D (526) efuse: In EFUSE_BLK2__DATA4_REG is used 3 bits starting with 0 bit
D (533) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 18 bit
D (540) cpu_start: calling init function: 0x42059366
0x42059366: cpp::bitwizeshift::detail::result_union<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t, true>::result_union<>(cpp::bitwizeshift::in_place_t) at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:3837
 (inlined by) cpp::bitwizeshift::detail::result_construct_base<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t>::result_construct_base<>(cpp::bitwizeshift::in_place_t) at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:3954
 (inlined by) cpp::bitwizeshift::result<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t>::result<lgfx::v1::i2c::i2c_context_t::state_t, void>() at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:4292
 (inlined by) lgfx::v1::i2c::i2c_context_t::i2c_context_t() at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:487
 (inlined by) __static_initialization_and_destruction_0 at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:560
 (inlined by) _GLOBAL__sub_I__ZN4lgfx2v115getApbFrequencyEv at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:1090

D (545) cpu_start: calling init function: 0x42027d70
0x42027d70: _GLOBAL__sub_I_M5 at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5Unified/src/M5Unified.cpp:669

D (550) cpu_start: calling init function: 0x42003fbc
0x42003fbc: s_set_default_wifi_log_level at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_wifi/src/wifi_init.c:70

D (555) cpu_start: calling init function: 0x4200002a
0x4200002a: esp_ota_get_app_elf_sha256 at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/app_update/esp_app_desc.c:82
 (inlined by) esp_ota_init_app_elf_sha256 at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/app_update/esp_app_desc.c:69

D (560) intr_alloc: Connected src 39 to int 2 (cpu 0)
I (565) sleep: Configure to isolate all GPIO pins in sleep state
I (572) sleep: Enable automatic switching of GPIO sleep configuration
I (590) coexist: coexist rom version 9387209
D (591) intr_alloc: Connected src 50 to int 3 (cpu 0)
I (591) cpu_start: Starting scheduler.
D (594) intr_alloc: Connected src 37 to int 4 (cpu 0)
D (594) heap_init: New heap initialised at 0x3fcc0000
D (594) intr_alloc: Connected src 33 to int 7 (cpu 0)
D (604) partition: Loading the partition table
D (604) partition: Partition table MD5 verified
D (614) intr_alloc: Connected src 21 to int 9 (cpu 0)
D (614) intr_alloc: Connected src 16 to int 10 (cpu 0)
MicroPython v1.18-1-g1760a2a on 2022-03-01; M5STACK C3 with ESP32C3
Type "help()" for more information.
>>> 
***ERROR*** A stack overflow in task IDLE has been detected.
Stack dump detected
Core  0 register dump:
MEPC    : 0x4038075a  RA      : 0x4038be68  SP      : 0x3fc97420  GP      : 0x3fc93600  
0x4038075a: panic_abort at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/panic.c:402

0x4038be68: __ubsan_include at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/ubsan.c:294

TP      : 0x3fc67cdc  T0      : 0x4005890e  T1      : 0x74732041  T2      : 0x00000001  
S0/FP   : 0x3fc97434  S1      : 0x80000004  A0      : 0x3fc97434  A1      : 0x3c131f50  
A2      : 0x00000014  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x3fc9c000  
A6      : 0x7265766f  A7      : 0x206b6361  S2      : 0x3fc9c890  S3      : 0x00000001  
S4      : 0x3fc97704  S5      : 0x7fffffff  S6      : 0x3fc9c890  S7      : 0x00000000  
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x202a2a2a  T4      : 0x524f5252  T5      : 0x452a2a2a  T6      : 0x00000000  
MSTATUS : 0x00001801  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
0x40380001: _vector_table at ??:?

MHARTID : 0x00000000  

Backtrace:

panic_abort (details=details@entry=0x3fc97434 <xIsrStack+1396> "***ERROR*** A stack overflow in task IDLE has been detected.") at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/panic.c:402
402         *((volatile int *) 0) = 0; // NOLINT(clang-analyzer-core.NullDereference) should be an invalid operation on targets
#0  panic_abort (details=details@entry=0x3fc97434 <xIsrStack+1396> "***ERROR*** A stack overflow in task IDLE has been detected.") at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/panic.c:402
#1  0x4038be68 in esp_system_abort (details=details@entry=0x3fc97434 <xIsrStack+1396> "***ERROR*** A stack overflow in task IDLE has been detected.") at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/esp_system.c:121
#2  0x4038e540 in vApplicationStackOverflowHook (xTask=<optimized out>, pcTaskName=<optimized out>) at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/freertos/port/riscv/port.c:380
#3  0x4038d732 in vTaskSwitchContext () at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/hal/esp32c3/include/hal/cpu_ll.h:43
#4  0x4038bee4 in isr_skip_decrement () at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/freertos/port/riscv/portasm.S:95
Backtrace stopped: frame did not save the PC
ELF file SHA256: 888ff4bb807f579e
lovyan03 commented 2 years ago

@imliubo I have looked into it, but so far I still don't know the cause.

MicroPython v1.18-1-g1760a2a on 2022-03-01; M5STACK C3 with ESP32C3
Type "help()" for more information.
>>> 
***ERROR*** A stack overflow in task IDLE has been detected.

From this part of the log, it seems that a stack overflow is occurring in the IDLE task after the initialization process is completed, but we need to find out how far the process has progressed in the program. Is there a log when MODULE_M5UNIFIED_ENABLED is disabled?

imliubo commented 2 years ago

@lovyan03

Here is the log when set MODULE_M5UNIFIED_ENABLED to 0.

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xe3c
load:0x403ce000,len:0x6f4
load:0x403d0000,len:0x28ec
entry 0x403ce000
I (258) cpu_start: Pro cpu up.
D (258) efuse: In EFUSE_BLK2__DATA4_REG is used 3 bits starting with 0 bit
D (258) efuse: In EFUSE_BLK2__DATA4_REG is used 8 bits starting with 12 bit
D (265) efuse: In EFUSE_BLK1__DATA3_REG is used 3 bits starting with 18 bit
D (272) efuse: In EFUSE_BLK1__DATA5_REG is used 5 bits starting with 5 bit
D (279) efuse: In EFUSE_BLK1__DATA4_REG is used 7 bits starting with 7 bit
D (285) efuse: In EFUSE_BLK1__DATA4_REG is used 7 bits starting with 14 bit
D (293) efuse: In EFUSE_BLK1__DATA4_REG is used 8 bits starting with 21 bit
D (300) efuse: In EFUSE_BLK1__DATA4_REG is used 3 bits starting with 29 bit
D (307) efuse: In EFUSE_BLK1__DATA5_REG is used 5 bits starting with 0 bit
D (321) clk: RTC_SLOW_CLK calibration value: 3853350
I (330) cpu_start: Pro cpu start user code
I (330) cpu_start: cpu freq: 160000000
I (330) cpu_start: Application information:
I (333) cpu_start: Compile time:     Mar  1 2022 15:08:26
I (339) cpu_start: ELF file SHA256:  7c7ed13651295993...
I (345) cpu_start: ESP-IDF:          v4.4-beta1-286-g014ee65f1f
D (351) memory_layout: Checking 4 reserved memory ranges:
D (357) memory_layout: Reserved memory range 0x3fc80000 - 0x3fc92e00
D (363) memory_layout: Reserved memory range 0x3fc92e00 - 0x3fc9d720
D (370) memory_layout: Reserved memory range 0x3fcdf060 - 0x3fce0000
D (376) memory_layout: Reserved memory range 0x50000000 - 0x50000830
D (383) memory_layout: Building list of available memory regions:
D (389) memory_layout: Available memory region 0x3fc9d720 - 0x3fca0000
D (395) memory_layout: Available memory region 0x3fca0000 - 0x3fcc0000
D (402) memory_layout: Available memory region 0x3fcc0000 - 0x3fcdf060
D (408) memory_layout: Available memory region 0x50000830 - 0x50002000
I (415) heap_init: Initializing. RAM available for dynamic allocation:
D (422) heap_init: New heap initialised at 0x3fc9d720
I (427) heap_init: At 3FC9D720 len 000228E0 (138 KiB): D/IRAM
I (434) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
D (441) heap_init: New heap initialised at 0x50000830
I (446) heap_init: At 50000830 len 000017D0 (5 KiB): RTCRAM
D (452) FLASH_HAL: extra_dummy: 0
D (456) spi_flash: trying chip: issi
D (459) spi_flash: trying chip: gd
D (463) spi_flash: trying chip: mxic
D (466) spi_flash: trying chip: winbond
D (470) spi_flash: trying chip: boya
D (474) spi_flash: trying chip: generic
I (478) spi_flash: detected chip: generic
I (482) spi_flash: flash io: dio
D (486) cpu_start: calling init function: 0x4210022e
0x4210022e: _GLOBAL__sub_I___cxa_get_globals_fast at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_globals.cc:145

D (491) cpu_start: calling init function: 0x420ffbac
0x420ffbac: _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:745
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/ext/concurrence.h:135
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:36
 (inlined by) _GLOBAL__sub_I__ZN10__cxxabiv111__terminateEPFvvE at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:125

D (496) cpu_start: calling init function: 0x420ffaac
0x420ffaac: _GLOBAL__sub_I__ZN9__gnu_cxx9__freeresEv at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:348

D (501) cpu_start: calling init function: 0x420ff90c
0x420ff90c: _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:745
 (inlined by) __gnu_cxx::__mutex::__mutex() at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imc/ilp32/libstdc++-v3/include/ext/concurrence.h:135
 (inlined by) __static_initialization_and_destruction_0 at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:33
 (inlined by) _GLOBAL__sub_I__ZSt7nothrow at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/libstdc++-v3/libsupc++/new_handler.cc:71

D (506) cpu_start: calling init function: 0x42087870
0x42087870: esp_reset_reason_get_hint at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/port/soc/esp32c3/reset_reason.c:107
 (inlined by) esp_reset_reason_init at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_system/port/soc/esp32c3/reset_reason.c:68

D (511) cpu_start: calling init function: 0x420807fc
0x420807fc: adc2_init_code_calibration at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/driver/esp32c3/adc2_init_cal.c:24

D (516) efuse: In EFUSE_BLK2__DATA4_REG is used 3 bits starting with 0 bit
D (523) efuse: In EFUSE_BLK2__DATA5_REG is used 10 bits starting with 18 bit
D (530) cpu_start: calling init function: 0x42049782
0x42049782: cpp::bitwizeshift::detail::result_union<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t, true>::result_union<>(cpp::bitwizeshift::in_place_t) at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:3837
 (inlined by) cpp::bitwizeshift::detail::result_construct_base<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t>::result_construct_base<>(cpp::bitwizeshift::in_place_t) at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:3954
 (inlined by) cpp::bitwizeshift::result<lgfx::v1::i2c::i2c_context_t::state_t, lgfx::v1::error_t>::result<lgfx::v1::i2c::i2c_context_t::state_t, void>() at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/../esp32/../../../utility/result.hpp:4292
 (inlined by) lgfx::v1::i2c::i2c_context_t::i2c_context_t() at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:487
 (inlined by) __static_initialization_and_destruction_0 at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:560
 (inlined by) _GLOBAL__sub_I__ZN4lgfx2v115getApbFrequencyEv at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5GFX/src/lgfx/v1/platforms/esp32/common.cpp:1090

D (535) cpu_start: calling init function: 0x42027a96
0x42027a96: _GLOBAL__sub_I_M5 at /home/imliubo/CodingBug/m5stack/uiflow_micropython/m5stack/build-M5STACK_C3/../libs/m5unified/M5Unified/src/M5Unified.cpp:669

D (541) cpu_start: calling init function: 0x42003fbc
0x42003fbc: s_set_default_wifi_log_level at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/esp_wifi/src/wifi_init.c:70

D (546) cpu_start: calling init function: 0x4200002a
0x4200002a: esp_ota_get_app_elf_sha256 at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/app_update/esp_app_desc.c:82
 (inlined by) esp_ota_init_app_elf_sha256 at /home/imliubo/CodingBug/espressif/esp-idf-uiflow-v4.4/components/app_update/esp_app_desc.c:69

D (551) intr_alloc: Connected src 39 to int 2 (cpu 0)
I (556) sleep: Configure to isolate all GPIO pins in sleep state
I (563) sleep: Enable automatic switching of GPIO sleep configuration
I (581) coexist: coexist rom version 9387209
D (581) intr_alloc: Connected src 50 to int 3 (cpu 0)
I (581) cpu_start: Starting scheduler.
D (585) intr_alloc: Connected src 37 to int 4 (cpu 0)
D (585) heap_init: New heap initialised at 0x3fcc0000
D (585) intr_alloc: Connected src 33 to int 7 (cpu 0)
D (595) partition: Loading the partition table
D (595) partition: Partition table MD5 verified
D (605) intr_alloc: Connected src 21 to int 9 (cpu 0)
D (605) intr_alloc: Connected src 16 to int 10 (cpu 0)
MicroPython v1.18-1-g1760a2a-dirty on 2022-03-01; M5STACK C3 with ESP32C3
Type "help()" for more information.
>>> 
imliubo commented 2 years ago

By the way, i add riscv port to libffi, libffi riscv src libffi riscv include

It took from here: libffi

Generate riscv header files commands:

./autogen.sh
./configure -host=riscv
lovyan03 commented 2 years ago

If it boots successfully, does _boot.py run and output the uiflow logo text?

imliubo commented 2 years ago

Yes, uiflow log text it will print, need change this line:

set(MICROPY_FROZEN_MANIFEST ${CMAKE_SOURCE_DIR}/boards/manifest.py)

log:

D (614) intr_alloc: Connected src 21 to int 9 (cpu 0)
D (614) intr_alloc: Connected src 16 to int 10 (cpu 0)

       _  __ _               
 _   _(_)/ _| | _____      __
| | | | | |_| |/ _ \ \ /\ / /
| |_| | |  _| | (_) \ V  V / 
 \__,_|_|_| |_|\___/ \_/\_/  

MicroPython v1.18-1-g1760a2a-dirty on 2022-03-01; M5STACK C3 with ESP32C3
Type "help()" for more information.
>>> 
***ERROR*** A stack overflow in task IDLE has been detected.
lovyan03 commented 2 years ago

According to menuconfig, the initial value of the stack size for IDLE tasks was 1536 bytes. I found that setting this to 2048 prevented the error.

Probably the global instance of M5Unified uses the stack of the IDLE task.

imliubo commented 2 years ago

You are right.

It seems esp32c3 is different with esp32.Use default size it works well with esp32.I think it should be because the architecture is different, and the low level implementation is different.

CONFIG_FREERTOS_IDLE_TASK_STACKSIZE

imliubo commented 2 years ago

Fix at 1760a2a.

Thanks @lovyan03 Close.