32
32
- If the memory type is appended with _DATA / _TEXT/ _RODATA/ _BSS only the
33
33
selected memory is placed in the required memory region. Others are
34
34
ignored.
35
- - COPY/NOCOPY defines whether the script should generate the relocation code in
36
- code_relocation.c or not
35
+ - COPY/NOCOPY defines whether the script should generate the relocation code for text segment
36
+ symbols in code_relocation.c or not
37
+ - COPYDATA/NOCOPYDATA defines whether the script should generate the relocation code for data segment
38
+ symbols in code_relocation.c or not
37
39
- NOKEEP will suppress the default behavior of marking every relocated symbol
38
40
with KEEP() in the generated linker script.
39
41
@@ -389,9 +391,10 @@ def generate_linker_script(linker_file, sram_data_linker_file, sram_bss_linker_f
389
391
390
392
for memory_type , full_list_of_sections in \
391
393
sorted (complete_list_of_sections .items ()):
392
-
393
- is_copy = bool ("|COPY" in memory_type )
394
- memory_type = memory_type .split ("|" , 1 )[0 ]
394
+ memory_type = memory_type .split ("|" )
395
+ is_copy = bool ("COPY" in memory_type )
396
+ is_copy_data = bool ("COPYDATA" in memory_type )
397
+ memory_type = memory_type [0 ]
395
398
396
399
if region_is_default_ram (memory_type ) and is_copy :
397
400
gen_string += MPU_RO_REGION_START .format (memory_type .lower (), memory_type .upper ())
@@ -404,10 +407,10 @@ def generate_linker_script(linker_file, sram_data_linker_file, sram_bss_linker_f
404
407
gen_string += MPU_RO_REGION_END .format (memory_type .lower ())
405
408
406
409
if region_is_default_ram (memory_type ):
407
- gen_string_sram_data += string_create_helper (SectionKind .DATA , memory_type , full_list_of_sections , 1 , 1 , phdrs )
410
+ gen_string_sram_data += string_create_helper (SectionKind .DATA , memory_type , full_list_of_sections , 1 , is_copy_data , phdrs )
408
411
gen_string_sram_bss += string_create_helper (SectionKind .BSS , memory_type , full_list_of_sections , 0 , 1 , phdrs )
409
412
else :
410
- gen_string += string_create_helper (SectionKind .DATA , memory_type , full_list_of_sections , 1 , 1 , phdrs )
413
+ gen_string += string_create_helper (SectionKind .DATA , memory_type , full_list_of_sections , 1 , is_copy_data , phdrs )
411
414
gen_string += string_create_helper (SectionKind .BSS , memory_type , full_list_of_sections , 0 , 1 , phdrs )
412
415
413
416
# finally writing to the linker file
@@ -623,10 +626,9 @@ def main():
623
626
624
627
code_generation = {"copy_code" : '' , "zero_code" : '' , "extern" : '' }
625
628
for mem_type , list_of_sections in sorted (complete_list_of_sections .items ()):
626
-
627
- if "|COPY" in mem_type :
628
- mem_type = mem_type .split ("|" , 1 )[0 ]
629
- code_generation = generate_memcpy_code (mem_type ,
629
+ mem_type = mem_type .split ("|" )
630
+ if "COPY" in mem_type :
631
+ code_generation = generate_memcpy_code (mem_type [0 ],
630
632
list_of_sections , code_generation )
631
633
632
634
dump_header_file (args .output_code , code_generation )
0 commit comments