target_bintools.cmake 5.8 KB

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