Skip to content

Commit 4811674

Browse files
committed
modules: tf-m: Add fallback __assert_no_args
This fixes a build issue when building TF-M debug configurations. Adds a weak implementation of __assert_no_args which simply calls TF-M core panic. The issue was triggered by the tfm_hello_world sample with sample.tfm.hello_world.bootloaders_debug configuration. Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
1 parent 7362df8 commit 4811674

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • modules/trusted-firmware-m/tfm_boards/common

modules/trusted-firmware-m/tfm_boards/common/assert.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,14 @@
6868
#endif
6969

7070
#endif /* CONFIG_PARTITION_MANAGER_ENABLED */
71+
72+
/* picolibc's <assert.h> expands assert() into a call to __assert_no_args() when
73+
* NDEBUG and ASSERT_VERBOSE are not defined. The TF-M secure image is linked with -nostdlib
74+
* (since it defaults to TFM_INCLUDE_STDLIBC=n), so in some configurations this results
75+
* to undefined reference to __assert_no_args() when assert() is used in the TF-M secure image.
76+
* Make it weak so that that acts a fallback implementation.
77+
*/
78+
__WEAK __NO_RETURN void __assert_no_args(void)
79+
{
80+
tfm_core_panic();
81+
}

0 commit comments

Comments
 (0)