Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

SpeedInfo capability isn't strictly required. #35

Open
Nable80 opened this issue Jul 10, 2021 · 2 comments
Open

SpeedInfo capability isn't strictly required. #35

Nable80 opened this issue Jul 10, 2021 · 2 comments

Comments

@Nable80
Copy link

Nable80 commented Jul 10, 2021

Hi!

I've tried your library with a cheap JLink-OB clone (that is working fine with both OpenOCD and proprietary JLinkGDBServer) and came across the following problem:

> ./list 
Found 1 J-Link device.

Bus 006 Address 054 Port 003: VID=1366 PID=0101 – SEGGER J-Link (Serial 000000123456)
⤷ <device is missing capabilities (SpeedInfo) for operation>

Of course, examples refused to work with the same error message.

After removing self.require_capability(Capability::SpeedInfo)?; from read_speeds in src/lib.rs it starts working:

> ./list
Found 1 J-Link device.

Bus 006 Address 054 Port 003: VID=1366 PID=0101 – SEGGER J-Link (Serial 000000123456)
⤷ Capabilities: GetHwVersion | ReadConfig | WriteConfig | GetMaxBlockSize | GetHwInfo | ResetStopTimed | SelectIf | GetCounters | GetCpuCaps | ExecCpuCmd | Swo | Register | GetCapsEx
  Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
  HW Version: J-Link 7.0.0
  Max. SWO Speed: 4500000 Hz
  Max. Memblock: 11288 bytes
  VTref: 3.3 V
  Interfaces:
      - JTAG (up to 12 MHz)
      - SWD (up to 12 MHz)

It looks like a dirty hack but it works. I wonder what do you think about this issue.

@jonas-schievink
Copy link
Owner

Aren't there some older devices that legitimately don't support this? You should still be able to use your probe as long as you avoid read_speeds

@Nable80
Copy link
Author

Nable80 commented Jul 11, 2021

Aren't there some older devices that legitimately don't support this?

Even this sample is quite old, you can see the build date of firmware (Aug 22 2012). I'm not aware of any JLink devices that don't support speed reporting/setting and even if they exist, they won't work with any recent tools (OpenOCD/JLinkGDBServer/etc) that assume presence of this capability.

You should still be able to use your probe as long as you avoid read_speeds

I definitely need set_speed (speed is the main reason for me to use JLink firmware for dongles instead of alternatives) and I couldn't modify example code to call set_speed without using read_speeds result yet. I'm sorry, I didn't write anything in Rust before, it's the first time when I actually found something catchy that is written in Rust.

My idea is to turn this hard requirement into a warning (or remove it completely and just throw exceptions/return errors when speed reading/setting command fails), so people with old dongles (btw, newer JLInk firmware usually turns these dongles into bricks) will be able to use your library without any problems. IMHO this change does more good than harm (is there any harm at all?) but I can understand if you disagree.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants