Skip to content

cmake: targets: Allow adding additional arguments to puncover - #115155

Open
paulwuertz wants to merge 1 commit into
zephyrproject-rtos:mainfrom
paulwuertz:opt_args_cmake_puncover
Open

cmake: targets: Allow adding additional arguments to puncover#115155
paulwuertz wants to merge 1 commit into
zephyrproject-rtos:mainfrom
paulwuertz:opt_args_cmake_puncover

Conversation

@paulwuertz

@paulwuertz paulwuertz commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This allows to use puncover i.e. non-interactively generating a JSON reports of given list of functions with an associated max stack sizes and adds flexibility to add any other options.

Relates to #112163

Signed-off-by: Paul Würtz paulwuertz@posteo.de

@zephyrbot

Copy link
Copy Markdown

@greg-fer @Flameeyes @HesselM

You have been identified as a likely reviewer for the code this pull request changes, but could not be added to its review request automatically. Please review it if you are able to.

@paulwuertz

paulwuertz commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

In the documentation I was thinking if to add, that stack usage in puncover is limited to ARM architecture and to some extend to RISC-V (I find it not working for some applications HBehrens/puncover#151).

I opened an proposal to consume the .ci files generated by CONFIG_CALLGRAPH_INFO - with that I hope the basic stack estimation could work on all architectures.

There is also an open PR with the interesting option to add a file with a list of dynamic / indirect calls, so the stack use estimation views more of the real call tree and yields better results, this would be another option to provide potentially soon :)

@paulwuertz paulwuertz changed the title Allow adding additional arguments to puncover using PUNCOVER_ADDITIONAL_OPTS Allow adding additional arguments to puncover Aug 1, 2026
@paulwuertz
paulwuertz force-pushed the opt_args_cmake_puncover branch from d024f2d to c22f7ea Compare August 1, 2026 22:49
@paulwuertz paulwuertz changed the title Allow adding additional arguments to puncover cmake: targets: Allow adding additional arguments to puncover Aug 1, 2026
@paulwuertz
paulwuertz force-pushed the opt_args_cmake_puncover branch 3 times, most recently from d355e12 to e713dc2 Compare August 2, 2026 18:59
This allows i.e. non-interactive use and generating JSON reports of given
list of functions with an associated max stack sizes and flexibility to
add any other options.

Relates to zephyrproject-rtos#112163

Signed-off-by: Paul Würtz <paulwuertz@posteo.de>
@paulwuertz

paulwuertz commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Sleeping a night over it I am undecided, weather adding to the tools docs example of a config file, or if this should better go as a ref to the puncover repo and there should be some more documentation :? - added it here for feedback :)

Metioned also in the RFC - here is a puncover config with this MR aiming to print some feedback during/after building about stack usage:

elf_file: ~/zephyrproject/zephyr/samples/net/mqtt_publisher/build/zephyr/zephyr.elf
gcc-tools-base: ~/zephyr-sdk-1.0.1/gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-
src_root: ~/zephyrproject/zephyr
build_dir: ~/zephyrproject/zephyr/samples/net/mqtt_publisher/build
generate-report: true
non-interactive: true
report-type: json 
print-stack-size-report: true
report-max-static-stack-usage: 
  log_process_thread_func:::832
  - shell_thread:::4160
  - bg_thread_main:::2112
  - work_queue_main:::1088
  - mgmt_event_work_handler:::896

then exporting a detailed report as a JSON for all symbols and printing an overview of stack usages of given threads:

┌─────────────────────────────────────────────────────────────────────────┐
│ log_process_thread_func   -  42.3% -   352/  832b - ████████------------│
│ shell_thread              -   7.3% -   304/ 4160b - █-------------------│
│ mgmt_event_work_handler   -  31.2% -   280/  896b - ██████--------------│
│ bg_thread_main            -  58.3% -  1232/ 2112b - ███████████---------│
│ work_queue_main           -  25.0% -   272/ 1088b - █████---------------│
└─────────────────────────────────────────────────────────────────────────┘

So enabling some use in CIs for continous feedback and help hint memory changes in reviews :)

@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants