From ff8b24b6bd172bd0d374816395f31b02058830e6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 5 Jun 2025 15:00:47 -0700 Subject: [PATCH] cmake/modules: Make SUBALIGN parameter to zephyr_iterable_sections optional Most uses of this macro should *not* include SUBALIGN as that can reduce the alignment requirement for data and cause unaligned access faults in the processor. Leave support for this in place in case there are still uses for it. Signed-off-by: Keith Packard --- cmake/modules/extensions.cmake | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index c036d91bb5b..c44a02fa6bd 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -5288,6 +5288,7 @@ function(zephyr_iterable_section) set(options "ALIGN_WITH_INPUT;NUMERIC") set(single_args "GROUP;LMA;NAME;SUBALIGN;VMA") set(multi_args "") + set(subalign "") set(align_input) cmake_parse_arguments(SECTION "${options}" "${single_args}" "${multi_args}" ${ARGN}) @@ -5297,10 +5298,8 @@ function(zephyr_iterable_section) ) endif() - if(NOT DEFINED SECTION_SUBALIGN) - message(FATAL_ERROR "zephyr_iterable_section(${ARGV0} ...) missing " - "required argument: SUBALIGN" - ) + if(DEFINED SECTION_SUBALIGN) + set(subalign "SUBALIGN ${SECTION_SUBALIGN}") endif() if(SECTION_ALIGN_WITH_INPUT) @@ -5321,7 +5320,7 @@ function(zephyr_iterable_section) NAME ${SECTION_NAME}_area GROUP "${SECTION_GROUP}" VMA "${SECTION_VMA}" LMA "${SECTION_LMA}" - NOINPUT ${align_input} SUBALIGN ${SECTION_SUBALIGN} + NOINPUT ${align_input} ${subalign} ) zephyr_linker_section_configure( SECTION ${SECTION_NAME}_area