prusa3d / Prusa-Firmware-MMU

Other
32 stars 15 forks source link

:construction: Extra debug space / debug trampoline #302

Closed wavexx closed 6 months ago

wavexx commented 1 year ago

Based on an old PR that was closed automatically and kept as an idea, although I can't copy the whole conversation with @leptun

Instead of using TEXT_REGION_LENGTH define a custom script to enforce the available space for the .text section. The script also defines a custom .boot section at the appropriate location.

This section can be abused in debug builds to take advantage of the extra space. To do so, the optional function "boot" is placed at the beginning of the section and jumps back to zero, allowing code to continue unaffected.

In turn, this allows to move the motion speed tables into the boot section, freeing about 2k of space necessary for the debug builds to work.

Perhaps not ideal as we manually need to tag functions/data, but seems to be the only option for avr-ld.

wavexx commented 6 months ago

Closing since this would need some massaging to apply again. It was kept only for the basic idea during development