Skip to content

No size summary when the link fails on a memory-region overflow #1658

Closed

Description

@stevenmunn312-tech

Summary

When firmware is too big for a memory region, ld fails, no .elf is produced,
and fbuild never reaches the step that prints Flash: / RAM:. The build log
shows only the linker error. The user gets "build failed" with no total and no
percentage, at the moment they most need to know how far over they are.

#1409 (fixed in 2.5.28) covers the other case: an image that links but exceeds
the board limits now fails with PlatformIO's checkprogsize wording. A hard
link failure still produces no summary.

Reproduction

A deliberate DRAM overflow on an ESP32-S3: 400 KB of .bss on a 320 KB part,
in a project with no libraries. Windows 11; seen on 2.5.21, 2.5.22 and 2.5.26.
We found no change in this area through 2.5.37.

Board: Espressif ESP32-S3-DevKitC-1-N8 / ESP32S3 @ 240MHz
Memory: 16.00MB Flash, 320.00KB RAM
Compiled 1/1 files
build error: build failed: ESP32 link failed:
ld.exe: firmware.elf section `.dram0.bss' will not fit in region `dram0_0_seg'
ld.exe: DRAM segment data does not fit.
ld.exe: region `dram0_0_seg' overflowed by 136760 bytes
collect2.exe: error: ld returned 1 exit status

There is no Flash: or RAM: line anywhere in the log.

Workaround we ship

Design Studio for FastLED parses the two lines that are always present: the
overflowed by N bytes amount for each region, and fbuild's up-front Memory:
budget. Region names containing ram count as RAM, and everything else as
flash. For the log above that gives "RAM: 464,440 of 327,680 bytes (142%)". It
works, but it depends on the wording of ld and of fbuild's banner, and the
board budget is only an approximation of the region that overflowed. On a
classic ESP32, dram0_0_seg is about 122 KB of a 320 KB part.

Suggestion

On a link failure, print a summary in the same shape as a successful build. For
each region ld reports, give the region name, its size and the overflow, for
example:

RAM:   dram0_0_seg overflowed by 136,760 bytes (region <length> bytes)

Two ways to get there:

Happy to test a build on our Windows bench.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions