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