@@ -333,7 +333,7 @@ function(group_to_string)
333
333
endif ()
334
334
335
335
set (${STRING_STRING} "${${STRING_STRING} }\" ${name} \" : place in ${ILINK_CURRENT_NAME} { block ${name_clean} };\n " )
336
- if (DEFINED vma AND DEFINED lma AND NOT ${noinit} )
336
+ if (CONFIG_IAR_ZEPHYR_INIT AND DEFINED vma AND DEFINED lma AND NOT ${noinit} )
337
337
set (${STRING_STRING} "${${STRING_STRING} }\" ${name} _init\" : place in ${lma} { block ${name_clean} _init };\n " )
338
338
endif ()
339
339
@@ -792,32 +792,51 @@ function(section_to_string)
792
792
list (JOIN current_sections ", " SELECTORS )
793
793
set (TEMP "${TEMP} \n do not initialize {\n ${SELECTORS} \n };" )
794
794
else ()
795
- # Generate the _init block and the initialize manually statement.
796
- # Note that we need to have the X_init block defined even if we have
797
- # no sections, since there will come a "place in XXX" statement later.
798
-
799
- # "${TEMP}" is there too keep the ';' else it will be a list
800
- string (REGEX REPLACE "(block[ \t\r\n ]+)([^ \t\r\n ]+)" "\\ 1\\ 2_init" INIT_TEMP "${TEMP} " )
801
- string (REGEX REPLACE "(rw)([ \t\r\n ]+)(section[ \t\r\n ]+)([^ \t\r\n ,]+)" "\\ 1\\ 2\\ 3\\ 4_init" INIT_TEMP "${INIT_TEMP} " )
802
- string (REGEX REPLACE "(rw)([ \t\r\n ]+)(section[ \t\r\n ]+)" "ro\\ 2\\ 3" INIT_TEMP "${INIT_TEMP} " )
803
- string (REGEX REPLACE "alphabetical order, " "" INIT_TEMP "${INIT_TEMP} " )
804
- string (REGEX REPLACE "{ readwrite }" "{ }" INIT_TEMP "${INIT_TEMP} " )
805
-
806
- # If any content is marked as keep, is has to be applied to the init block
807
- # too, esp. for blocks that are not referenced (e.g. empty blocks wiht min_size)
808
- if (to_be_kept )
809
- list (APPEND to_be_kept "block ${name_clean} _init" )
810
- endif ()
811
- set (TEMP "${TEMP} \n ${INIT_TEMP} \n " )
795
+
812
796
if (DEFINED current_sections )
813
- set (TEMP "${TEMP} \n initialize manually with copy friendly\n " )
814
- set (TEMP "${TEMP} {\n " )
815
- foreach (section ${current_sections} )
816
- set (TEMP "${TEMP} ${section} ,\n " )
817
- endforeach ()
818
- set (TEMP "${TEMP} };" )
819
- set (current_sections )
797
+ if (CONFIG_IAR_DATA_INIT )
798
+ set (TEMP "${TEMP} \n initialize by copy\n " )
799
+ set (TEMP "${TEMP} {\n " )
800
+ foreach (section ${current_sections} )
801
+ set (TEMP "${TEMP} ${section} ,\n " )
802
+ endforeach ()
803
+ set (TEMP "${TEMP} };" )
804
+
805
+ set (TEMP "${TEMP} \n\" ${name} _init\" : place in ${group_parent_lma} {\n " )
806
+ foreach (section ${current_sections} )
807
+ set (TEMP "${TEMP} ${section} _init,\n " )
808
+ endforeach ()
809
+ set (TEMP "${TEMP} };" )
810
+ elseif (CONFIG_IAR_ZEPHYR_INIT )
811
+ # Generate the _init block and the initialize manually statement.
812
+ # Note that we need to have the X_init block defined even if we have
813
+ # no sections, since there will come a "place in XXX" statement later.
814
+
815
+ # "${TEMP}" is there too keep the ';' else it will be a list
816
+ string (REGEX REPLACE "(block[ \t\r\n ]+)([^ \t\r\n ]+)" "\\ 1\\ 2_init" INIT_TEMP "${TEMP} " )
817
+ string (REGEX REPLACE "(rw)([ \t\r\n ]+)(section[ \t\r\n ]+)([^ \t\r\n ,]+)" "\\ 1\\ 2\\ 3\\ 4_init" INIT_TEMP "${INIT_TEMP} " )
818
+ string (REGEX REPLACE "(rw)([ \t\r\n ]+)(section[ \t\r\n ]+)" "ro\\ 2\\ 3" INIT_TEMP "${INIT_TEMP} " )
819
+ string (REGEX REPLACE "alphabetical order, " "" INIT_TEMP "${INIT_TEMP} " )
820
+ string (REGEX REPLACE "{ readwrite }" "{ }" INIT_TEMP "${INIT_TEMP} " )
821
+
822
+ # If any content is marked as keep, is has to be applied to the init block
823
+ # too, esp. for blocks that are not referenced (e.g. empty blocks wiht min_size)
824
+ if (to_be_kept )
825
+ list (APPEND to_be_kept "block ${name_clean} _init" )
826
+ endif ()
827
+ set (TEMP "${TEMP} \n ${INIT_TEMP} \n " )
828
+ set (TEMP "${TEMP} \n initialize manually with copy friendly\n " )
829
+ set (TEMP "${TEMP} {\n " )
830
+ foreach (section ${current_sections} )
831
+ set (TEMP "${TEMP} ${section} ,\n " )
832
+ endforeach ()
833
+ set (TEMP "${TEMP} };" )
834
+ set (current_sections )
835
+ endif ()
820
836
endif ()
837
+
838
+ set (current_sections )
839
+
821
840
endif ()
822
841
endif ()
823
842
0 commit comments