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