Skip to content
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

.bss section is loaded from FLASH #11

Open
martin2250 opened this issue Feb 8, 2025 · 0 comments
Open

.bss section is loaded from FLASH #11

martin2250 opened this issue Feb 8, 2025 · 0 comments

Comments

@martin2250
Copy link

My recent project is filling up the flash and I got this error message, which made the compilation fail

= note: rust-lld: error: section '.bss' will not fit in region 'FLASH': overflowed by 1284 bytes

That got me wondering, usually the .bss section is initialized with zeroes so there is no need to put it into flash. Here is the offending entry in the generated link.x from qingke-rt:

    .bss : ALIGN(4)
    {
        PROVIDE( _sbss = .);
        *(.sbss .sbss.* .bss .bss.*);
        PROVIDE( _ebss = .);
    } >RAM AT>FLASH

Instead, I'd expect something more along the lines of this (generated by cortex-m-rt:

  /* ### .bss */
  .bss (NOLOAD) : ALIGN(4)
  {
    . = ALIGN(4);
    __sbss = .;
    *(.bss .bss.*);
    *(COMMON); /* Uninitialized C statics */
    . = ALIGN(4); /* 4-byte align the end (VMA) of this section */
  } > RAM

Depending on the size of .bss, the binary size could be reduced significantly by switching to a similar linker script.

Is there a reasoning behind the decision to load .bss from flash or was a proper zeroing routine simply not yet implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant