1# SPDX-License-Identifier: Apache-2.0 2# 3# - elfconvert : Name of command for elf file conversion. 4# In this implementation `objcopy` is used 5# elfconvert_formats : Formats supported: ihex, srec, binary 6# elfconvert_flag : empty 7# elfconvert_flag_final : empty 8# elfconvert_flag_strip_all : -S 9# elfconvert_flag_strip_debug : -g 10# elfconvert_flag_compress_debug_sections: --compress-debug-sections 11# elfconvert_flag_intarget : --input-target= 12# elfconvert_flag_outtarget : --output-target= 13# elfconvert_flag_section_remove: --remove-section= 14# elfconvert_flag_section_only : --only-section= 15# elfconvert_flag_section_rename: --rename-section; 16# elfconvert_flag_gapfill : --gap-fill; 17# Note: The ';' will be transformed into an 18# empty space when executed 19# elfconvert_flag_srec_len : --srec-len= 20# elfconvert_flag_infile : empty, objcopy doesn't take arguments for filenames 21# elfconvert_flag_outfile : empty, objcopy doesn't take arguments for filenames 22# 23 24# elfconvert to use for transforming an elf file into another format, 25# such as intel hex, s-rec, binary, etc. 26set_property(TARGET bintools PROPERTY elfconvert_command ${CMAKE_OBJCOPY}) 27 28# List of format the tool supports for converting, for example, 29# GNU tools uses objectcopy, which supports the following: ihex, srec, binary 30set_property(TARGET bintools PROPERTY elfconvert_formats ihex srec binary) 31 32set_property(TARGET bintools PROPERTY elfconvert_flag "") 33set_property(TARGET bintools PROPERTY elfconvert_flag_final "") 34 35set_property(TARGET bintools PROPERTY elfconvert_flag_strip_all "-S") 36set_property(TARGET bintools PROPERTY elfconvert_flag_strip_debug "-g") 37 38set_property(TARGET bintools PROPERTY elfconvert_flag_compress_debug_sections "--compress-debug-sections") 39 40set_property(TARGET bintools PROPERTY elfconvert_flag_intarget "--input-target=") 41set_property(TARGET bintools PROPERTY elfconvert_flag_outtarget "--output-target=") 42 43set_property(TARGET bintools PROPERTY elfconvert_flag_section_remove "--remove-section=") 44set_property(TARGET bintools PROPERTY elfconvert_flag_section_only "--only-section=") 45set_property(TARGET bintools PROPERTY elfconvert_flag_section_rename "--rename-section;") 46 47# llvm-objcopy doesn't support gap fill argument. 48set_property(TARGET bintools PROPERTY elfconvert_flag_gapfill "") 49set_property(TARGET bintools PROPERTY elfconvert_flag_srec_len "--srec-len=") 50 51set_property(TARGET bintools PROPERTY elfconvert_flag_infile "") 52set_property(TARGET bintools PROPERTY elfconvert_flag_outfile "") 53 54# 55# - disassembly : Name of command for disassembly of files 56# In this implementation `objdump` is used 57# disassembly_flag : -d 58# disassembly_flag_final : empty 59# disassembly_flag_inline_source : -S 60# disassembly_flag_all : -SDz 61# disassembly_flag_infile : empty, objdump doesn't take arguments for filenames 62# disassembly_flag_outfile : '>', objdump doesn't take arguments for output file, but result is printed to standard out, and is redirected. 63 64set_property(TARGET bintools PROPERTY disassembly_command ${CMAKE_OBJDUMP}) 65set_property(TARGET bintools PROPERTY disassembly_flag -d) 66set_property(TARGET bintools PROPERTY disassembly_flag_final "") 67set_property(TARGET bintools PROPERTY disassembly_flag_inline_source "") 68set_property(TARGET bintools PROPERTY disassembly_flag_all "") 69 70set_property(TARGET bintools PROPERTY disassembly_flag_infile "") 71set_property(TARGET bintools PROPERTY disassembly_flag_outfile ">;" ) 72 73# 74# - symbols : Name of command for printing out symbols 75# symbols_command : empty 76# symbols_final : empty 77# symbols_infile : ELF file name 78# symbols_outfile : output file 79set_property(TARGET bintools PROPERTY symbols_command ${CMAKE_NM}) 80set_property(TARGET bintools PROPERTY symbols_flag "") 81set_property(TARGET bintools PROPERTY symbols_final "") 82set_property(TARGET bintools PROPERTY symbols_infile "") 83set_property(TARGET bintools PROPERTY symbols_outfile ">;" ) 84 85# 86# - strip: Name of command for stripping symbols 87# In this implementation `strip` is used 88# strip_flag : empty 89# strip_flag_final : empty 90# strip_flag_all : --strip-all 91# strip_flag_debug : --strip-debug 92# strip_flag_dwo : --strip-dwo 93# strip_flag_infile : empty, strip doesn't take arguments for input file 94# strip_flag_outfile : -o 95 96# This is using strip from bintools. 97set_property(TARGET bintools PROPERTY strip_command ${CMAKE_STRIP}) 98 99# Any flag the strip command requires for processing 100set_property(TARGET bintools PROPERTY strip_flag "") 101set_property(TARGET bintools PROPERTY strip_flag_final "") 102 103set_property(TARGET bintools PROPERTY strip_flag_all --strip-all) 104set_property(TARGET bintools PROPERTY strip_flag_debug --strip-debug) 105set_property(TARGET bintools PROPERTY strip_flag_dwo --strip-dwo) 106 107set_property(TARGET bintools PROPERTY strip_flag_infile "") 108set_property(TARGET bintools PROPERTY strip_flag_outfile -o ) 109 110# 111# - readelf : Name of command for reading elf files. 112# In this implementation `readelf` is used 113# readelf_flag : empty 114# readelf_flag_final : empty 115# readelf_flag_headers : -e 116# readelf_flag_infile : empty, readelf doesn't take arguments for filenames 117# readelf_flag_outfile : '>', readelf doesn't take arguments for output 118# file, but result is printed to standard out, and 119# is redirected. 120 121# This is using readelf from bintools. 122set_property(TARGET bintools PROPERTY readelf_command ${CMAKE_READELF}) 123 124set_property(TARGET bintools PROPERTY readelf_flag "") 125set_property(TARGET bintools PROPERTY readelf_flag_final "") 126set_property(TARGET bintools PROPERTY readelf_flag_headers -e) 127 128set_property(TARGET bintools PROPERTY readelf_flag_infile "") 129set_property(TARGET bintools PROPERTY readelf_flag_outfile ">;" ) 130 131# Example on how to support dwarfdump instead of readelf 132#set_property(TARGET bintools PROPERTY readelf_command dwarfdump) 133#set_property(TARGET bintools PROPERTY readelf_flag "") 134#set_property(TARGET bintools PROPERTY readelf_flag_headers -E) 135#set_property(TARGET bintools PROPERTY readelf_flag_infile "") 136#set_property(TARGET bintools PROPERTY readelf_flag_outfile "-O file=" ) 137