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

"Insufficient flash" error message doesn't always seem to work #439

Open
steveklabnik opened this issue Feb 24, 2022 · 2 comments
Open

"Insufficient flash" error message doesn't always seem to work #439

steveklabnik opened this issue Feb 24, 2022 · 2 comments
Milestone

Comments

@steveklabnik
Copy link
Contributor

steveklabnik commented Feb 24, 2022

While working on #438 I got a lot of linker errors when sizes were wrong. But when working on fixing up sidecar, I got:

Error: task-net has insufficient flash: specified 65536 bytes, needs 65620

I remembered we were working on this but forgot it was merged; when I got the linker errors I assumed it was still in a branch. But clearly it's working sometimes and not other times.

@steveklabnik
Copy link
Contributor Author

As an example, after fixing the app.toml to have the right amount for task-net, here's the next error I got:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "C:\\Users\\steve\\Documents\\Oxide\\hubris\\target\\thumbv7em-none-eabihf\\release\\deps\\task_udpecho-25fcf3909630cdca.task_udpecho.740dc942-cgu.0.rcgu.o" "--as-needed" "-L" "C:\\Users\\steve\\Documents\\Oxide\\hubris\\target\\thumbv7em-none-eabihf\\release\\deps" "-L" "C:\\Users\\steve\\Documents\\Oxide\\hubris\\target\\release\\deps" "-L" "target" "-L" "C:\\Users\\steve\\.rustup\\toolchains\\nightly-2022-02-22-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib" "--start-group" "--end-group" "-Bstatic" "C:\\Users\\steve\\.rustup\\toolchains\\nightly-2022-02-22-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib\\libcompiler_builtins-e8b9a93ab984480c.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "C:\\Users\\steve\\.rustup\\toolchains\\nightly-2022-02-22-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib" "-o" "C:\\Users\\steve\\Documents\\Oxide\\hubris\\target\\thumbv7em-none-eabihf\\release\\deps\\task_udpecho-25fcf3909630cdca" "--gc-sections" "-Tlink.x" "-z" "common-page-size=0x20" "-z" "max-page-size=0x20"
  = note: rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 57 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 76 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 92 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 118 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 136 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 152 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 168 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 184 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 200 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 216 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 232 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 275 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 292 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 292 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 336 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 364 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 380 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 388 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 412 bytes
          rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 412 bytes
          rust-lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

mkeeter added a commit that referenced this issue Jun 10, 2022
This PR implements task autosizing, at long last!

It builds on the previous work with relocatable task builds (#584). After
building the relocatable task ELF file, it runs a "dummy link" against a
linker script with "infinite" memory (in practice, the entirety of memory
available on the chip). It then parses the resulting (static) binary to extract
sizes.

After finding sizes for every task, it runs the same memory packer as before,
then relinks each task with the resulting memory.

Task sizes are based on the target microcontroller, with a new `alignment`
parameter passed to `allocate_one`.

There are extensive changes to `cargo xtask sizes` to make it more generically
useful, decoupling the suggestions from the "find the size of a static ELF".

WARNING: this changes the format of the exported JSON files!

In addition, there are a bunch of new helper functions in `Config` to help with
task and memory sizing / alignment.

This fixes #474 and maybe #439, and deprecates #476
@cbiffle
Copy link
Collaborator

cbiffle commented Apr 27, 2023

Can definitely confirm that this still doesn't always work.

@cbiffle cbiffle added this to the Unscheduled milestone Apr 27, 2023
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

2 participants