Wed 11 Mar 2015 07:37:20 PM UTC, original submission:
Libraries are being built with a wrong option -mtiny-stack:
devtools/gen-avr-lib-tree.sh:49
To query avr-gcc for it's multilib layout, use -print-multi-lib:
For each line: Left of ';' stands the multilib subdir, right of ';' are the option(s) to select that multilib subdir (replace '@' with ' -' to get the option(s)).
Notice that -mtiny-stack is not an avr-gcc multilib option! The correct option is -msp8.
In order to query for the multilib subdir for a specific set of command options, use
Example:
'-Os' is ignored (no multilib option)
'-mmcu=avr2' is the default multilib, hence will yield '.'.
'-msp8' selects the tiny-stack subdir for avr2 and the result is './tiny-stack' i.e. 'tiny-stack'.
Also notice that apart from their multilib properties, -msp8 and -mtiny-stack are working differently:
- -msp8 asserts that the stack pointer (SP) is 8 bits wide physically. avr-gcc will set -msp8 as needed except for the cases -mmcu=avr2 and -mmcu=avr25. These are the only core architectures which intermix devices with 16-bit wide and 8-bit wide SP. Or, to put it more precisely: avr-gcc uses -msp8 to decomposes these to sets of devices into 4 core architectures.
- -mtiny-stack is an optimization option: Only the lower 8 bits of SP will be changed, no matter how SP is layed out physically. This applies to all devices and archirectures.
|