openc166 0.2.0__tar.gz → 0.2.5__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.
- {openc166-0.2.0 → openc166-0.2.5}/CMakeLists.txt +1 -1
- {openc166-0.2.0 → openc166-0.2.5}/PKG-INFO +8 -3
- {openc166-0.2.0 → openc166-0.2.5}/README.md +7 -2
- {openc166-0.2.0 → openc166-0.2.5}/cli/main.cpp +18 -7
- {openc166-0.2.0 → openc166-0.2.5}/docs/compatibility.md +58 -14
- {openc166-0.2.0 → openc166-0.2.5}/docs/debug-info.md +44 -0
- openc166-0.2.5/docs/ghidra.md +100 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/simulator.md +3 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/tasking.md +1 -1
- {openc166-0.2.0 → openc166-0.2.5}/include/openc166/openc166.h +11 -2
- {openc166-0.2.0 → openc166-0.2.5}/pyproject.toml +1 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/__init__.py +15 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/_native.py +1 -0
- openc166-0.2.5/python/openc166/ghidra.py +802 -0
- openc166-0.2.5/python/tests/test_elf.py +206 -0
- openc166-0.2.5/python/tests/test_ghidra.py +289 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/CMakeLists.txt +3 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/assembler.cpp +201 -34
- {openc166-0.2.0 → openc166-0.2.5}/src/assembler.hpp +32 -2
- {openc166-0.2.0 → openc166-0.2.5}/src/capi.cpp +18 -0
- openc166-0.2.5/src/elf.cpp +502 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/output.cpp +3 -5
- {openc166-0.2.0 → openc166-0.2.5}/tests/CMakeLists.txt +1 -0
- openc166-0.2.5/tests/diff/cases/listing.a66 +32 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_cond.cpp +33 -0
- openc166-0.2.5/tests/unit/test_listing.cpp +162 -0
- {openc166-0.2.0 → openc166-0.2.5}/.gitattributes +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/.github/workflows/ci.yml +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/.github/workflows/wheels.yml +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/.gitignore +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/LICENSE +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/cli/CMakeLists.txt +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/cmake/embed_files.cmake +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/debugger-design.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/mpl.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/phase1-feasibility.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/docs/releasing.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/editors/vscode/README.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/editors/vscode/extension.js +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/editors/vscode/package.json +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/README.md +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/bsl_shim.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/driver_patch.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/kline_hello.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/loader.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/marker.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/memory_dump.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/mtos/stage2_hello.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/payload.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/examples/sections.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/inc/REG167.INC +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/bridge.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/dap.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/py.typed +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/openc166/sim.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/tests/test_bridge.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/tests/test_dap.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/tests/test_openc166.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/tests/test_sim.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/python/tests/test_stock_5wy19.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/bundled.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/bundled.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/capi.map +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/capi_sim.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/debuginfo.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/diag.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/disasm.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/disasm.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/disasm_module.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/encode.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/encode.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/expr.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/expr.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/isa/c166.tbl +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/isa/isa.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/isa/isa.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/isa/isa_types.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/lexer.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/lexer.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/m166.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/m166.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/mpl.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/mpl.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/operand.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/operand.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/predef.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/predef.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/boards.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/boards.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/cpu.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/debug.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/debug.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/machine.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/machine.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/peripherals.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/sim/peripherals.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/src/value.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/acceptance/minimon.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/capi/test_capi.c +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/check_binary.cmake +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/alignment.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/bit_section_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/bit_sections.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/bits.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/branches.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/cond.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/cond_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/controls.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/defs.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/directives.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/dpp.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/expressions.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/group_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/groups.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/code.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/comments.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/count.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/crlf.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/ignored.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/lit.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/mpl.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/nested.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/noeol.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/regs.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/sub/deep.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/inc/sub/level3.inc +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/include.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/label_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/labels.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/bits/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/bits/2lib.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/bits/3more.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/calls/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/calls/2lib.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/combine/1first.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/combine/2second.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/combine/3third.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/fixups/1use.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/fixups/2def.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/groups/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/groups/2lib.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/mixed/1seg.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/mixed/2flat.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/mixed/3seg.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/regbanks/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/regbanks/2lib.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/sections/1first.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/sections/2second.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/sections/3third.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/segmented/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/segmented/2lib.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/unresolved/1main.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/unresolved/2one.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/unresolved/3two.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/values/1use.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/link/values/2def.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/lit.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/lit_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/locate.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/macro_args.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/macro_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/macros.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_exit.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_expr.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_fi.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_meta.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_paren.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_pattern.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_syntax.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/mpl_err_undefined.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/operands.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/primary.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/redefine.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/regbank_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/regbanks.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/reloc.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/section_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/section_length.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/segmented.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/type_operator_errors.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/cases/type_operators.a66 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/gen_sweep.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/diff/keil_diff.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/expected/driver_patch.hex +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/expected/driver_patch.s28 +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/expected/payload.srec +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/helpers.hpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/main.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_assembler.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_bits.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_branches.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_debug.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_defs.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_dpp.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_encode.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_expr.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_groups.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_include.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_lexer.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_link.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_lit.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_macros.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_mpl.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_output.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_peripherals.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_regbanks.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_sections.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_sim.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tests/unit/test_tasking.cpp +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/third_party/doctest/LICENSE.txt +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/third_party/doctest/doctest.h +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tools/CMakeLists.txt +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tools/ghidra/ExportOpenc166Symbols.py +0 -0
- {openc166-0.2.0 → openc166-0.2.5}/tools/isagen.cpp +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openc166
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
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
|
|
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)).
|
|
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
|
|
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)).
|
|
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)
|
|
30
|
-
|
|
31
|
-
.srec .s19 .s28 .s37 .mot .sx
|
|
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
|
|
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
|
|
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::
|
|
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 {
|
|
@@ -76,13 +76,15 @@ since OH166 starts a new record at each section.
|
|
|
76
76
|
banks are placed as L166 places them), `NAME`, `SSKDEF`, `PECDEF` and
|
|
77
77
|
`TYPEDEC`, with Keil's error checks. See
|
|
78
78
|
[Register banks and linker directives](#register-banks-and-linker-directives).
|
|
79
|
-
- **Accepted and ignored:**
|
|
80
|
-
`$
|
|
81
|
-
|
|
79
|
+
- **Accepted and ignored:** object-file controls such as `$DEBUG` and
|
|
80
|
+
`$OBJECT`, and `$PRINT`/`$NOPRINT`: the command line says which files
|
|
81
|
+
are written.
|
|
82
82
|
- **Controls:** `$MOD167`, `$MOD166`/`$NOMOD166`, `$CASE`/`$NOCASE`,
|
|
83
83
|
`$SEGMENTED`/`$NONSEGMENTED`, `$TABS`, `$MACRO`/`$NOMACRO`,
|
|
84
|
-
`$MPL`/`$NOMPL`, `$GEN`/`$NOGEN`/`$GENONLY`, `$
|
|
85
|
-
`$
|
|
84
|
+
`$MPL`/`$NOMPL`, `$GEN`/`$NOGEN`/`$GENONLY`, `$LIST`/`$NOLIST`,
|
|
85
|
+
`$SAVE`/`$RESTORE`, and the [listing controls](#listing-controls)
|
|
86
|
+
`$TITLE`, `$EJECT`, `$PAGING`, `$PAGELENGTH`, `$PAGEWIDTH`,
|
|
87
|
+
`$SYMBOLS`, `$SYMLIST` and `$XREF`. `$MODV2` falls back to the C167 set, with warning OC2. Some controls must
|
|
86
88
|
come before the first statement; see [Controls](#controls).
|
|
87
89
|
|
|
88
90
|
## Not supported yet
|
|
@@ -232,17 +234,18 @@ Keil has two kinds of `$` controls:
|
|
|
232
234
|
Primary controls that openc166 uses: `MOD167`/`M167`, `MOD166`/`M166`,
|
|
233
235
|
`NOMOD166`/`NOM166`, `MODV2`, `CASE`, `NOCASE`, `INCDIR`/`ID`,
|
|
234
236
|
`SEGMENTED`/`SG`, `NONSEGMENTED`/`NOSG`, `TABS`/`TA`, `MACRO`, `NOMACRO`,
|
|
235
|
-
`MPL`, `NOMPL
|
|
236
|
-
`NOSYMBOLS`/`NOSB`, `XREF`/`XR`, `NOXREF`/`NOXR
|
|
237
|
-
`NODEBUG`/`NODB`, `PRINT`/`PR`, `NOPRINT`/`NOPR`,
|
|
238
|
-
`NOOBJECT`/`NOOJ`, `ERRORPRINT`/`EP`, `NOERRORPRINT`/`NOEP`,
|
|
239
|
-
`
|
|
240
|
-
`NOAMAKE`, `USEDEXTONLY`, `EXTMAC`, `EXPDECNUM`, `ABSOLUTE`,
|
|
237
|
+
`MPL`, `NOMPL`, `PAGELENGTH`/`PL`, `PAGEWIDTH`/`PW`, `PAGING`, `NOPAGING`,
|
|
238
|
+
`SYMBOLS`/`SB`, `NOSYMBOLS`/`NOSB`, `XREF`/`XR`, `NOXREF`/`NOXR`. Those it
|
|
239
|
+
ignores: `DEBUG`/`DB`, `NODEBUG`/`NODB`, `PRINT`/`PR`, `NOPRINT`/`NOPR`,
|
|
240
|
+
`OBJECT`/`OJ`, `NOOBJECT`/`NOOJ`, `ERRORPRINT`/`EP`, `NOERRORPRINT`/`NOEP`,
|
|
241
|
+
`DATE` (its argument is checked), `LINES`, `NOLINES`, `TYPE`, `NOTYPE`,
|
|
242
|
+
`AMAKE`, `NOAMAKE`, `USEDEXTONLY`, `EXTMAC`, `EXPDECNUM`, `ABSOLUTE`,
|
|
243
|
+
`NOABSOLUTE`.
|
|
241
244
|
|
|
242
245
|
General controls that openc166 uses: `INCLUDE`/`IC`, `SET`, `RESET`, `IF`,
|
|
243
246
|
`ELSEIF`, `ELSE`, `ENDIF`, `COND`, `NOCOND`, `GEN`/`GE`, `NOGEN`/`NOGE`,
|
|
244
|
-
`GENONLY`/`GO`, `SAVE`/`SA`, `RESTORE`/`RS
|
|
245
|
-
`
|
|
247
|
+
`GENONLY`/`GO`, `SAVE`/`SA`, `RESTORE`/`RS`, `LIST`/`LI`, `NOLIST`/`NOLI`,
|
|
248
|
+
`TITLE`/`TT`, `EJECT`/`EJ`, `SYMLIST`, `NOSYMLIST`. It ignores `REGUSE`.
|
|
246
249
|
|
|
247
250
|
These lists come from testing A166 V5.38. The manual calls `TITLE` and
|
|
248
251
|
`NOCOND` primary, but A166 accepts them anywhere. An unknown control is
|
|
@@ -276,6 +279,40 @@ otherwise ignored, even controls and conditionals. Problems found at the end
|
|
|
276
279
|
of the file; an unclosed `SECTION` or `PROC` (A106) on the `END` line (with
|
|
277
280
|
no `END` at all, Keil reports only A89).
|
|
278
281
|
|
|
282
|
+
### Listing controls
|
|
283
|
+
|
|
284
|
+
The listing has openc166's own layout, not Keil's, but these controls mean
|
|
285
|
+
what they mean in Keil:
|
|
286
|
+
|
|
287
|
+
- **`$EJECT`** starts a new page after its line: a form feed, then a header
|
|
288
|
+
with the title and the page number. An `$EJECT` that `$NOLIST` hides
|
|
289
|
+
does not.
|
|
290
|
+
- **`$TITLE(text)`** sets the title of the page headers. As in Keil, every
|
|
291
|
+
header shows the last title of the file. Without one the header names
|
|
292
|
+
the source file. The first page has no header.
|
|
293
|
+
- **`$PAGING`**, **`$PAGELENGTH(n)`** (18 to 65535) break the listing into
|
|
294
|
+
pages of `n` rows, 60 unless given, header included. `$NOPAGING` leaves
|
|
295
|
+
only the `$EJECT` breaks.
|
|
296
|
+
- **`$PAGEWIDTH(n)`** (72 to 132) wraps longer rows; the rest of a source
|
|
297
|
+
line continues in the source column.
|
|
298
|
+
- **`$NOSYMBOLS`** leaves out the symbol table, unless `$XREF` is given.
|
|
299
|
+
Symbols defined between **`$NOSYMLIST`** and `$SYMLIST` are left out of
|
|
300
|
+
it.
|
|
301
|
+
- **`$XREF`** adds to each symbol the line of its definition, marked `#`,
|
|
302
|
+
and the lines that use it in an expression.
|
|
303
|
+
|
|
304
|
+
A number out of range is A19, a missing argument A22, and an argument on a
|
|
305
|
+
control that takes none, as in `$EJECT(1)`, is A16, though as in Keil the
|
|
306
|
+
control still counts. Only the printed listing changes: the symbols of the
|
|
307
|
+
result, the debug information and the ELF file always have every symbol.
|
|
308
|
+
The symbol and section tables are not paged or wrapped.
|
|
309
|
+
|
|
310
|
+
Unlike Keil, openc166 does not break pages or wrap rows unless the source
|
|
311
|
+
asks for it (in Keil, `$PAGING`, `$PAGELENGTH(60)` and `$PAGEWIDTH(120)`
|
|
312
|
+
are the defaults), and it ignores `$DATE`: its headers have no date, so
|
|
313
|
+
the same source always gives the same listing. In TASKING sources these
|
|
314
|
+
controls are still ignored, except `LIST` and `NOLIST`.
|
|
315
|
+
|
|
279
316
|
## Conditional assembly
|
|
280
317
|
|
|
281
318
|
Keil has two ways to leave lines out, and openc166 supports both:
|
|
@@ -329,6 +366,12 @@ COUNT EQU 4 ; ordinary symbols for IF
|
|
|
329
366
|
after it are assembled, an `IF` statement when the lines before it are.
|
|
330
367
|
`$NOCOND` leaves out every line after which assembly is off; `$COND`
|
|
331
368
|
(the default) shows them again.
|
|
369
|
+
- **`$NOLIST`.** Leaves the following lines out of the listing, the
|
|
370
|
+
`$NOLIST` line included, until a `$LIST` line, which is listed. Lines of
|
|
371
|
+
include files count too, and a `$NOLIST` in an include file still holds
|
|
372
|
+
after the file ends. A line with an error or warning is listed anyway,
|
|
373
|
+
with its message. The lines are assembled as usual: only the listing
|
|
374
|
+
changes.
|
|
332
375
|
|
|
333
376
|
## LIT
|
|
334
377
|
|
|
@@ -454,7 +497,7 @@ SKIP:
|
|
|
454
497
|
- **Listing.** Expanded lines are numbered and carry `+1`, `+2`, ... after
|
|
455
498
|
the number for the depth of expansion. Under `$NOGEN` (the default) and
|
|
456
499
|
`$GENONLY` they are hidden; `$GEN` shows them. `$SAVE` and `$RESTORE`
|
|
457
|
-
keep and bring back the `GEN`
|
|
500
|
+
keep and bring back the `LIST` and `GEN` settings, 10 levels deep (A14 beyond, and
|
|
458
501
|
A13 for `$RESTORE` without `$SAVE`). A problem in an expanded line is
|
|
459
502
|
reported at the line of the outermost call, or, for a `REPT`, `IRP` or
|
|
460
503
|
`IRPC` written in the source, at its `ENDM` line.
|
|
@@ -1123,6 +1166,7 @@ follow are unchanged. Other bad items are dropped.
|
|
|
1123
1166
|
| `-(L1 - L0)`, `NOT (L1 - L0)`, `-(L1 - 1)` | wrong value, no warning | error A63 |
|
|
1124
1167
|
| `number - label` (`10H - L1`) | wrong value | error A63 |
|
|
1125
1168
|
| decimal fraction such as `#1.0` | accepted as 0 | error A70 |
|
|
1169
|
+
| page breaks and wrapped rows in the listing | on by default (`$PAGING`, 60 rows, 120 columns) | only with `$PAGING`, `$PAGELENGTH` or `$PAGEWIDTH`; `$EJECT` always works |
|
|
1126
1170
|
| instruction at an odd address | accepted | error A134 |
|
|
1127
1171
|
| instruction outside a `PROC` | error A45 | accepted |
|
|
1128
1172
|
| instruction or data outside any `SECTION` | error A44 | placed at `--origin` |
|
|
@@ -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
|
|
@@ -70,7 +70,7 @@ for `CASE`, `DEF` for `DEFINE`, ...).
|
|
|
70
70
|
|---|---|
|
|
71
71
|
| `CASE`, `NOCASE` | as in Keil: whether names are case sensitive |
|
|
72
72
|
| `SEGMENTED`, `NONSEGMENTED` | as in Keil; see [Segmented mode](compatibility.md#segmented-mode-and-dpps) |
|
|
73
|
-
| `INCLUDE(file)`, `GEN`, `NOGEN`, `SAVE`, `RESTORE`, `TABS` | as in Keil |
|
|
73
|
+
| `INCLUDE(file)`, `GEN`, `NOGEN`, `LIST`, `NOLIST`, `SAVE`, `RESTORE`, `TABS` | as in Keil |
|
|
74
74
|
| `STDNAMES(file)` | reads a register file: see [Register names](#register-names) |
|
|
75
75
|
| `DEFINE(name[, text])` | defines an m166 macro; without text it is `1` |
|
|
76
76
|
| `EXTEND` | the C167 instructions (always on) |
|
|
@@ -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
|
|
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
|
|
@@ -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)
|