Skip to content

Commit ff40315

Browse files
joerchanrlubos
authored andcommitted
tfm: Fix undefined reference to 'end' when disabling secure output
Fix undefined reference to 'end' when disabling secure output from the TF-M image. When secure output is disabled the printf function is not overriden in TF-M and the libc variant has references to heap functions. Make sure that the printf function is overriden for this case also and drop the output message. NCSDK-22818 Signed-off-by: Joakim Andersson <[email protected]>
1 parent 80bd767 commit ff40315

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

modules/tfm/tfm/boards/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ if (NOT ${PLATFORM_DEFAULT_PROVISIONING})
6565
)
6666
endif()
6767

68+
target_sources(tfm_sprt
69+
PRIVATE
70+
$<$<NOT:$<BOOL:${TFM_SP_LOG_RAW_ENABLED}>>:${CMAKE_CURRENT_SOURCE_DIR}/common/dummy_tfm_sp_log_raw.c>
71+
)
72+
6873
# Disabling UART stdout not supported in NS Image, which is always built even when not needed.
6974
target_sources(platform_ns
7075
PRIVATE
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2022 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <stdarg.h>
8+
#include <stddef.h>
9+
10+
/* This function is here in case any references to printf has been accidentally
11+
* left in the code. This will then mute this printfs from pulling in the real
12+
* printf instead of the function defined in tfm_sp_log_raw.c when this file
13+
* is not part of the build.
14+
*/
15+
int printf(const char *fmt, ...)
16+
{
17+
return 0;
18+
}

0 commit comments

Comments
 (0)