Lines Matching +full:if +full:- +full:no +full:- +full:files +full:- +full:found
5 # SPDX-License-Identifier: Apache-2.0
9 This script will relocate .text, .rodata, .data and .bss sections from required files
25 python3 gen_relocate_app.py -i input_string -o generated_linker -c generated_code
29 - If the memory is like SRAM1/SRAM2/CCD/AON then place full object in
31 - If the memory type is appended with _DATA / _TEXT/ _RODATA/ _BSS only the
34 - COPY/NOCOPY defines whether the script should generate the relocation code in
36 - NOKEEP will suppress the default behavior of marking every relocated symbol
82 if ".text." in name:
153 __{0}_{1}_reloc_size = __{0}_{1}_reloc_end - __{0}_{1}_reloc_start;
164 #if {6}
171 __{0}_{1}_reloc_size = __{0}_{1}_reloc_end - __{0}_{1}_reloc_start;
177 #include <zephyr/linker/linker-defs.h>
215 def region_is_default_ram(region_name: str) -> bool:
228 def find_sections(filename: str) -> 'dict[SectionKind, list[OutputSection]]':
239 if not full_lib:
247 if section_kind is None:
255 # only after linking in the final executable. This "if" finds
259 if isinstance(section, SymbolTableSection):
264 warnings.warn("Common variable found. Move "+
273 ) -> 'dict[MemoryRegion, dict[SectionKind, list[OutputSection]]]':
281 if align_size:
298 def section_kinds_from_memory_region(memory_region: str) -> 'Tuple[set[SectionKind], str]':
303 follow the region name. If no kinds are specified all are assumed.
314 if specifier in memory_region:
317 if not out:
318 # No listed kinds implies all of the kinds
326 template = PRINT_TEMPLATE if section.keep else PRINT_TEMPLATE_NOKEEP
332 return f'{memory_type} {phdrs[memory_type] if memory_type in phdrs else ""}'
344 if load_address_in_flash:
345 if is_copy:
351 if full_list_of_sections[kind]:
355 if region_is_default_ram(memory_type) and kind in (SectionKind.DATA, SectionKind.BSS):
358 if not region_is_default_ram(memory_type) and kind is SectionKind.RODATA:
360 if memory_type in mpu_align:
366 … if region_is_default_ram(memory_type) and kind in (SectionKind.TEXT, SectionKind.LITERAL):
373 if load_address_in_flash:
391 if region_is_default_ram(memory_type) and is_copy:
398 if region_is_default_ram(memory_type) and is_copy:
401 if region_is_default_ram(memory_type):
422 # Non-BSS sections get copied to the destination memory, except data in
425 if region_is_default_ram(memory_type) and kind is SectionKind.DATA:
428 if kind in generate_sections and full_list_of_sections[kind]:
435 if (SectionKind.BSS in generate_sections
448 # create a dummy void function if there is no code to generate for
453 if code_generation["copy_code"]:
457 if code_generation["zero_code"]:
472 parser.add_argument("-d", "--directory", required=True,
474 parser.add_argument("-i", "--input_rel_dict", required=True, type=argparse.FileType('r'),
476 parser.add_argument("-o", "--output", required=False, help="Output ld file")
477 parser.add_argument("-s", "--output_sram_data", required=False,
479 parser.add_argument("-b", "--output_sram_bss", required=False,
481 parser.add_argument("-c", "--output_code", required=False,
483 parser.add_argument("-R", "--default_ram_region", default='SRAM',
485 parser.add_argument("-v", "--verbose", action="count", default=0,
493 obj_filename = filename.split("/")[-1] + ".obj"
495 for dirpath, _, files in os.walk(searchpath):
496 for filename1 in files:
497 if filename1 == obj_filename:
498 if filename.split("/")[-2] in dirpath.split("/")[-1]:
505 # Returns a 4-tuple with them: (mem_region, program_header, flags, files)
506 # If no `program_header` is defined, returns an empty string
512 if mem_region.endswith(' '):
522 # Create a dict with key as memory type and files as a list of values.
530 if input_rel_dict == '':
531 sys.exit("Disable CONFIG_CODE_DATA_RELOCATION if no file needs relocation")
533 if ':' not in line:
539 if phdr != '':
546 if not glob_results:
547 warnings.warn("File: "+file_glob+" Not found")
552 if len(file_name_list) == 0:
554 if mem_region == '':
556 if args.verbose:
557 print("Memory region ", mem_region, " Selected for files:", file_name_list)
561 if mem_region in rel_dict:
581 # Create/or truncate file contents if it already exists
584 # for each memory_type, create text/rodata/data/bss sections for all obj files
585 for memory_type, files in rel_dict.items():
588 for filename in files:
590 # the obj file wasn't found. Probably not compiled.
591 if not obj_filename:
595 # Merge sections from file into collection of sections for all files
611 if "|COPY" in mem_type:
619 if __name__ == '__main__':