AVR [patch] Reducing code footprint of runtime error handling
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
A trivial division example (see Steps to Reproduce below) compiles to a rather large 1734 bytes of code and 50 bytes of data.
The bulk of the code is associated with raising an exception in HandleErrorAddrFrame. Since the compiler doesn't yet support exception handling for AVR, this code was removed. Another tweak was to remove the EXITCODE feature since there is no parent process for avr-embedded (maybe even other embedded targets?) The last tweak was to skip the call to get_caller_stackinfo since the default implementation for avr doesn't return any information anyway.
Compiling the example with the patched rtl results in a code size of 344 bytes and 4 bytes data.
A patch with these tweaks are attached.
Steps to reproduce:
program divtest;
var
ans, x, d: word;
begin
x := 222;
d := 0;
ans := x div d;
end.
ppcrossavr -O3 -Wpatmega328p divtest.pp
Note that the rtl was also build with CROSSOPT="-O3", all other settings were left to default.
Mantis conversion info:
- Mantis ID: 35754
- Build: 42272
- Version: 3.3.1
- Monitored by: » @d.ioannidis (Dimitrios Chr. Ioannidis)