Skip to content

Commit

Permalink
linker: Only use itcm and dtcm snippets if regions exist
Browse files Browse the repository at this point in the history
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 <rgreter@baumer.com>
  • Loading branch information
raffi-g authored and dleach02 committed Jan 25, 2024
1 parent 33ffe00 commit 81022fa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,20 @@ function(zephyr_linker_sources location)
elseif("${location}" STREQUAL "NOCACHE_SECTION")
set(snippet_path "${nocache_path}")
elseif("${location}" STREQUAL "ITCM_SECTION")
dt_has_chosen(HAS_ITCM PROPERTY "zephyr,itcm")
if(NOT HAS_ITCM)
message(FATAL_ERROR "Trying to link snippet into itcm but no itcm available. "
"Add `zephyr,itcm` to the device tree if supported on your device or choose another "
"location.")
endif()
set(snippet_path "${itcm_path}")
elseif("${location}" STREQUAL "DTCM_SECTION")
dt_has_chosen(HAS_DTCM PROPERTY "zephyr,dtcm")
if(NOT HAS_DTCM)
message(FATAL_ERROR "Trying to link snippet into dtcm but no dtcm available. "
"Add `zephyr,dtcm` to the device tree if supported on your device or choose another "
"location.")
endif()
set(snippet_path "${dtcm_path}")
elseif("${location}" STREQUAL "PINNED_RAM_SECTIONS")
set(snippet_path "${pinned_ram_sections_path}")
Expand Down

0 comments on commit 81022fa

Please sign in to comment.