Skip to content

Help Needed - Optimization of code #859

Closed
@neo2043

Description

@neo2043

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions