Open jeanboutros opened 5 months ago
Hello and thank you for reporting the issue!
I have heard from Espressif systems that the NMEA structure has a very big memory footprint. It is very possible that just instantiating this structure takes all of your stack.
Could you please try and use the parse function instead of creating the NMEA structure?
Also you can check the size of the structure by using https://doc.rust-lang.org/core/mem/fn.size_of.html
You can also use the cargo size
to gain a bit more information about how much space you will have left on the device RAM.
steps to reproduce:
1- Create the project with
cargo generate esp-rs/esp-idf-template cargo
2- Follow the instructions and select esp32 architecture 3- Add the following code the main.rs:4- Flash the code using
cargo run
The error dump
I (31) boot: ESP-IDF v5.1-beta1-378-gea5e0ff298-dirt 2nd stage bootloader I (31) boot: compile time Jun 7 2023 07:48:23 I (33) boot: Multicore bootloader I (37) boot: chip revision: v3.1 I (41) boot.esp32: SPI Speed : 40MHz I (46) boot.esp32: SPI Mode : DIO I (50) boot.esp32: SPI Flash Size : 4MB I (55) boot: Enabling RNG early entropy source... I (60) boot: Partition Table: I (64) boot: ## Label Usage Type ST Offset Length I (71) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (79) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (86) boot: 2 factory factory app 00 00 00010000 003f0000 I (94) boot: End of partition table I (98) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1dec8h (122568) map I (151) esp_image: segment 1: paddr=0002def0 vaddr=3ffb0000 size=0200ch ( 8204) load I (154) esp_image: segment 2: paddr=0002ff04 vaddr=40080000 size=00114h ( 276) load I (157) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=46230h (287280) map I (269) esp_image: segment 4: paddr=00076258 vaddr=40080114 size=0b2a8h ( 45736) load I (293) boot: Loaded app from partition at offset 0x10000 I (294) boot: Disabling RNG early entropy source... I (305) cpu_start: Multicore app I (305) cpu_start: Pro cpu up. I (305) cpu_start: Starting app cpu, entry point is 0x40081914 0x40081914 - call_start_cpu1 at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/esp_system/port/cpu_start.c:159 I (293) cpu_start: App cpu up. I (323) cpu_start: Pro cpu start user code I (324) cpu_start: cpu freq: 160000000 Hz I (324) cpu_start: Application information: I (328) cpu_start: Project name: libespidf I (333) cpu_start: App version: 1 I (338) cpu_start: Compile time: Mar 25 2024 21:45:10 I (344) cpu_start: ELF file SHA256: 0000000000000000... I (350) cpu_start: ESP-IDF: v5.1.3 I (355) cpu_start: Min chip rev: v0.0 I (359) cpu_start: Max chip rev: v3.99 I (364) cpu_start: Chip rev: v3.1 I (369) heap_init: Initializing. RAM available for dynamic allocation: I (376) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (382) heap_init: At 3FFB2900 len 0002D700 (181 KiB): DRAM I (389) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (395) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (401) heap_init: At 4008B3BC len 00014C44 (83 KiB): IRAM I (409) spi_flash: detected chip: generic I (412) spi_flash: flash io: dio W (416) timer_group: legacy driver is deprecated, please migrate to
driver/gptimer.h` I (425) app_start: Starting scheduler on CPU0 I (430) app_start: Starting scheduler on CPU1 I (430) main_task: Started on CPU0 I (440) main_task: Calling app_main() Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.Core 0 register dump: PC : 0x40089059 PS : 0x00060233 A0 : 0x800893a4 A1 : 0x3ffb28b0
0x40089059 - tlsf_block_size_max at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/tlsf/tlsf.c:841 0x3ffb28b0 - s_mmu_ctx at ??:?? A2 : 0x00000004 A3 : 0x00060220 A4 : 0x00000000 A5 : 0x00060223
A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x800873d1 A9 : 0x3ffb2880
0x3ffb2880 - s_mmuctx at ??:?? A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x3ffb5be8
A14 : 0x00000084 A15 : 0x400d6670 SAR : 0x0000001f EXCCAUSE: 0x0000001c
0x400d6670 - heapless::vec::Vec<T,>::as_mut_slice at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/heapless-0.7.17/src/vec.rs:178 EXCVADDR: 0x00000014 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x40089056:0x3ffb28b0 0x400893a1:0x3ffb28d0 0x40088f85:0x3ffb28f0 0x400827ce:0x3ffb2910 0x400827e1:0x3ffb2940 0x4008280d:0x3ffb2960 0x4008a221:0x3ffb2980 0x400e7c60:0x3ffb29a0 0x400e7bb8:0x3ffb29c0 0x400d4a26:0x3ffb29e0 0x400feeef:0x3ffb2a00 0x400fef04:0x3ffb2a20 0x400febf7:0x3ffb2a40 0x400fe9d7:0x3ffb2a60 0x400dd3f8:0x3ffb2aa0 0x400d6391:0x3ffb2ac0 0x400d4cd9:0x3ffb2b00 0x400d651c:0x3ffb2bb0 0x400d63e4:0x3ffb2c40 0x400d4992:0x3ffb2c60 0x40114ee7:0x3ffb5c80 0x400d4a04:0x3ffb5ca0 0x400dccee:0x3ffb5cc0 0x400d49f4:0x3ffb5cf0 0x400d49a7:0x3ffb5d20 0x400d641b:0x3ffb5d40 0x40115b27:0x3ffb5d60 0x40089056 - tlsf_block_size_max at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/tlsf/tlsf.c:835 0x3ffb28b0 - s_mmu_ctx at ??:?? 0x400893a1 - adjust_request_size at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/tlsf/tlsf.c:250 0x3ffb28d0 - s_mmu_ctx at ??:?? 0x40088f85 - multi_heap_malloc_impl at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/multi_heap.c:207 0x3ffb28f0 - _GLOBALN_1::emergency_pool at ??:?? 0x400827ce - heap_caps_malloc_base at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/heap_caps.c:176 0x400827e1 - heap_caps_malloc at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/heap_caps.c:197 0x4008280d - heap_caps_malloc_default at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/heap/heap_caps.c:223 0x4008a221 - malloc at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/newlib/heap.c:24 0x400e7c60 - std::sys::unix::alloc::::alloc
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/sys/unix/alloc.rs:14
0x400e7bb8 - __rdl_alloc
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/alloc.rs:394
0x400d4a26 - rust_alloc
at ??:??
0x400feeef - alloc::alloc::Global::alloc_impl
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/alloc.rs:181
0x400fef04 - ::allocate
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/alloc.rs:241
0x400febf7 - alloc::raw_vec::RawVec<T,A>::allocate_in
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:199
0x400fe9d7 - alloc::raw_vec::RawVec<T,A>::with_capacity_in
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:145
0x400dd3f8 - alloc::ffi::c_str::CString::new
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc/src/ffi/c_str.rs:316
0x400d6391 - esp_idf_svc::private::cstr::to_cstring_arg
at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-svc-0.48.1/src/private/cstr.rs:90
0x400d4cd9 - esp_idf_svc::log::EspLogger::should_log
at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-svc-0.48.1/src/log.rs:203
0x400d651c - log::private_api::log_impl
at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/log-0.4.21/src/private_api.rs:61
0x400d63e4 - log::__private_api::log
at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/log-0.4.21/src/__private_api.rs:73
0x400d4992 - test_nmea_crate2::main
at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/src/main.rs:14
0x40114ee7 - core::ops::function::FnOnce::call_once
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
0x400d4a04 - std::rt::lang_start::{{closure}}
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:166
0x400dccee - core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:284
0x400d49f4 - std::rt::lang_start
at /home/hu/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:165
0x400d49a7 - main
at ??:??
0x400d641b - app_main
at /home/hu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-sys-0.34.1/src/start.rs:46
0x40115b27 - main_task
at /home/hu/DataProjects/RustyESP32/test_nmea_crate2/test-nmea-crate2/.embuild/espressif/esp-idf/v5.1.3/components/freertos/app_startup.c:208
ELF file SHA256: 0000000000000000
Rebooting... ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:7104 load:0x40078000,len:15576 load:0x40080400,len:4 0x40080400 - _invalid_pc_placeholder at ??:?? ho 8 tail 4 room 4 load:0x40080404,len:3876 entry 0x4008064c `
Some more info
rustup -V rustup 1.27.0 (bbb9276d2 2024-03-08) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active
rustc
version isrustc 1.76.0-nightly (88269fa9e 2024-02-09) (1.76.0.1)
cargo -V cargo 1.76.0-nightly (c84b36747 2024-01-18)
rust-toolchain.toml