How to Dig into Firmware Code Size

Hi all,

Since this is the best documentation on how to use puncover, I’d like to add some corrections that were necessary to get things working (ran through the article yesterday).

  1. Please use upstream https://github.com/HBehrens/puncover version instead of the memfault fork (not clear why one should use the memfault version, other than tox support).
  2. To install, after checkout: python3 ./setup.py install --user . This will handle all of the requirements and install puncover to user controlled directory (/home/user/.local/bin/puncover over here, on Ubuntu). puncover should then be executable just by the program name (~/.local/bin/ should be already in your PATH). Using python2.7 will not work. Running setup like this replaces the Setting up for puncover section in the article.
  3. I’m not sure whether -fdebug-prefix-map is required anymore. Things seem to work here without it with build_dir option to puncover.
  4. Since the article came out, puncover learned to also collate the build time generated stack usage information. Add -fstack-usage option to your GCC runs to get the *.su files that puncover will collect.

I use the following command line for a project that is built in the source directory (yes I know it’s bad, but it’s just a sandbox for playing):
puncover --gcc_tools_base /home/user/local/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi- --elf_file ${PWD}/generic-test.elf --build_dir ${PWD}

Important bit here being that the expected format for the new gcc_tools_base is a prefix, not just a path (compared to the old arm_tools_dir). The paths to the puncover options also need to be absolute.

After this, you should have nice interactively navigatable view into stack, static SRAM and code space usage.

1 Like