• AVR Freaks

xc32 static stack analyzer

New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2020/03/19 05:54:29
  • Location: 0
  • Status: offline
2020/03/26 01:39:20 (permalink)
5 (2)

xc32 static stack analyzer

Hello together!
I developed a static stack analyzer for Microchip's XC32 compiler, which can be found here:

Some background:
For an automotive project a pic32mz is used and the software for it is compiled with microchip's xc32. To comply with ASIL-B requirements from customer, we had to do a static memory analysis. Easy for flash and static RAM usage, as it is part of the map file. But what about the static stack usage?
After discussing this topic with Microchip directly, these were the results:
- XC32 is gcc based, but -fstack-usage is officially not supported and does not deliver reliable information. It is highly encouraged to NOT use this feature.
- XC32 does not have and will not have the possibility to report stack usage, neither on function basis nor on project basis.
- There is no additional Microchip tool or solution for measuring the stack usage statically.
- There is no 3rd party tool, which performs static code analysis for MIPS in general and xc32 in particular.
- If you want to know the stack usage of your program, you should measure it during runtime, i.e. with a high water mark (quoted microchip proposal) (Why this is a bad idea is a different discussion)
The topic came back onto my desk, and as I was not satisfied with Microchips information and proposals, I created my own tool for determining the stack usage, statically of course.
This tool should work for all MIPS gcc, but it is written especially for xc32. First feedback seems to show, that is might also work for C32.
Try it out, give it a shot! Bug tracking on GitHub, if you find any.
Kind Regards,
Florian Kaup
Sentinel Software GmbH

0 Replies Related Threads

    Jump to:
    © 2020 APG vNext Commercial Version 4.5