Skip to content

Commit d66b940

Browse files
keith-packardnashif
authored andcommitted
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 <keithp@keithp.com>
1 parent 91e1174 commit d66b940

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmake/modules/extensions.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5288,6 +5288,7 @@ function(zephyr_iterable_section)
52885288
set(options "ALIGN_WITH_INPUT;NUMERIC")
52895289
set(single_args "GROUP;LMA;NAME;SUBALIGN;VMA")
52905290
set(multi_args "")
5291+
set(subalign "")
52915292
set(align_input)
52925293
cmake_parse_arguments(SECTION "${options}" "${single_args}" "${multi_args}" ${ARGN})
52935294

@@ -5297,10 +5298,8 @@ function(zephyr_iterable_section)
52975298
)
52985299
endif()
52995300

5300-
if(NOT DEFINED SECTION_SUBALIGN)
5301-
message(FATAL_ERROR "zephyr_iterable_section(${ARGV0} ...) missing "
5302-
"required argument: SUBALIGN"
5303-
)
5301+
if(DEFINED SECTION_SUBALIGN)
5302+
set(subalign "SUBALIGN ${SECTION_SUBALIGN}")
53045303
endif()
53055304

53065305
if(SECTION_ALIGN_WITH_INPUT)
@@ -5321,7 +5320,7 @@ function(zephyr_iterable_section)
53215320
NAME ${SECTION_NAME}_area
53225321
GROUP "${SECTION_GROUP}"
53235322
VMA "${SECTION_VMA}" LMA "${SECTION_LMA}"
5324-
NOINPUT ${align_input} SUBALIGN ${SECTION_SUBALIGN}
5323+
NOINPUT ${align_input} ${subalign}
53255324
)
53265325
zephyr_linker_section_configure(
53275326
SECTION ${SECTION_NAME}_area

0 commit comments

Comments
 (0)