From a9ed11c3f6386a45e511b85a0d3734af60cb7e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bergman?= Date: Fri, 17 Jan 2025 11:24:30 +0100 Subject: [PATCH] toolchain: iar: Implement MIN_SIZE and MAX_SIZE for IAR linker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement the MIN_SIZE and MAX_SIZE options to zephyr_linker_section_configurefor the IAR icf linker file generator Signed-off-by: Björn Bergman --- cmake/linker/iar/config_file_script.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmake/linker/iar/config_file_script.cmake b/cmake/linker/iar/config_file_script.cmake index 2877fcaa1d3..25d14a5d12f 100644 --- a/cmake/linker/iar/config_file_script.cmake +++ b/cmake/linker/iar/config_file_script.cmake @@ -440,6 +440,8 @@ function(section_to_string) get_property(endalign GLOBAL PROPERTY ${STRING_SECTION}_ENDALIGN) get_property(vma GLOBAL PROPERTY ${STRING_SECTION}_VMA) get_property(lma GLOBAL PROPERTY ${STRING_SECTION}_LMA) + get_property(min_size GLOBAL PROPERTY ${STRING_SECTION}_MIN_SIZE) + get_property(max_size GLOBAL PROPERTY ${STRING_SECTION}_MAX_SIZE) get_property(noinput GLOBAL PROPERTY ${STRING_SECTION}_NOINPUT) get_property(noinit GLOBAL PROPERTY ${STRING_SECTION}_NOINIT) @@ -543,6 +545,12 @@ function(section_to_string) if(endalign) set(TEMP "${TEMP}, end alignment=${endalign}") endif() + if(DEFINED min_size) + set(TEMP "${TEMP}, minimum size=${min_size}") + endif() + if(DEFINED max_size) + set(TEMP "${TEMP}, maximum size=${max_size}") + endif() set(TEMP "${TEMP}\n{") @@ -597,6 +605,9 @@ function(section_to_string) get_property(flags GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx}_FLAGS) get_property(input GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx}_INPUT) get_property(symbols GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx}_SYMBOLS) + get_property(i_min_size GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx}_MIN_SIZE) + get_property(i_max_size GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx}_MAX_SIZE) + # Get the next offset and use that as this ones size! get_property(offset GLOBAL PROPERTY ${STRING_SECTION}_SETTING_${idx_next}_OFFSET) @@ -682,6 +693,12 @@ function(section_to_string) else() list(APPEND block_attr "alignment=4") endif() + if(DEFINED i_min_size AND NOT i_min_size EQUAL 0) + list(APPEND block_attr "minimum size = ${i_min_size}") + endif() + if(DEFINED i_max_size ) + list(APPEND block_attr "maximum size = ${i_max_size}") + endif() # LD # There are two ways to include more than one section: