Skip to content

Commit

Permalink
doc: tfm: Add tfm_ram_report and tfm_rom_report
Browse files Browse the repository at this point in the history
Add usage examples from tfm_ram_report and tfm_rom_report.

Signed-off-by: Markus Lassila <[email protected]>
  • Loading branch information
MarkusLassila committed Jan 15, 2025
1 parent e15f633 commit 68f644d
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions doc/nrf/security/tfm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ We will decrease the size of the (optional) ``mcuboot_pad`` partition and thus t
address: 0x8000
size: 0x4000
Analyzing TF-M partition size
=============================
Analyzing ``tfm_secure`` partition size
=======================================

The size of the TF-M partition can be analyzed from the build output.
The size of the ``tfm_secure`` partition can be analyzed from the build output.

.. code-block:: console
Expand All @@ -283,12 +283,26 @@ The size of the TF-M partition can be analyzed from the build output.
FLASH: 31972 B 256 KB 12.20%
RAM: 4804 B 88 KB 5.33%
The example above shows that the TF-M partition :kconfig:option:`CONFIG_PM_PARTITION_SIZE_TFM` is set to 256 kB and the TF-M binary uses 32 kB of the available space.
Similarly the TF-M partition :kconfig:option:`CONFIG_PM_PARTITION_SIZE_TFM_SRAM` is set to 88 kB and the TF-M binary uses 5 kB of the available space.
This information can be used to optimize the size of the TF-M partition, as long as it is within the alignment requirements explained in the previous section.
The example above shows that the ``tfm_secure`` partition :kconfig:option:`CONFIG_PM_PARTITION_SIZE_TFM` is set to 256 kB and the TF-M binary uses 32 kB of the available space.
Similarly the ``tfm_secure`` partition :kconfig:option:`CONFIG_PM_PARTITION_SIZE_TFM_SRAM` is set to 88 kB and the TF-M binary uses 5 kB of the available space.
This information can be used to optimize the size of the TF-M, as long as it is within the alignment requirements explained in the previous section.

To see more detailed information about the memory usage, refer to :ref:`tfm_build_system` documentation.
Build system offers tools like ``tfm_ram_report`` and ``tfm_rom_report`` to analyze the RAM and ROM usage in generated images.
Tools for analyzing the ``tfm_secure`` partition size
-----------------------------------------------------

TF-M build system provides ``tfm_ram_report`` and ``tfm_rom_report`` targets for analyzing the memory usage of the TF-M partitions inside ``tfm_secure`` partition.

With |NCS|, the following commands can be used to generate the reports:

.. code-block:: console
west build -p -b nrf9151dk/nrf9151/ns samples/tfm/tfm_hello_world
cd build/tfm_hello_world
ninja tfm_ram_report
ninja tfm_rom_report
Reports can be used to analyze the memory usage of the different TF-M partitions and how changing the Kconfig options affects the memory usage.
For more information about the ``tfm_ram_report`` and ``tfm_rom_report`` targets, refer to the :ref:`tfm_build_system` documentation.

.. _tfm_encrypted_its:

Expand Down

0 comments on commit 68f644d

Please sign in to comment.