Skip to content

Help Needed - Optimization of code #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neo2043 opened this issue May 7, 2025 · 1 comment
Closed

Help Needed - Optimization of code #859

neo2043 opened this issue May 7, 2025 · 1 comment

Comments

@neo2043
Copy link

neo2043 commented May 7, 2025

so after much difficulties i compiled the repo kazii/espcam_rs but as the moment came to flash an error popped, it said that the size of binary created was more than the space present

[2025-05-07T19:47:42Z INFO ] Serial port: '/dev/ttyUSB0'
[2025-05-07T19:47:42Z INFO ] Connecting...
[2025-05-07T19:47:43Z INFO ] Using flash stub
    Finished `dev` profile [optimized + debuginfo] target(s) in 0.18s
Chip type:         esp32 (revision v3.1)
Crystal frequency: 40 MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       a0:b7:65:59:00:d4
Bootloader:        /home/auto/Desktop/git/esp32cam_rs/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-5d2fa2e2d77507c0/out/build/bootloader/bootloader.bin
Partition table:   /home/auto/Desktop/git/esp32cam_rs/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-5d2fa2e2d77507c0/out/build/partition_table/partition-table.bin
Error: espflash::image_too_big (https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#built-in-partition-tables)

  × Supplied ELF image of 1281568B is too big, and doesn't fit configured app partition of 1048576B
  help: Reduce the size of the binary or increase the size of the app partition.

now i went to the url mentioned and increased the size of factory partition to 3M and it worked, but i think this short term solution as the space is always gonna be limited in embedded systems and i cant just throw memory at these problems. so the help i need is with decreasing the size of binary. i have some ideas like we do -O3 in c or disabling some checks. (i have tried --release it works but not that much).

@SergioGasquez
Copy link
Member

Hi! Id suggest asking this questions in the matrix channel as they are not really espflash issues. That being said, increasing the size of the partition might be enough for your project, here is a list of other things that might help with binary size: https://github.com/esp-rs/book/blob/esp-hal%401/src/frequently-asked-questions.md#optimizing-binary-size. Its part of the FAQ section of the book that we are currently updating.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants