How to fix program size issue when i didn't over flash size?

Hi guys.

I’m so stuck of this issue.

Please see Fig1. ( ouch! new user couldn’t attached img more than twice… damm it)

image
Fig1. project inspection memory.

I dig to solve this problem. there is some article said modify to JSON file, but i could’t find any JSON file on project directory.

2nd i’m try to chaned platformio.ini file such as Fig3. but it’s also didn’t works.

is there anybody help on this problem ?

please pull me on this hell…

Hi @christopherlee, not 100% sure what your concern is here. Does your program use too much RAM?
Your flash size seems to bee looking fine. Note that using the Inspect tool, Platformio will lauch a Debug build which by default uses more space than a Release build, because compiler optimization is turned down. To get to the same size as your normal release build, add this to your platformio.ini:

debug_build_flags = -Os # optimize for size

But this won’t help bringing your RAM usage down. To fix that, see if you use call-by-value a lot (because this will always copy the objects temporarily) that you could exchange to by-ref handovers. Also look at your object’s lifetimes. Do they exist longer than they need to? Do you use many static variables? Note that those will exist forever :wink:

Hope this helps :slight_smile:

1 Like

Hi @schallbert, thanks for kindly help to my problem.

I did the optimize option as -OS but nothing change.

inspection memory said, RAM size is most of full.
but build log is not same as that picture.
it said below

Checking size .pio\build\esp-wrover-kit\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
Error: The program size (1517190 bytes) is greater than maximum allowed (1310720 bytes)
RAM: [== ] 18.1% (used 59404 bytes from 327680 bytes)
*** [checkprogsize] Explicit exit, status 1
Flash: [==========] 115.8% (used 1517190 bytes from 1310720 bytes)

Actually, I’m using 4MB memory version of module, but it’s not looks over than 4MB.

and I think your mention is really help to me.

I integrated few example of Arduino users… it didn’t optimized well…

but i think most high priority to check is build option… because i didn’t use even over 2MB memory…

I have no idea to use extended…

I changed below option to write data to Module

board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
board_build.partitions = default_8MB.csv

it can program, but module is reset infinite… I’m confuse…

anyway, thanks to focus my problem!! i’m really thank to you!!

The “Inspect” tool will build your code in debug mode with no optimizations, to get you a rough estimate of the codesize. See Inspect Memory: is it possible with a release build? - #3 by valeros. This topic has also info on how to analyze a release-optimized binary.

As for the 1.5MB of available flash size: That’s the size of the partition dedicated to the application per the partition file and is never the full flash size. Also nut if you change it with maximum_size – it’s always read from the partition file. See docs.

2 Likes

Hi @maxgerhardt

Thank you for your advice!! it works to me!

you mentioned the partition information, I changed partition table and it’s works!! thank you so much!!

have a nice day!!!