Skip to content

Commit

Permalink
openiotsdk: Enable build with GCC 12 (#26162)
Browse files Browse the repository at this point in the history
TF-M fails to link with GCC 11.3 and onward as new warning are raised
at link time and the linking step disallow warning.
To workaround the issue we disable link warnings for TF-M by patching
it.

Signed-off-by: Vincent Coubard <vincent.coubard@arm.com>
  • Loading branch information
pan- authored and pull[bot] committed Jul 26, 2023
1 parent 3856313 commit 1159415
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/openiotsdk/cmake/sdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ FetchContent_Declare(
GIT_PROGRESS ON
)

# Apply a patch to TF-M to support GCC 12
FetchContent_Declare(
trusted-firmware-m
GIT_REPOSITORY https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
GIT_TAG d0c0a67f1b412e89d09b0987091c12998c4e4660
GIT_SHALLOW OFF
GIT_PROGRESS ON
# Note: This prevents FetchContent_MakeAvailable() from calling
# add_subdirectory() on the fetched repository. TF-M needs a
# standalone build because it relies on functions defined in its
# own toolchain files and contains paths that reference the
# top-level project instead of its own project.
SOURCE_SUBDIR NONE
PATCH_COMMAND git reset --hard --quiet && git clean --force -dx --quiet && git apply ${CMAKE_CURRENT_LIST_DIR}/tf-m.patch
)

# Open IoT SDK configuration
set(IOTSDK_FETCH_LIST
mcu-driver-reference-platforms-for-arm
Expand Down
12 changes: 12 additions & 0 deletions config/openiotsdk/cmake/tf-m.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index d044ed4a5..3d8f64d17 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -71,7 +71,6 @@ macro(tfm_toolchain_reset_linker_flags)
--entry=Reset_Handler
--specs=nano.specs
LINKER:-check-sections
- LINKER:-fatal-warnings
LINKER:--gc-sections
LINKER:--no-wchar-size-warning
${MEMORY_USAGE_FLAG}

0 comments on commit 1159415

Please sign in to comment.