简体   繁体   中英

ARM-gcc stack usage files empty

I'm trying to analyze stack usage of my embedded program using arm-gcc toolchain. The program is single threaded so I normally can analyze the stack using the -fstack-usage gcc's parameter.

Normally this option generates .su files along with the compilation units. Those describe the stack usage per function. However in my case, those files are empty.

Here is an example of .su file content (from https://mcuoneclipse.com/2015/08/21/gnu-static-stack-usage-analysis/ ):

main.c:36:6:bar    48    static
main.c:41:5:foo    88    static
main.c:47:5:main    8    static

I'm using gcc-arm-none-eabi-5_4-2016q3 but the issue is also present on gcc-arm-none-eabi-5_3-2016q1 .

Do you have an idea of the issue ? Or another solution to control the stack usage ?

After a lot of tests I found a solution: -fstack-usage seems to be incompatible with -flto .

Disabling -flto allows to generate the .su files.

I don't really know the reason as I figured it out by enabling/disabling flags one by one. Also, by removing -flto , the linker fails but the stack usages are computed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM