pyocd / pyocd/pyOCD

Python API cleanup for 1.0

Open
#668 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

python-api
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Multiple tasks to clean up parts of the pyOCD Python API in preparation for a 1.0 release. Only potentially compatibility-breaking changes are listed here.

  • need to make MemoryMap.get_first_region_of_type() exclude non-default regions, or add a get_default_region_of_type()
  • rename ResetType.SW_SYSRESETREQ and SW_VECTRESET to SW_SYSTEM and SW_CORE
  • split classes in flash_loader.py out into separate files
  • add Target API to get the halt reason (i.e., breakpoint, vector catch, user halt request, etc)
  • clean up contains related methods on MemoryRangeBase
  • move constants defined in Target out of the class and into enums
  • cleanup CortexM constants
  • cleanup CortexM registers
  • make read regs return None if it can't read a register (e.g. core is running)
  • rename FlashReaderContext to ElfReaderContext
  • remove ELFSymbolProvider and make ElfSymbolDecoder a subclass of SymbolProvider?
  • standardize naming of acryonyms in symbols; ELF vs Elf, GDB vs Gdb, STLink vs Stlink, etc
  • break out regcache, memcache, cache context and gdb packet and server into their own files for logging purposes so child loggers don't have to be created
  • change CortexM.available_breakpoint_count property to function that takes bp type, calls bpmgr function
  • remove fast_verify/trust_crc user option and never trust crc
  • normalise setting names

Some possible changes are undecided:

  • change "user option" terminology to "setting" (quite likely to happen)
  • replace FileProgrammer with image file classes and factory function
  • finish init sequence work, extending outside of CoreSightTarget, bringing session and board into the mix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This is a release-wide checklist covering MemoryMap, MemoryRangeBase, CortexM, Target, flash_loader.py, and ELF symbol classes. Start by reviewing the unchecked and undecided items, then narrow the work to one explicitly scoped API change; completion for the overall issue is not defined beyond resolving the remaining checklist items.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, devtools, embedded-iot
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.