Skip to content

Conversation

@crides
Copy link

@crides crides commented Jun 12, 2022

This follows the way in the jlink_probe module of getting configs.

Fixes the first 2 requirements in #1417

This follows the way in the `jlink_probe` module of getting configs
@lgtm-com
Copy link

lgtm-com bot commented Jun 12, 2022

This pull request introduces 2 alerts when merging 4518c1d into a29d167 - view on LGTM.com

new alerts:

  • 2 for Variable defined multiple times

Copy link
Member

@flit flit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the options.py additions, would you mind adding your copyright to the top of the file below the others? Thanks!!

Copy link
Member

@flit flit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes! If you remove the change to setup.cfg it should be ready to go!

pyyaml>=6.0,<7.0
six>=1.15.0,<2.0
typing-extensions>=4.0,<5.0
elftools>=0.28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package doesn't exist. The package on PyPI is actually called pyelftools, and is already a pyocd dependency. 😄

Comment on lines +138 to +143
elf = ELFFile(open(self._args.elf, "rb"))
symtab = elf.get_section_by_name(".symtab")
if symtab:
rtt_entry = symtab.get_symbol_by_name("_SEGGER_RTT")
if len(rtt_entry) > 0:
rtt_cb_addr = rtt_entry[0].entry["st_value"]
Copy link
Member

@flit flit Jun 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fyi, pyocd has some built-in support for ELF symbol extraction (and other things) in the pyocd.debug.elf sub-package. It's based on pyelftools, so for cases like this, where there is not much advantage, it's fine to directly use pyelftools. So no need to rewrite this.

For reference, this is what this code would look like using pyocd's ELF tools:

sym_info = ELFBinaryFile(self._args.elf).symbol_decoder.get_symbol_by_name('_SEGGER_RTT')
if sym_info:
    rtt_cb_addr = sym_info.value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants