square / pylink

Python Library for device debugging/programming via J-Link
https://pylink.readthedocs.io/en/latest/
Other
334 stars 125 forks source link

Do I need to use jlink.connect before doing jlink.rtt_start? #198

Closed ephraim271 closed 2 months ago

ephraim271 commented 2 months ago

Checking if I can start rtt without doing a jlink.connect()?

rtt_start() says only "open required", not "connect required". But without doing a jlink.connect(), rtt_get_status() is always returns zero.

Usecase : I want to keep sending data on rtt without considering if target is powered on or not.

hkpeprah commented 2 months ago

To use RTT, the debugger needs to be able to read from target memory on the device. If the device is not powered, then you would not be able to read from its memory. I think you would have to figure an out-of-band way of knowing whether your target is powered or not if you want to use RTT without attempting a connection if it's possible that your target is not powered.

ephraim271 commented 2 months ago

Thank you for the quick response! So I'll go with a hacky solution.. I put open/connect/rtt_start into a while loop till I get a positive rtt_get_status() when target gets turned on :)