1# - memusage: Name of command for memusage
2#             In this implementation `sizeac` is used
3set_property(TARGET bintools PROPERTY memusage_command "${CMAKE_SIZE}")
4set_property(TARGET bintools PROPERTY memusage_flag "-gq")
5set_property(TARGET bintools PROPERTY memusage_infile "")
6
7
8# List of format the tool supports for converting, for example,
9# GNU tools uses objectcopy, which supports the following: ihex, srec, binary
10set_property(TARGET bintools PROPERTY elfconvert_formats ihex srec binary)
11
12# MWDT toolchain does not support all options in a single command
13# Therefore a CMake script is used, so that multiple commands can be executed
14# successively.
15set_property(TARGET bintools PROPERTY elfconvert_command ${CMAKE_COMMAND})
16
17set_property(TARGET bintools PROPERTY elfconvert_flag
18                                      -DELF2HEX=${CMAKE_ELF2HEX}
19                                      -DELF2BIN=${CMAKE_ELF2BIN}
20                                      -DSTRIP=${CMAKE_STRIP}
21                                      -DOBJCOPY=${CMAKE_OBJCOPY}
22)
23
24set_property(TARGET bintools PROPERTY elfconvert_flag_final
25                                      -P ${CMAKE_CURRENT_LIST_DIR}/elfconvert_command.cmake)
26
27set_property(TARGET bintools PROPERTY elfconvert_flag_strip_all "-DSTRIP_ALL=True")
28set_property(TARGET bintools PROPERTY elfconvert_flag_strip_debug "-DSTRIP_DEBUG=True")
29
30set_property(TARGET bintools PROPERTY elfconvert_flag_intarget "-DINTARGET=")
31set_property(TARGET bintools PROPERTY elfconvert_flag_outtarget "-DOUTTARGET=")
32
33set_property(TARGET bintools PROPERTY elfconvert_flag_section_remove "-DREMOVE_SECTION=")
34set_property(TARGET bintools PROPERTY elfconvert_flag_section_only "-DONLY_SECTION=")
35
36# mwdt doesn't handle rename, consider adjusting abstraction.
37set_property(TARGET bintools PROPERTY elfconvert_flag_section_rename "-DRENAME_SECTION=")
38
39set_property(TARGET bintools PROPERTY elfconvert_flag_gapfill "-DGAP_FILL=")
40set_property(TARGET bintools PROPERTY elfconvert_flag_srec_len "-DSREC_LEN=")
41
42set_property(TARGET bintools PROPERTY elfconvert_flag_infile "-DINFILE=")
43set_property(TARGET bintools PROPERTY elfconvert_flag_outfile "-DOUTFILE=")
44
45# - disassembly : Name of command for disassembly of files
46#                 In this implementation `elfdumpac` is used
47#   disassembly_flag               : -T
48#   disassembly_flag_final         : empty
49#   disassembly_flag_inline_source : -S
50#   disassembly_flag_all           : empty
51#   disassembly_flag_infile        : empty
52#   disassembly_flag_outfile       : '>'
53set_property(TARGET bintools PROPERTY disassembly_command ${CMAKE_OBJDUMP})
54set_property(TARGET bintools PROPERTY disassembly_flag -T)
55set_property(TARGET bintools PROPERTY disassembly_flag_final "")
56set_property(TARGET bintools PROPERTY disassembly_flag_inline_source -S)
57set_property(TARGET bintools PROPERTY disassembly_flag_all "") # No support for all ?
58
59set_property(TARGET bintools PROPERTY disassembly_flag_infile "")
60set_property(TARGET bintools PROPERTY disassembly_flag_outfile > )
61
62#
63# - readelf : Name of command for reading elf files.
64#             In this implementation `elfdumpac ` is used
65#   readelf_flag          : empty
66#   readelf_flag_final    : empty
67#   readelf_flag_headers  : -qshp
68#   readelf_flag_infile   : empty
69#   readelf_flag_outfile  : '>'
70
71# This is using elfdumpac from mwdt.
72set_property(TARGET bintools PROPERTY readelf_command ${CMAKE_READELF})
73
74set_property(TARGET bintools PROPERTY readelf_flag "")
75set_property(TARGET bintools PROPERTY readelf_flag_final "")
76set_property(TARGET bintools PROPERTY readelf_flag_headers -qshp)
77
78set_property(TARGET bintools PROPERTY readelf_flag_infile "")
79set_property(TARGET bintools PROPERTY readelf_flag_outfile > )
80
81#
82# - strip: Name of command for stripping symbols
83#          In this implementation `stripac` is used
84#   strip_flag         : empty
85#   strip_flag_final   : empty
86#   strip_flag_all     : -qls
87#   strip_flag_debug   : -ql
88#   strip_flag_dwo     : empty
89#   strip_flag_infile  : empty
90#   strip_flag_outfile : -o
91
92# This is using strip from bintools.
93set_property(TARGET bintools PROPERTY strip_command ${CMAKE_STRIP})
94
95# Any flag the strip command requires for processing
96set_property(TARGET bintools PROPERTY strip_flag "")
97set_property(TARGET bintools PROPERTY strip_flag_final "")
98
99set_property(TARGET bintools PROPERTY strip_flag_all -qls)
100set_property(TARGET bintools PROPERTY strip_flag_debug -ql)
101
102set_property(TARGET bintools PROPERTY strip_flag_infile "")
103set_property(TARGET bintools PROPERTY strip_flag_outfile -o )
104
105# list symbols in a binary
106set_property(TARGET bintools PROPERTY symbols_command ${CMAKE_NM})
107# flags are set to be as close to gnu nm format as possible
108set_property(TARGET bintools PROPERTY symbols_flag "-xhpqgn")
109set_property(TARGET bintools PROPERTY symbols_final "")
110set_property(TARGET bintools PROPERTY symbols_infile "")
111set_property(TARGET bintools PROPERTY symbols_outfile ">;" )
112