diff --git a/cmake/linker/iar/config_file_script.cmake b/cmake/linker/iar/config_file_script.cmake index 25d14a5d12f..60332fb5d7e 100644 --- a/cmake/linker/iar/config_file_script.cmake +++ b/cmake/linker/iar/config_file_script.cmake @@ -832,7 +832,12 @@ function(section_to_string) string(REGEX REPLACE "(block[ \t\r\n]+)([^ \t\r\n]+)" "\\1\\2_init" INIT_TEMP "${TEMP}") string(REGEX REPLACE "(rw)([ \t\r\n]+)(section[ \t\r\n]+)([^ \t\r\n,]+)" "\\1\\2\\3\\4_init" INIT_TEMP "${INIT_TEMP}") string(REGEX REPLACE "(rw)([ \t\r\n]+)(section[ \t\r\n]+)" "ro\\2\\3" INIT_TEMP "${INIT_TEMP}") - string(REGEX REPLACE "alphabetical order, " "" INIT_TEMP "${INIT_TEMP}") + + # No alphabetical orders on initializers + # Only alphabetical attribute. + string(REGEX REPLACE "with alphabetical order {" " {" INIT_TEMP "${INIT_TEMP}") + # Respect other attributes. + string(REGEX REPLACE "(, alphabetical order|alphabetical order, )" "" INIT_TEMP "${INIT_TEMP}") string(REGEX REPLACE "{ readwrite }" "{ }" INIT_TEMP "${INIT_TEMP}") set(TEMP "${TEMP}\n${INIT_TEMP}\n")