Skip to content

0000621 C Error: 'str' object cannot be interpreted as an integer [__main__] #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PeiC3dahaiph1aeJ opened this issue May 18, 2025 · 0 comments

Comments

@PeiC3dahaiph1aeJ
Copy link

After upgrading to any version above v0.34.3 the following command (list works, load also fails) fails:
pyocd erase -t py32f030x8 --chip --config ./Misc/pyocd.yaml

This is on ubuntu with a daplink programmer.

The error is as follows:
0000621 C Error: 'str' object cannot be interpreted as an integer [main]

Once I downgrade pyocd to v0.34.3 both 'erase' and 'load' commands work again.
I've tried all releases in between and the latest main and develop branches.
This is 100% reproducible, so if there is anything you'd like me to collect, I'll be happy to.

Here is the verbose output on v36:
0006289 C Error: 'str' object cannot be interpreted as an integer [main]
Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/pyocd/main.py", line 161, in run
status = cmd.invoke()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/subcommands/erase_cmd.py", line 94, in invoke
with session:
File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/session.py", line 415, in enter
self.open()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/session.py", line 553, in open
self._board.init()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/board/board.py", line 143, in init
self.target.init()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/coresight_target.py", line 123, in init
super().init()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/core/soc_target.py", line 174, in init
seq.invoke()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/sequencer.py", line 213, in invoke
resultSequence.invoke()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/utility/sequencer.py", line 208, in invoke
resultSequence = call()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/discovery.py", line 63, in _create_cores
self._apply_to_all_components(self._create_component,
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/discovery.py", line 74, in _apply_to_all_components
ap.rom_table.for_each(action, filter)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/rom_table.py", line 338, in for_each
action(component)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/discovery.py", line 57, in _create_component
cmp.init()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/cortex_m.py", line 387, in init
if not self.start_debug_core_hook():
File "/home/user/.local/lib/python3.10/site-packages/pyocd/coresight/cortex_m.py", line 428, in start_debug_core_hook
self.debug_sequence_delegate.run_sequence('DebugCoreStart', pname=self.node_name)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/target/pack/pack_target.py", line 281, in run_sequence
executed_scope = seq.execute(context)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 408, in execute
scope = self._create_scope(context)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 364, in _create_scope
scope = Scope(parent=context.delegate.get_root_scope(context), name=self.name)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/target/pack/pack_target.py", line 177, in get_root_scope
debugvars_block.execute(context)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 523, in execute
interp.execute()
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 993, in execute
return visitor.visit(self._tree)
File "/home/user/.local/lib/python3.10/site-packages/lark/visitors.py", line 226, in visit
return getattr(self, tree.data)(tree)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 806, in start
values = self.visit_children(tree)
File "/home/user/.local/lib/python3.10/site-packages/lark/visitors.py", line 229, in visit_children
return [self.visit(child) if isinstance(child, Tree) else child
File "/home/user/.local/lib/python3.10/site-packages/lark/visitors.py", line 229, in
return [self.visit(child) if isinstance(child, Tree) else child
File "/home/user/.local/lib/python3.10/site-packages/lark/visitors.py", line 226, in visit
return getattr(self, tree.data)(tree)
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 826, in decl_stmt
TRACE.debug("(line %d): decl %s = %s", getattr(tree.meta, 'line', 0), name, self._format_atom(values[1]))
File "/home/user/.local/lib/python3.10/site-packages/pyocd/debug/sequences/sequences.py", line 954, in _format_atom
return hex(node.value)
TypeError: 'str' object cannot be interpreted as an integer

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

No branches or pull requests

1 participant