ec icon indicating copy to clipboard operation
ec copied to clipboard

Internal RAM exhausted

Open crawfxrd opened this issue 1 year ago • 1 comments

Attempting to build branch usbc-mux-info for bonw15 results in:

  LINK      ec.ihx
?ASlink-Error-Could not get 11 consecutive bytes in internal RAM for area OSEG.
?ASlink-Error-Could not get 5 consecutive bytes in internal RAM for area OSEG.
make: *** [src/arch/8051/toolchain.mk:42: build/ec.ihx] Error 1

crawfxrd avatar Jul 19 '24 22:07 crawfxrd

Need to look at the memory map, but:

We already use large for the main app (which is suppose to put variables in XRAM to begin with), so a potential resolution may be to declare and use variables at fixed addressed (Ref: #36):

  • declare loop indexes in idata and only use those?
    • ensure we only have ~4 total
    • not sure how SDCC manages these; might already try something like this?
  • explicitly move data to xdata?
    • not sure how this works with scratch ROM usage and registers

Some other thoughts:

  • Check if SDCC 4.4.0 (#418) alleviates the issue, since it has generalized constant propagation
    • Reduces code size by ~600 bytes without any changes, but does not appear to affect RAM allocation
  • Replace bools with bits?
  • (re)declare functions with __reentrant so variables are placed on the stack rather than be statically assigned?
  • move logic (complexity) to system firmware (system76/firmware-open#571)

crawfxrd avatar Jul 20 '24 03:07 crawfxrd