Framework to measure stack usage #318

Open
gilles-peskine-arm wants to merge 2 commits from gilles-peskine-arm/mbedtls_test_stack_usage-create into main
gilles-peskine-arm commented 2026-08-31 13:04:46 -05:00 (Migrated from github.com)

Measure the stack usage of a code snippet. The new macro MBEDTLS_TEST_STACK_USAGE_CHECK() allows test code to assert that no more than N bytes of stack have been used.

Written for https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/889 . This isn't usable in practice: the expected stack usage varies too much depending on the target CPU, the compiler and compiler options.

PR checklist

  • TF-PSA-Crypto development PR provided https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/886
  • TF-PSA-Crypto 1.1 PR not required because: new feature only used in crypto development
  • mbedtls development PR not required because: new feature only used in crypto development
  • mbedtls 4.1 PR not required because: new feature only used in crypto development
  • mbedtls 3.6 PR not required because: new feature only used in crypto development
Measure the stack usage of a code snippet. The new macro `MBEDTLS_TEST_STACK_USAGE_CHECK()` allows test code to assert that no more than N bytes of stack have been used. Written for https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/889 . This isn't usable in practice: the expected stack usage varies too much depending on the target CPU, the compiler and compiler options. ## PR checklist - [x] **TF-PSA-Crypto development PR** provided https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/886 - [x] **TF-PSA-Crypto 1.1 PR** not required because: new feature only used in crypto development - [x] **mbedtls development PR** not required because: new feature only used in crypto development - [x] **mbedtls 4.1 PR** not required because: new feature only used in crypto development - [x] **mbedtls 3.6 PR** not required because: new feature only used in crypto development
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'gilles-peskine-arm/mbedtls_test_stack_usage-create:gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'gilles-peskine-arm/mbedtls_test_stack_usage-create'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git rebase 'main'
git switch 'main'
git merge --ff-only 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git rebase 'main'
git switch 'main'
git merge --no-ff 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'main'
git merge --squash 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'main'
git merge --ff-only 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git switch 'main'
git merge 'gilles-peskine-arm/mbedtls_test_stack_usage-create'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/mbedtls-framework!318
No description provided.