Comments (10)
Sounds like a good idea / enhancement. Something like a registers enum
with
class Registers(enum):
ARM_CORTEX_R5_R0 = 0
<...>
ARM_CORTEX_R5_CPS
from pylink.
from pylink.
There's the register_name()
method which takes an index and returns the name of the register at that index. There's also register_list()
which will return a list of the register numbers. Together you could probably do something like:
register_map = {}
for reg_index in jlink.register_list():
register_map[jlink.register_name(reg_index)] = reg_index
print(jlink.register_read(register_map['<REGISTER_NAME>']))
from pylink.
Oh sorry I didn’t see those two functions...
I guess my proposal doesn’t make sense anymore, as the registers are known at runtime. I was thinking that it would be great for auto completion, but it doesn’t seems to be possible.
Should I close the issue?
Sorry again, RTFD the next time
from pylink.
Ah, super sorry about getting back to you late on this. I think probably using the list
is the best bet. It might be worth modifying the register commands to support both named and indexed registers if that's something you want to take a look at.
from pylink.
No problem. Ok, I will add this feature. What do you think about this proposition:
-
modifying
register_read(self, register_index)
signature to
register_read(self, register_index=None, register_name=None)
This change would be backward compatible. -
modifying
register_write(self, reg_index, value)
signature to
register_write(self, value, reg_index=None, register_name=None)
This change wouldn't be backward compatible.
This has the downside to break backward compatibility with current/previous versions of the module, but it keeps a clear interface. Otherwise, if you prefer to keep backward compatibility, I could add functions like read_register_by_name
and write_register_by_name
.
from pylink.
Hm, personally, I would just override register_index
and update the docstring to indicate that we take a string value. In a later (major) release, we can rename register_index -> register
. Basically, just do something like:
if isinstance(register_index, six.stringtypes):
register_index = <convert name to index>
from pylink.
Release with patch should be available in v0.3.0: https://github.com/square/pylink/releases/tag/v0.3.0
from pylink.
Great, thanks! I guess this issue can be closed?
from pylink.
Sounds good.
from pylink.
Related Issues (20)
- Tests fail on some architectures (using unittest.mock) HOT 2
- Pylink locks up on connect command HOT 2
- nRF5340 flashing issue: Failed to prepare for programming. Could not preserve target memory. HOT 6
- RTT Autodetect works with J-Link RTT Viewer, but for pylink I have to explicitly provide the address HOT 1
- AttributeError: module 'pylink' has no attribute 'JLink'. HOT 9
- Loading library on Aarch64 fails because pylink attempts to load 32-bit library HOT 2
- pylink.errors.JLinkFlashException: Could not write target memory when trying to flash a .hex file. HOT 1
- Error when programming or erasing Kinetis microcontrollers HOT 3
- pylink.errors.JLinkException: Could not find supported CPU HOT 24
- pylink.JLink.rtt_read blocks indefinitely when no data is available? HOT 1
- Specify JLinkScript file HOT 1
- CORESIGHT_AddAP doesn't execute HOT 6
- Can support C-JTAG HOT 14
- Unlocking STM32L0 HOT 1
- custom ResetTarget function in pylink HOT 7
- Error "Failed to perform RAMCode-sided Prepare()" Fail "JLinkFlashException: Unspecified error." HOT 2
- rtt_write only working when I have JLink RTT viewer open HOT 8
- Downloading Firmware image to Cortex Fails HOT 2
- 1.2.0: Some tests are incompatible with Python 3.12 HOT 2
- Do I need to use jlink.connect before doing jlink.rtt_start? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylink.