Forum: µC & Digital Electronics xc32 static stack analyzer

von Little B. (lil-b)

Rate this post
0 useful
not useful
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?

Fact is, that microchip does not have a tool for it, and if you ask 
them, they tell you that you should measure the stack usage dynamically 
during runtime. Thats not an option for an automotive project, of 

After weeks of discussion, internally and with microchip, I got the task 
to find a solution. You can find my solution in the link above, which I 
was allowed to publish under GPLv3 by my contractor.

And to all those smart people out there, who are saying "But xc32 is 
gcc-based, so why are you not using -fstack-usage?"
The answer of Microchip: This feature is officially not supported by 
xc32 and you should not use it.

This, and the fact, that there is no 3rd party tool, which does a static 
code analysis for microchip or mips controller in general, made me 
publish this program for the community.

Bug tracking on github, but there will be no additional major features.

Florian Kaup
Sentinel Software GmbH


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.