Hello,

Testing a new target I noticed that CMSIS-DAP error handling could be a
little user-friendlier. When I connect with just

source [find interface/cmsis-dap.cfg]
transport select swd

then I get the following non-telling error message:

Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.

If I add the missing

adapter_khz 500

then I instead get the expected (though not ideal) error message:

Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Error: BUG: current_target out of bounds

I checked the recent cmsis_dap_usb.c history but couldn't quickly
identify any change to that effect.

jtag_get_speed_khz() is passed to cmsis_dap_cmd_DAP_SWJ_Clock() without
checking for a zero value anywhere. Is it firmware-dependent behavior
whether a zero speed is handled okay or should we always catch this to
emit an error message the user understands? As a compromise maybe check
the argument only in case of error?

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to