Am 17.04.20 um 20:06 schrieb Basil Hussain: > Hi all, > > I recently wrote a simple script to calculate the stack usage of code > written for the STM8 platform and compiled with SDCC. I thought I would > share it here as some may find it useful. > > https://github.com/basilhussain/stm8-stack-usage > > It's an Awk script that parses the .asm intermediate assembly files > generated by SDCC, and calculates the stack usage on a per-function > basis. It's fairly rudimentary, so each function is only analysed in > isolation, and no function call chain/graph is taken into account.
How about lifting that limitation? Of course in general, that will only work when there is no recursion. I suggest to use cflow to parse the C code to generate the call graph. You'd probably have to be a bit pessimistic (e.g. f might call g at two sites, and the two sites might be at different stack depth, since on of the two calls might have more registers in use, and thus more push / pop pairs around the actual call). Philipp _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user