Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
build*/
!doc/build/
!scripts/build
!scripts/buildreport
!share/sysbuild/build
!tests/drivers/build_all
!scripts/pylib/build_helpers
Expand Down
11 changes: 11 additions & 0 deletions cmake/reports/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,14 @@ if(NOT ${PAHOLE} STREQUAL PAHOLE-NOTFOUND)
USES_TERMINAL
)
endif()

add_custom_target(
buildreport
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/buildreport/buildreport.py
--output ${CMAKE_BINARY_DIR}/report
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps move it a level down, such as:

Suggested change
--output ${CMAKE_BINARY_DIR}/report
--output ${CMAKE_BINARY_DIR}/html/report
--zephyr-base ${ZEPHYR_BASE}
${CMAKE_BINARY_DIR}
DEPENDS ${logical_target_for_zephyr_elf}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
1 change: 1 addition & 0 deletions cmake/usage/usage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ message(" ram_plot - Build and create RAM usage in a sunburst chart as a vi
message(" rom_plot - Build and create ROM usage in a sunburst chart as a visual representation")
message(" traceconfig - Generate a file in the build directory that details how each symbol got its final value")
message(" footprint - Create JSON RAM/ROM usage report in the build directory")
message(" buildreport - Generate an HTML report with footprint, traceconfig, initlevels, devicetree, and other details")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other commands, such as ram_report, rom_report, initlevels, etc produces textual output directly.

Commands not doing so or relies on dedicated program indicates this is their target name, such as pahole and puncover.

I would like buildreport to reflect in its name that this is not a textual output.

For example html_report / html_buildreport.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. There are number of locations whose name should be consistent. Currently the PR uses:

  • west command: west build -t buildreport
  • Script location: scripts/buildreport
  • Script name: buildreport.py
  • Output location: build/report

Based on suggestions so far I will update the west command to west build -t html_report and the default output location to build/html/report.

What are your thoughts on the script location and name? Would this be preferred:

  • Script location: scripts/html_report
  • Script name: html_report.py
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another naming idea could be "dashboard":

  • west command: west build -t dashboard or west build -t html_dashboard
  • Script location: scripts/dashboard
  • Script name: dashboard.py
  • Output location: build/html/dashboard
message(" initlevels - Display the initialization sequence")
message(" boards - Display supported boards")
message(" shields - Display supported shields")
Expand Down
Binary file added doc/develop/optimizations/build_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions doc/develop/optimizations/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Optimization Tools

The available optimization tools let you analyse :ref:`footprint_tools`
and :ref:`data_structure_tools` using different build system targets.
An :ref:`HTML report <build_report>` can be also be generated for a
more dynamic view of build artifacts and metrics.

.. _footprint_tools:

Expand Down Expand Up @@ -300,3 +302,37 @@ Pahole will generate something similar to the output below in the console::
};
...
...

.. _build_report:

Build Report
************

An HTML build report can be generated that consolidates the various tool
outputs and artifacts into one simple view. In addition to a basic summary of
the build results, the following details are included:

* Full memory reports (ram, rom) in drill-down table form as well as
:ref:`plots <footprint_tools_plot>` (as per the ``footprint``, ``ram_plot``,
and ``rom_plot`` build targets).
* Kconfig symbol values and sources (as per the ``traceconfig`` build target).
* Init-levels with function names, and report on any priority issues with sys-init
against devicetree (as per the ``initlevels`` build target).
* Navigable devicetree view with property values and details from any bindings.

Use the ``buildreport`` target with your board, as in the following example.
If you are using :ref:`sysbuild`, see :ref:`sysbuild_dedicated_image_build_targets` instead.

.. zephyr-app-commands::
:tool: all
:zephyr-app: samples/hello_world
:board: reel_board
:goals: buildreport

This will generate the following output file::

build/report/index.html

.. image:: build_report.png
:align: center
:alt: Build report
5 changes: 5 additions & 0 deletions scripts/build/check_init_priorities.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ def check_edt(self):
for dep in dev.depends_on:
self._check_dep(dev_ord, dep.dep_ordinal)

@property
def initlevels(self):
"""Get the dictionary of initlevels."""
return self._obj.initlevels

def print_initlevels(self):
for level, calls in self._obj.initlevels.items():
print(level)
Expand Down
Loading