Hi.
I am using vs-code > platformio to program “wemos_D1_mini32”
I used >Advanced>Debug for my program because the MCU resets sometimes and I wanted to find out why.
Debugging obviously generates a bigger .elf file and I actually don’t know how to use that function correctly. So I returned to use “build” (and “debug” by using “serial.println”) but now the elf file is always too big, as though the debug command is still in effect.
Shouldn’t “build” simply work without adding debug information to the code?
I am lost at the moment.
Probably I need to provide more information for you people to help me through this, but i need to be told what to show you.
My platformio.ini looks like this:
During a debug build, the -Os (minimal size) optimization is exchanged for -Og (optimize for debugging) level, which severely increases the size of the firmware and slows it down, but gives better debug info.
If you don’t like this, use the debug_build_flags as documented, e.g. by keeping the same optimization level as in a release build, but with added debug information. Preparea to see a lot of “this variable is optimized out” and jumps from one line to another thanks to the optimizer though.
debug_build_flags = -Os -ggdb3 -g3
Depending on your firmware, levels -O2 or -O1 may also be acceptable.
Hi Max,
I read about this in the documentation, but here starts my (currently) total inability to cope with the IDE. (I am dumbfounded by multiple possibilities to influence the behavior)
I added to the file platformio.ini the following:
[env:debug]
debug_build_flags = -Os -ggdb3 -g3
This is what comes back
(Still the firmware is too big and the entry seems not to be correct)
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
Error: The program size (1440021 bytes) is greater than maximum allowed (1310720 bytes)
RAM: [== ] 16.2% (used 53052 bytes from 327680 bytes)
Flash: [===*** [checkprogsize] Explicit exit, status 1
=======] 109.9% (used 1440021 bytes from 1310720 bytes)
======================================== [FAILED] Took 74.83 seconds ========================================
Processing debug ()
--------------------------------------------------------------------------------------------------------------
Error: Please specify platform for 'debug' environment
then I changed platformio.ini to look like this, no better result
Checking size .pio/build/wemos_d1_mini32/firmware.elf
Error: The program size (1440041 bytes) is greater than maximum allowed (1310720 bytes)
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
*** [checkprogsize] Explicit exit, status 1
RAM: [== ] 16.2% (used 53052 bytes from 327680 bytes)
Flash: [==========] 109.9% (used 1440041 bytes from 1310720 bytes)
so only the
board_build.partitions = huge_app.csv
is useful.
Anyway this leads to another question:
If I want to debug my code using inline debugging, this would be impossible that way
because of the high memory usage.
(I also use ports which would be necessary for JTAG)
What would you recommend how to handle this situation if I NEED to debug the code
inline?
(I still experience resets due to kernel exceptions -Core 1 panic’ed-)
Code running:
Core 0 task (read data from sensors into proprietary variables, locked by semaphores, controlled by Core1 Timer interrupt)
Core 1 Timer Interrupt (Copy Data from proprietary variables to display buffer every ~5 seconds, open semaphores to read ThRH ore Time)
Core 1 Loop() Scan display buffer to four 7 Segment Digits