openc166 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. {openc166-0.2.0 → openc166-0.2.2}/CMakeLists.txt +1 -1
  2. {openc166-0.2.0 → openc166-0.2.2}/PKG-INFO +8 -3
  3. {openc166-0.2.0 → openc166-0.2.2}/README.md +7 -2
  4. {openc166-0.2.0 → openc166-0.2.2}/cli/main.cpp +18 -7
  5. {openc166-0.2.0 → openc166-0.2.2}/docs/debug-info.md +44 -0
  6. openc166-0.2.2/docs/ghidra.md +100 -0
  7. {openc166-0.2.0 → openc166-0.2.2}/docs/simulator.md +3 -0
  8. {openc166-0.2.0 → openc166-0.2.2}/include/openc166/openc166.h +11 -2
  9. {openc166-0.2.0 → openc166-0.2.2}/pyproject.toml +1 -0
  10. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/__init__.py +15 -0
  11. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/_native.py +1 -0
  12. openc166-0.2.2/python/openc166/ghidra.py +802 -0
  13. openc166-0.2.2/python/tests/test_elf.py +206 -0
  14. openc166-0.2.2/python/tests/test_ghidra.py +289 -0
  15. {openc166-0.2.0 → openc166-0.2.2}/src/CMakeLists.txt +3 -0
  16. {openc166-0.2.0 → openc166-0.2.2}/src/assembler.hpp +12 -0
  17. {openc166-0.2.0 → openc166-0.2.2}/src/capi.cpp +18 -0
  18. openc166-0.2.2/src/elf.cpp +502 -0
  19. {openc166-0.2.0 → openc166-0.2.2}/src/output.cpp +3 -5
  20. {openc166-0.2.0 → openc166-0.2.2}/.gitattributes +0 -0
  21. {openc166-0.2.0 → openc166-0.2.2}/.github/workflows/ci.yml +0 -0
  22. {openc166-0.2.0 → openc166-0.2.2}/.github/workflows/wheels.yml +0 -0
  23. {openc166-0.2.0 → openc166-0.2.2}/.gitignore +0 -0
  24. {openc166-0.2.0 → openc166-0.2.2}/LICENSE +0 -0
  25. {openc166-0.2.0 → openc166-0.2.2}/cli/CMakeLists.txt +0 -0
  26. {openc166-0.2.0 → openc166-0.2.2}/cmake/embed_files.cmake +0 -0
  27. {openc166-0.2.0 → openc166-0.2.2}/docs/compatibility.md +0 -0
  28. {openc166-0.2.0 → openc166-0.2.2}/docs/debugger-design.md +0 -0
  29. {openc166-0.2.0 → openc166-0.2.2}/docs/mpl.md +0 -0
  30. {openc166-0.2.0 → openc166-0.2.2}/docs/phase1-feasibility.md +0 -0
  31. {openc166-0.2.0 → openc166-0.2.2}/docs/releasing.md +0 -0
  32. {openc166-0.2.0 → openc166-0.2.2}/docs/tasking.md +0 -0
  33. {openc166-0.2.0 → openc166-0.2.2}/editors/vscode/README.md +0 -0
  34. {openc166-0.2.0 → openc166-0.2.2}/editors/vscode/extension.js +0 -0
  35. {openc166-0.2.0 → openc166-0.2.2}/editors/vscode/package.json +0 -0
  36. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/README.md +0 -0
  37. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/bsl_shim.a66 +0 -0
  38. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/driver_patch.a66 +0 -0
  39. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/kline_hello.a66 +0 -0
  40. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/loader.a66 +0 -0
  41. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/marker.a66 +0 -0
  42. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/memory_dump.a66 +0 -0
  43. {openc166-0.2.0 → openc166-0.2.2}/examples/mtos/stage2_hello.a66 +0 -0
  44. {openc166-0.2.0 → openc166-0.2.2}/examples/payload.a66 +0 -0
  45. {openc166-0.2.0 → openc166-0.2.2}/examples/sections.a66 +0 -0
  46. {openc166-0.2.0 → openc166-0.2.2}/inc/REG167.INC +0 -0
  47. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/bridge.py +0 -0
  48. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/dap.py +0 -0
  49. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/py.typed +0 -0
  50. {openc166-0.2.0 → openc166-0.2.2}/python/openc166/sim.py +0 -0
  51. {openc166-0.2.0 → openc166-0.2.2}/python/tests/test_bridge.py +0 -0
  52. {openc166-0.2.0 → openc166-0.2.2}/python/tests/test_dap.py +0 -0
  53. {openc166-0.2.0 → openc166-0.2.2}/python/tests/test_openc166.py +0 -0
  54. {openc166-0.2.0 → openc166-0.2.2}/python/tests/test_sim.py +0 -0
  55. {openc166-0.2.0 → openc166-0.2.2}/python/tests/test_stock_5wy19.py +0 -0
  56. {openc166-0.2.0 → openc166-0.2.2}/src/assembler.cpp +0 -0
  57. {openc166-0.2.0 → openc166-0.2.2}/src/bundled.cpp +0 -0
  58. {openc166-0.2.0 → openc166-0.2.2}/src/bundled.hpp +0 -0
  59. {openc166-0.2.0 → openc166-0.2.2}/src/capi.map +0 -0
  60. {openc166-0.2.0 → openc166-0.2.2}/src/capi_sim.cpp +0 -0
  61. {openc166-0.2.0 → openc166-0.2.2}/src/debuginfo.cpp +0 -0
  62. {openc166-0.2.0 → openc166-0.2.2}/src/diag.hpp +0 -0
  63. {openc166-0.2.0 → openc166-0.2.2}/src/disasm.cpp +0 -0
  64. {openc166-0.2.0 → openc166-0.2.2}/src/disasm.hpp +0 -0
  65. {openc166-0.2.0 → openc166-0.2.2}/src/disasm_module.cpp +0 -0
  66. {openc166-0.2.0 → openc166-0.2.2}/src/encode.cpp +0 -0
  67. {openc166-0.2.0 → openc166-0.2.2}/src/encode.hpp +0 -0
  68. {openc166-0.2.0 → openc166-0.2.2}/src/expr.cpp +0 -0
  69. {openc166-0.2.0 → openc166-0.2.2}/src/expr.hpp +0 -0
  70. {openc166-0.2.0 → openc166-0.2.2}/src/isa/c166.tbl +0 -0
  71. {openc166-0.2.0 → openc166-0.2.2}/src/isa/isa.cpp +0 -0
  72. {openc166-0.2.0 → openc166-0.2.2}/src/isa/isa.hpp +0 -0
  73. {openc166-0.2.0 → openc166-0.2.2}/src/isa/isa_types.hpp +0 -0
  74. {openc166-0.2.0 → openc166-0.2.2}/src/lexer.cpp +0 -0
  75. {openc166-0.2.0 → openc166-0.2.2}/src/lexer.hpp +0 -0
  76. {openc166-0.2.0 → openc166-0.2.2}/src/m166.cpp +0 -0
  77. {openc166-0.2.0 → openc166-0.2.2}/src/m166.hpp +0 -0
  78. {openc166-0.2.0 → openc166-0.2.2}/src/mpl.cpp +0 -0
  79. {openc166-0.2.0 → openc166-0.2.2}/src/mpl.hpp +0 -0
  80. {openc166-0.2.0 → openc166-0.2.2}/src/operand.cpp +0 -0
  81. {openc166-0.2.0 → openc166-0.2.2}/src/operand.hpp +0 -0
  82. {openc166-0.2.0 → openc166-0.2.2}/src/predef.cpp +0 -0
  83. {openc166-0.2.0 → openc166-0.2.2}/src/predef.hpp +0 -0
  84. {openc166-0.2.0 → openc166-0.2.2}/src/sim/boards.cpp +0 -0
  85. {openc166-0.2.0 → openc166-0.2.2}/src/sim/boards.hpp +0 -0
  86. {openc166-0.2.0 → openc166-0.2.2}/src/sim/cpu.cpp +0 -0
  87. {openc166-0.2.0 → openc166-0.2.2}/src/sim/debug.cpp +0 -0
  88. {openc166-0.2.0 → openc166-0.2.2}/src/sim/debug.hpp +0 -0
  89. {openc166-0.2.0 → openc166-0.2.2}/src/sim/machine.cpp +0 -0
  90. {openc166-0.2.0 → openc166-0.2.2}/src/sim/machine.hpp +0 -0
  91. {openc166-0.2.0 → openc166-0.2.2}/src/sim/peripherals.cpp +0 -0
  92. {openc166-0.2.0 → openc166-0.2.2}/src/sim/peripherals.hpp +0 -0
  93. {openc166-0.2.0 → openc166-0.2.2}/src/value.hpp +0 -0
  94. {openc166-0.2.0 → openc166-0.2.2}/tests/CMakeLists.txt +0 -0
  95. {openc166-0.2.0 → openc166-0.2.2}/tests/acceptance/minimon.py +0 -0
  96. {openc166-0.2.0 → openc166-0.2.2}/tests/capi/test_capi.c +0 -0
  97. {openc166-0.2.0 → openc166-0.2.2}/tests/check_binary.cmake +0 -0
  98. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/alignment.a66 +0 -0
  99. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/bit_section_errors.a66 +0 -0
  100. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/bit_sections.a66 +0 -0
  101. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/bits.a66 +0 -0
  102. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/branches.a66 +0 -0
  103. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/cond.a66 +0 -0
  104. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/cond_errors.a66 +0 -0
  105. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/controls.a66 +0 -0
  106. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/defs.a66 +0 -0
  107. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/directives.a66 +0 -0
  108. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/dpp.a66 +0 -0
  109. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/expressions.a66 +0 -0
  110. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/group_errors.a66 +0 -0
  111. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/groups.a66 +0 -0
  112. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/code.inc +0 -0
  113. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/comments.inc +0 -0
  114. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/count.inc +0 -0
  115. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/crlf.inc +0 -0
  116. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/ignored.inc +0 -0
  117. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/lit.inc +0 -0
  118. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/mpl.inc +0 -0
  119. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/nested.inc +0 -0
  120. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/noeol.inc +0 -0
  121. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/regs.inc +0 -0
  122. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/sub/deep.inc +0 -0
  123. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/inc/sub/level3.inc +0 -0
  124. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/include.a66 +0 -0
  125. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/label_errors.a66 +0 -0
  126. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/labels.a66 +0 -0
  127. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/bits/1main.a66 +0 -0
  128. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/bits/2lib.a66 +0 -0
  129. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/bits/3more.a66 +0 -0
  130. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/calls/1main.a66 +0 -0
  131. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/calls/2lib.a66 +0 -0
  132. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/combine/1first.a66 +0 -0
  133. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/combine/2second.a66 +0 -0
  134. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/combine/3third.a66 +0 -0
  135. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/fixups/1use.a66 +0 -0
  136. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/fixups/2def.a66 +0 -0
  137. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/groups/1main.a66 +0 -0
  138. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/groups/2lib.a66 +0 -0
  139. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/mixed/1seg.a66 +0 -0
  140. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/mixed/2flat.a66 +0 -0
  141. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/mixed/3seg.a66 +0 -0
  142. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/regbanks/1main.a66 +0 -0
  143. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/regbanks/2lib.a66 +0 -0
  144. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/sections/1first.a66 +0 -0
  145. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/sections/2second.a66 +0 -0
  146. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/sections/3third.a66 +0 -0
  147. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/segmented/1main.a66 +0 -0
  148. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/segmented/2lib.a66 +0 -0
  149. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/unresolved/1main.a66 +0 -0
  150. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/unresolved/2one.a66 +0 -0
  151. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/unresolved/3two.a66 +0 -0
  152. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/values/1use.a66 +0 -0
  153. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/link/values/2def.a66 +0 -0
  154. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/lit.a66 +0 -0
  155. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/lit_errors.a66 +0 -0
  156. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/locate.a66 +0 -0
  157. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/macro_args.a66 +0 -0
  158. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/macro_errors.a66 +0 -0
  159. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/macros.a66 +0 -0
  160. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl.a66 +0 -0
  161. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_exit.a66 +0 -0
  162. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_expr.a66 +0 -0
  163. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_fi.a66 +0 -0
  164. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_meta.a66 +0 -0
  165. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_paren.a66 +0 -0
  166. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_pattern.a66 +0 -0
  167. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_syntax.a66 +0 -0
  168. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/mpl_err_undefined.a66 +0 -0
  169. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/operands.a66 +0 -0
  170. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/primary.a66 +0 -0
  171. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/redefine.a66 +0 -0
  172. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/regbank_errors.a66 +0 -0
  173. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/regbanks.a66 +0 -0
  174. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/reloc.a66 +0 -0
  175. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/section_errors.a66 +0 -0
  176. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/section_length.a66 +0 -0
  177. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/segmented.a66 +0 -0
  178. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/type_operator_errors.a66 +0 -0
  179. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/cases/type_operators.a66 +0 -0
  180. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/gen_sweep.py +0 -0
  181. {openc166-0.2.0 → openc166-0.2.2}/tests/diff/keil_diff.py +0 -0
  182. {openc166-0.2.0 → openc166-0.2.2}/tests/expected/driver_patch.hex +0 -0
  183. {openc166-0.2.0 → openc166-0.2.2}/tests/expected/driver_patch.s28 +0 -0
  184. {openc166-0.2.0 → openc166-0.2.2}/tests/expected/payload.srec +0 -0
  185. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/helpers.hpp +0 -0
  186. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/main.cpp +0 -0
  187. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_assembler.cpp +0 -0
  188. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_bits.cpp +0 -0
  189. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_branches.cpp +0 -0
  190. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_cond.cpp +0 -0
  191. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_debug.cpp +0 -0
  192. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_defs.cpp +0 -0
  193. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_dpp.cpp +0 -0
  194. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_encode.cpp +0 -0
  195. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_expr.cpp +0 -0
  196. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_groups.cpp +0 -0
  197. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_include.cpp +0 -0
  198. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_lexer.cpp +0 -0
  199. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_link.cpp +0 -0
  200. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_lit.cpp +0 -0
  201. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_macros.cpp +0 -0
  202. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_mpl.cpp +0 -0
  203. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_output.cpp +0 -0
  204. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_peripherals.cpp +0 -0
  205. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_regbanks.cpp +0 -0
  206. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_sections.cpp +0 -0
  207. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_sim.cpp +0 -0
  208. {openc166-0.2.0 → openc166-0.2.2}/tests/unit/test_tasking.cpp +0 -0
  209. {openc166-0.2.0 → openc166-0.2.2}/third_party/doctest/LICENSE.txt +0 -0
  210. {openc166-0.2.0 → openc166-0.2.2}/third_party/doctest/doctest.h +0 -0
  211. {openc166-0.2.0 → openc166-0.2.2}/tools/CMakeLists.txt +0 -0
  212. {openc166-0.2.0 → openc166-0.2.2}/tools/ghidra/ExportOpenc166Symbols.py +0 -0
  213. {openc166-0.2.0 → openc166-0.2.2}/tools/isagen.cpp +0 -0
@@ -1,6 +1,6 @@
1
1
  cmake_minimum_required(VERSION 3.20)
2
2
  project(openc166
3
- VERSION 0.2.0
3
+ VERSION 0.2.2
4
4
  DESCRIPTION "Keil A166-compatible assembler for the Infineon C166/C167 family"
5
5
  LANGUAGES CXX)
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openc166
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Keil A166-compatible assembler for the Infineon C166/C167 microcontrollers
5
5
  Keywords: c166,c167,st10,assembler,keil,a166,infineon,ecu
6
6
  License-Expression: MIT
@@ -272,11 +272,16 @@ s.reverse_continue() # who last wrote 0E79EH?
272
272
  ```
273
273
 
274
274
  `python -m openc166.dap` is a Debug Adapter Protocol server for VS Code
275
- ([editors/vscode](editors/vscode/README.md)) and Neovim. `openc166-sim
275
+ ([editors/vscode](editors/vscode/README.md)) and Neovim, and
276
+ `python -m openc166.ghidra` is a back-end for Ghidra's Debugger
277
+ ([docs/ghidra.md](docs/ghidra.md)): debug stock firmware in your annotated
278
+ Ghidra program. `openc166-sim
276
279
  disasm` disassembles an image (or turns it into source that reassembles
277
280
  byte for byte), `openc166-sim run` runs firmware headless and lists the
278
281
  registers it touched that are not modelled yet, and `openc166 -g` writes
279
- debug information ([format](docs/debug-info.md)). See
282
+ debug information ([format](docs/debug-info.md)). `openc166 -o prog.elf`
283
+ writes an ELF file with DWARF line and symbol information for Ghidra,
284
+ readelf, objdump and other tools. See
280
285
  [docs/simulator.md](docs/simulator.md) for what is modelled and what is
281
286
  next.
282
287
 
@@ -249,11 +249,16 @@ s.reverse_continue() # who last wrote 0E79EH?
249
249
  ```
250
250
 
251
251
  `python -m openc166.dap` is a Debug Adapter Protocol server for VS Code
252
- ([editors/vscode](editors/vscode/README.md)) and Neovim. `openc166-sim
252
+ ([editors/vscode](editors/vscode/README.md)) and Neovim, and
253
+ `python -m openc166.ghidra` is a back-end for Ghidra's Debugger
254
+ ([docs/ghidra.md](docs/ghidra.md)): debug stock firmware in your annotated
255
+ Ghidra program. `openc166-sim
253
256
  disasm` disassembles an image (or turns it into source that reassembles
254
257
  byte for byte), `openc166-sim run` runs firmware headless and lists the
255
258
  registers it touched that are not modelled yet, and `openc166 -g` writes
256
- debug information ([format](docs/debug-info.md)). See
259
+ debug information ([format](docs/debug-info.md)). `openc166 -o prog.elf`
260
+ writes an ELF file with DWARF line and symbol information for Ghidra,
261
+ readelf, objdump and other tools. See
257
262
  [docs/simulator.md](docs/simulator.md) for what is modelled and what is
258
263
  next.
259
264
 
@@ -26,9 +26,10 @@ are combined.
26
26
 
27
27
  options:
28
28
  -o, --output FILE output file (default: the first SOURCE with the extension of the format)
29
- -f, --format FMT bin (raw binary), hex (Intel HEX) or srec (S-records); the
30
- default follows the output extension: .hex .h86 .ihx give hex,
31
- .srec .s19 .s28 .s37 .mot .sx give srec, anything else bin
29
+ -f, --format FMT bin (raw binary), hex (Intel HEX), srec (S-records) or elf (ELF
30
+ with DWARF debug information); the default follows the output
31
+ extension: .hex .h86 .ihx give hex, .srec .s19 .s28 .s37 .mot .sx
32
+ give srec, .elf .axf give elf, anything else bin
32
33
  -l, --listing FILE write a listing
33
34
  -g, --debug-info FILE
34
35
  write debug information (JSON) for the simulator and debugger
@@ -92,7 +93,7 @@ void write_file(const std::string& path, const char* data, std::size_t size) {
92
93
  throw std::runtime_error("cannot write '" + path + "'");
93
94
  }
94
95
 
95
- enum class Format { Bin, Hex, Srec };
96
+ enum class Format { Bin, Hex, Srec, Elf };
96
97
 
97
98
  std::string lower(std::string_view s) {
98
99
  std::string v(s);
@@ -153,8 +154,10 @@ int run(int argc, char** argv) {
153
154
  format = Format::Hex;
154
155
  else if (v == "srec" || v == "s19" || v == "mot")
155
156
  format = Format::Srec;
157
+ else if (v == "elf")
158
+ format = Format::Elf;
156
159
  else
157
- throw UsageError("unknown format '" + v + "' (use bin, hex or srec)");
160
+ throw UsageError("unknown format '" + v + "' (use bin, hex, srec or elf)");
158
161
  } else if (is("", "--record-size")) {
159
162
  std::int64_t n = parse_number(value(), "record size");
160
163
  if (n < 1 || n > 255) throw UsageError("record size must be 1..255");
@@ -213,6 +216,8 @@ int run(int argc, char** argv) {
213
216
  format = Format::Hex;
214
217
  else if (ext == ".srec" || ext == ".s19" || ext == ".s28" || ext == ".s37" || ext == ".mot" || ext == ".sx")
215
218
  format = Format::Srec;
219
+ else if (ext == ".elf" || ext == ".axf")
220
+ format = Format::Elf;
216
221
  else
217
222
  format = Format::Bin;
218
223
  }
@@ -221,7 +226,10 @@ int run(int argc, char** argv) {
221
226
  srec_address_size = ext == ".s19" ? 2 : ext == ".s28" ? 3 : ext == ".s37" ? 4 : 0;
222
227
  }
223
228
  if (output.empty())
224
- output = replace_extension(inputs.front(), *format == Format::Hex ? ".hex" : *format == Format::Srec ? ".srec" : ".bin");
229
+ output = replace_extension(inputs.front(), *format == Format::Hex ? ".hex"
230
+ : *format == Format::Srec ? ".srec"
231
+ : *format == Format::Elf ? ".elf"
232
+ : ".bin");
225
233
 
226
234
  std::vector<oc166::Source> sources;
227
235
  for (const auto& input : inputs) sources.push_back({input, read_file(input)});
@@ -242,7 +250,10 @@ int run(int argc, char** argv) {
242
250
  << " warning(s); no output written\n";
243
251
  return 1;
244
252
  }
245
- if (*format == Format::Bin) {
253
+ if (*format == Format::Elf) {
254
+ std::vector<std::uint8_t> elf = oc166::format_elf(result);
255
+ write_file(output, reinterpret_cast<const char*>(elf.data()), elf.size());
256
+ } else if (*format == Format::Bin) {
246
257
  oc166::FlatImage image = oc166::flat_image(result, base, fill);
247
258
  write_file(output, reinterpret_cast<const char*>(image.bytes.data()), image.bytes.size());
248
259
  } else {
@@ -60,3 +60,47 @@ order:
60
60
 
61
61
  Lines in false IF blocks, and lines that emit no bytes, are left out. Bits
62
62
  of BIT sections are not lines.
63
+
64
+ ## ELF with DWARF
65
+
66
+ `openc166 -o prog.elf prog.a66` (or `-f elf`, `oc166_result_elf()`,
67
+ `Result.elf()`) writes the program as an ELF executable for the C166, with
68
+ the same information in the standard formats:
69
+
70
+ - ELF32, little endian, `ET_EXEC`, machine `EM_C166` (116; readelf calls it
71
+ "Infineon Technologies xc16x"), entry 0.
72
+ - One `PT_LOAD` segment per run of consecutive bytes, read/execute for
73
+ code and constants, read/write for data. Sections are named after the
74
+ assembler's sections; bytes outside any section go into `.abs_XXXXXX`.
75
+ - `.symtab`: a `STT_FILE` per module and every label, `GLOBAL` if PUBLIC
76
+ or GLOBAL, as `STT_OBJECT` with a size for BYTE, WORD and DWORD labels.
77
+ EQU and SET values, bits and registers are not ELF symbols (the JSON
78
+ debug information has them).
79
+ - DWARF 4: a compile unit per module (`DW_LANG_Mips_Assembler`, the
80
+ closest DWARF has to "assembler") with a `DW_TAG_label` for each label,
81
+ `.debug_line`, `.debug_aranges` and `.debug_ranges`. In the line table,
82
+ code from a macro, REPT, IRP or IRPC maps to the line of the body, as a
83
+ compiler maps inlined code; the call site is in the JSON debug
84
+ information. Include files are files of the table under their names as
85
+ the assembler opened them.
86
+
87
+ readelf, objdump (`--dwarf=decodedline`) and even a gdb without C166
88
+ support (`info line *0xE002`, `list LABEL`) read it.
89
+
90
+ ### Ghidra
91
+
92
+ Ghidra's ELF loader picks the language from the processor module's
93
+ `.opinion` file. The C166 module (`c166-ghidra-module`) has none yet, so
94
+ choose the language by hand when importing, or add to its
95
+ `data/languages/c166.opinion`:
96
+
97
+ ```xml
98
+ <opinions>
99
+ <constraint loader="Executable and Linking Format (ELF)" compilerSpecID="tasking">
100
+ <constraint primary="116" processor="Infineon C167CR" size="16" variant="C167CR" />
101
+ </constraint>
102
+ </opinions>
103
+ ```
104
+
105
+ The import then has the memory blocks, the labels and, with the DWARF
106
+ analyzer, the source lines.
@@ -0,0 +1,100 @@
1
+ # Debugging in Ghidra
2
+
3
+ openc166 is a back-end for Ghidra's Debugger (Trace RMI, Ghidra 11 and
4
+ later): the firmware runs in the openc166 simulator and Ghidra drives it.
5
+ You get Ghidra's dynamic listing following the program counter in your
6
+ annotated program, the registers, memory, breakpoints and watchpoints set
7
+ from the listing, stepping, and stepping and running backwards.
8
+
9
+ ## Setup
10
+
11
+ 1. Install the C166 processor module (`c166-ghidra-module`) into Ghidra, as
12
+ for static analysis.
13
+ 2. Install openc166 into a Python 3.10 or later that has a protobuf at
14
+ least as new as the one Ghidra's client was generated with (Ghidra 12.2:
15
+ protobuf 6.31): `pip install openc166 protobuf`.
16
+ 3. Add the launcher to Ghidra, with that Python:
17
+
18
+ ```
19
+ python3 -m openc166.ghidra --install-launcher /path/to/ghidra_12.2_PUBLIC
20
+ ```
21
+
22
+ This writes a small extension (`openc166-debugger`, holding only the
23
+ launcher) into the user Extensions directory of that Ghidra, with the
24
+ Python that ran the command as the launcher's default. Restart Ghidra.
25
+
26
+ ## Use
27
+
28
+ Open the firmware program in the Debugger tool. In the launch menu choose
29
+ **openc166 simulator** and set:
30
+
31
+ | Option | Meaning |
32
+ |---|---|
33
+ | Image | the flash or ROM image: by default the program's own file |
34
+ | Board | `5wy19`, `c167cs`, `c167` or `c166` |
35
+ | Symbols | optional: an export from `tools/ghidra/ExportOpenc166Symbols.py`, for frame names |
36
+ | A/D inputs | `CH=VALUE` pairs; the 5WY19 resets itself unless channel 1 reads above 0C4H |
37
+ | Boot mode | 5WY19: erase the application signature so the boot block runs |
38
+ | Freeze watchdog | the watchdog never resets the CPU |
39
+
40
+ The trace starts at the reset vector, stopped. Then:
41
+
42
+ - **Resume**, **Interrupt**, **Step Into** (one instruction; an EXT or
43
+ ATOMIC sequence counts as one), **Step Over**, **Step Out**.
44
+ - **Step Back** and **Resume Back** (in the step menu): the simulator goes
45
+ back by restoring a snapshot and re-running, so the history is exact.
46
+ Resume Back runs to the previous breakpoint or watchpoint hit; with a
47
+ write watchpoint that answers "who last wrote this?".
48
+ - Breakpoints from the listing (software and hardware breakpoints are the
49
+ same thing here), and read, write and access watchpoints on any range,
50
+ SFRs included. Toggle and delete them in the Breakpoints window.
51
+ - **Kill** resets the simulated CPU (power-on reset); the trace stays.
52
+ - Writes to registers and memory go into the simulator (into the flash
53
+ image too) and clear the reverse-execution history.
54
+
55
+ Each stop is a snapshot in Ghidra's Time window, named after why it
56
+ stopped (`breakpoint 1 at 0882D0`, `write 00E79E = 0000 (was 5555)`, ...).
57
+
58
+ ### What the trace holds
59
+
60
+ - Registers as the C166 module names them: `r0`..`r15`, `IP`, `CSP`, `PSW`,
61
+ `DPP0`..`DPP3`. Other SFRs are memory, as in the module.
62
+ - The program counter of the frame as the full `CSP:IP` address (the
63
+ module's `IP` alone is 16 bits).
64
+ - Internal RAM and the SFR areas (0F000H..0FFFFH) at every stop; other
65
+ memory when Ghidra reads it.
66
+ - The memory map from the simulator's bus: flash, internal RAM, ESFR and
67
+ SFR areas, XRAM and the X-peripherals once enabled, the chip-select
68
+ windows the firmware programs. It is checked again at every stop.
69
+ - A module named after the image, so Ghidra maps the trace onto the open
70
+ program of that name, address for address: your labels and comments
71
+ appear in the dynamic listing.
72
+
73
+ ### Without the launcher
74
+
75
+ In the Debugger, use **Connect via Trace RMI → Accept a single inbound
76
+ connection**, then run
77
+
78
+ ```
79
+ python3 -m openc166.ghidra firmware.bin --board 5wy19 --adc 1=0x2A0 \
80
+ --ghidra /path/to/ghidra_12.2_PUBLIC --connect 127.0.0.1:PORT
81
+ ```
82
+
83
+ or start it with `--listen PORT` and use **Connect to outbound**.
84
+
85
+ ## Limits
86
+
87
+ - One stack frame: there is no call stack yet.
88
+ - The simulator runs in the Python process the launcher starts; the K-line
89
+ bridge (`openc166-sim serve`) is a separate process, so you cannot yet
90
+ break while gkflasher talks to the ECU.
91
+ - Tested against a stand-in for Ghidra's Trace RMI server that uses
92
+ Ghidra 12.2's own protocol definitions (python/tests/test_ghidra.py),
93
+ and through the launcher script; the Debugger GUI itself is not covered
94
+ by the tests.
95
+
96
+ ## ELF and DWARF
97
+
98
+ `openc166 -o prog.elf` writes code assembled with openc166 as ELF with DWARF
99
+ line information (see [debug-info.md](debug-info.md)); import it into Ghidra
100
+ for source lines next to the listing.
@@ -46,6 +46,9 @@ openc166 -g payload.json payload.a66 # debug information for the debugger
46
46
  firmware touched that nothing models yet, grouped by register: that list
47
47
  is the modelling to-do (design §3.5).
48
48
 
49
+ Ghidra: `python -m openc166.ghidra` is a back-end for Ghidra's Debugger;
50
+ see [ghidra.md](ghidra.md).
51
+
49
52
  Editors: `python -m openc166.dap` is a Debug Adapter Protocol server;
50
53
  [editors/vscode](../editors/vscode/README.md) registers it with VS Code
51
54
  and shows a launch configuration. Step back and reverse continue work
@@ -207,8 +207,8 @@ OC166_API const char *oc166_result_intel_hex(oc166_result *r, int record_size);
207
207
  * The text stays valid until the next oc166_result_srec() call on 'r'. */
208
208
  OC166_API const char *oc166_result_srec(oc166_result *r, int record_size, int address_size);
209
209
 
210
- /* Message of the last failed oc166_result_image(), oc166_result_intel_hex()
211
- * or oc166_result_srec() call, or "". */
210
+ /* Message of the last failed oc166_result_image(), oc166_result_intel_hex(),
211
+ * oc166_result_srec() or oc166_result_elf() call, or "". */
212
212
  OC166_API const char *oc166_result_last_error(const oc166_result *r);
213
213
 
214
214
  /* ---- Listing ----------------------------------------------------------- */
@@ -217,6 +217,15 @@ OC166_API const char *oc166_result_last_error(const oc166_result *r);
217
217
  * same text as "openc166 -l". Returns NULL if out of memory. */
218
218
  OC166_API const char *oc166_result_listing(oc166_result *r);
219
219
 
220
+ /* ---- ELF --------------------------------------------------------------- */
221
+
222
+ /* The program as an ELF executable for the C166 (EM_C166) with DWARF 4
223
+ * debug information: a loadable segment per run of bytes, sections named
224
+ * after the assembler sections, the labels in .symtab and in .debug_info,
225
+ * and a .debug_line table. Returns a pointer to 'size' bytes, valid until
226
+ * the next call on 'r', or NULL; then oc166_result_last_error() says why. */
227
+ OC166_API const uint8_t *oc166_result_elf(oc166_result *r, size_t *size);
228
+
220
229
  /* ---- Debug information ------------------------------------------------- */
221
230
 
222
231
  /* Debug information as JSON text (UTF-8): files, sections, symbols, and for
@@ -28,6 +28,7 @@ classifiers = [
28
28
  [project.scripts]
29
29
  openc166-sim = "openc166.sim:main"
30
30
  openc166-dap = "openc166.dap:main"
31
+ openc166-ghidra = "openc166.ghidra:main"
31
32
 
32
33
  [project.urls]
33
34
  Homepage = "https://github.com/Dante383/openc166"
@@ -320,6 +320,21 @@ class Result:
320
320
  self._listing = _text(text)
321
321
  return self._listing
322
322
 
323
+ def elf(self) -> bytes:
324
+ """The program as an ELF file for the C166 (EM_C166) with DWARF 4
325
+ debug information: loadable segments, sections named after the
326
+ assembler sections, the labels as symbols, and a line table. Ghidra,
327
+ readelf and objdump read it. Raises AssemblyError if the source has
328
+ errors."""
329
+ if not self.ok:
330
+ raise AssemblyError(self)
331
+ size = ctypes.c_size_t()
332
+ with self._lock:
333
+ p = _lib.oc166_result_elf(self._handle, ctypes.byref(size))
334
+ if not p:
335
+ raise ValueError(_text(_lib.oc166_result_last_error(self._handle)))
336
+ return ctypes.string_at(p, size.value)
337
+
323
338
  def debug_info(self) -> dict:
324
339
  """Debug information for the simulator and debugger, as parsed JSON.
325
340
 
@@ -163,6 +163,7 @@ _declare("oc166_result_srec", _str, _p, _int, _int)
163
163
  _declare("oc166_result_last_error", _str, _p)
164
164
  _declare("oc166_result_listing", _str, _p)
165
165
  _declare("oc166_result_debug_info", _str, _p)
166
+ _declare("oc166_result_elf", ctypes.POINTER(ctypes.c_uint8), _p, ctypes.POINTER(_size))
166
167
  _declare("oc166_result_symbol_count", _size, _p)
167
168
  _declare("oc166_result_symbol", _int, _p, _size, ctypes.POINTER(Symbol))
168
169
  _declare("oc166_result_section_count", _size, _p)