Skip to content

Add code size target#590

Draft
davidhorstmann-arm wants to merge 4 commits intoMbed-TLS:developmentfrom
davidhorstmann-arm:add-code-size-target
Draft

Add code size target#590
davidhorstmann-arm wants to merge 4 commits intoMbed-TLS:developmentfrom
davidhorstmann-arm:add-code-size-target

Conversation

@davidhorstmann-arm
Copy link
Contributor

@davidhorstmann-arm davidhorstmann-arm commented Dec 5, 2025

Use the scripts from Mbed-TLS/mbedtls-framework#246 to implement a new target in CMake called size which displays the code sizes of modules and generates a JSON code size report.

To use it, simply do the following:

cd build
cmake ..
make -j8
make size

When cross compiling with a toolchain file, this relies on the variable CMAKE_SIZE_UTIL being set to the size command for the relevant architecture (e.g. arm-none-eabi-size).

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

  • changelog provided | not required because:
  • framework PR provided Mbed-TLS/mbedtls-framework# | not required
  • mbedtls development PR provided Mbed-TLS/mbedtls# | not required because:
  • mbedtls 3.6 PR provided Mbed-TLS/mbedtls# | not required because:
  • tests provided | not required because:

This simply generates a code size report using the script in the
framework.

Signed-off-by: David Horstmann <[email protected]>
We can set it separately in toolchain files when needed.

Signed-off-by: David Horstmann <[email protected]>
Call a second script to show the code size that was generated as part of
the size target. This makes the feature immediately usable.

Signed-off-by: David Horstmann <[email protected]>
This gets the code size scripts that were added which allow us to create
the size target.

Signed-off-by: David Horstmann <[email protected]>
@davidhorstmann-arm davidhorstmann-arm marked this pull request as draft December 5, 2025 12:19
@davidhorstmann-arm davidhorstmann-arm added the priority-low Low priority - this may not receive review soon label Dec 5, 2025
@gilles-peskine-arm gilles-peskine-arm self-requested a review December 8, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority-low Low priority - this may not receive review soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant