zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.08k stars 6.2k forks source link

Add command line options to reporting tool #57569

Open adleris opened 1 year ago

adleris commented 1 year ago

Introduction

This proposal looks at adding command line options to customise the functionality of the footprint reporting tools.

Problem description

Currently, there are no customisation options when running west build -t rom_report/west build -t ram_report.

Proposed change

This proposal considers options to add the ability for the end user to tweak the output to their desires. My current ideas for the options are:

Detailed RFC

Proposed change (Detailed)

This change looks to leverage the structure of cmake/reports/CMakeLists.txt and scripts/footprint/size_report to introduce the new features:

The report script scripts/footprint/size_report is already designed to take command line arguments, including the depth parameter. The proposal also considers adding a sort key option, as well as any other options suggested by the community.

However, the tool is best used via the west build command as the cmake file loads in many of the other required arguments, and so modifications should also be made to the cmake/reports/CMakeLists.txt file.

With the proposed changes, a report might be generated like the following:

West build -t rom_report -Dsort_key=size

As a note, I have tried these changes by manually changing lines in the scripts and found them to work as expected.

Dependencies

This is a focussed change, and only affects cmake/reports/CMakeLists.txt and scripts/footprint/size_report

Concerns and Unresolved Questions

Main question point is that there needs to be a determination of which options to support and how they should be named.

Alternatives

Main alternative was to change the default sorting behaviour of the report, but that might break other people's workflows.

github-actions[bot] commented 1 year ago

Hi @adleris! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙