Skip to content

Commit 81022fa

Browse files
raffi-gdleach02
authored andcommitted
linker: Only use itcm and dtcm snippets if regions exist
This tests whether there actually is an itcm or dtcm in the device tree. Otherwise a FATAL_ERROR is generated. Signed-off-by: Greter Raffael <[email protected]>
1 parent 33ffe00 commit 81022fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmake/modules/extensions.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,20 @@ function(zephyr_linker_sources location)
12701270
elseif("${location}" STREQUAL "NOCACHE_SECTION")
12711271
set(snippet_path "${nocache_path}")
12721272
elseif("${location}" STREQUAL "ITCM_SECTION")
1273+
dt_has_chosen(HAS_ITCM PROPERTY "zephyr,itcm")
1274+
if(NOT HAS_ITCM)
1275+
message(FATAL_ERROR "Trying to link snippet into itcm but no itcm available. "
1276+
"Add `zephyr,itcm` to the device tree if supported on your device or choose another "
1277+
"location.")
1278+
endif()
12731279
set(snippet_path "${itcm_path}")
12741280
elseif("${location}" STREQUAL "DTCM_SECTION")
1281+
dt_has_chosen(HAS_DTCM PROPERTY "zephyr,dtcm")
1282+
if(NOT HAS_DTCM)
1283+
message(FATAL_ERROR "Trying to link snippet into dtcm but no dtcm available. "
1284+
"Add `zephyr,dtcm` to the device tree if supported on your device or choose another "
1285+
"location.")
1286+
endif()
12751287
set(snippet_path "${dtcm_path}")
12761288
elseif("${location}" STREQUAL "PINNED_RAM_SECTIONS")
12771289
set(snippet_path "${pinned_ram_sections_path}")

0 commit comments

Comments
 (0)