OpenOCD and JLINK

Firmware/software/electronics/mechanics
Post Reply
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

OpenOCD and JLINK

Post by whoenig »

Hi,

I am trying to get J-LINK (EDU) to work with the various crazyflie firmwares. The trunk of openocd works directly with jlink already. However, I need to specify

Code: Select all

-c "transport select swd"
in the Makefiles in order to get it to work (apart from switching OPENOCD_INTERFACE and OPENOCD_TARGET). For example

Code: Select all

openocd:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets -c "\$$_TARGETNAME configure -rtos auto"
changes to:

Code: Select all

openocd:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -c "transport select swd" -f $(OPENOCD_TARGET) -c init -c targets -c "\$$_TARGETNAME configure -rtos auto"
I don't own an STLINKv2. Does the above change work with that as well? If that is the case I would like to create some pull-requests to add it consistently.

Thank you!
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: OpenOCD and JLINK

Post by marcus »

Hi Wolfgang,

Unfortunately the STLINKv2 adapter doesn't seem to support the "swd" transport, only the "hla_swd" transport. So with the added command it doesn't work with the STLINKv2 anymore.

What about adding a variable in the Makefile with custom commandline arguments that's empty by default (maybe changes in the future) and can be overridden in the config.mk with special options for other adapters?
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: OpenOCD and JLINK

Post by whoenig »

Thank you, Marcus! I created two pull-requests for the "important" repositories. If you are fine with the changes, I can do the same thing for the remaining ones as well.

I would also like to add some documentation in the wiki, for two things: a) How to flash from scratch (this was a recent discussion in the forum and I looked quite a bit before I found it), and b) special instruction for J-LINK (there seem to be multiple users around - the question came up frequently).
However, I am not sure where the best place would be for the instruction? So far I found the following pages:
https://wiki.bitcraze.io/projects:crazy ... er_flasher
https://wiki.bitcraze.io/doc:crazyflie: ... e_firmware
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: OpenOCD and JLINK

Post by marcus »

Thanks! The code is merged.

Yeah, it would be great to document it somewhere. I think the second link looks good, since it has lots of information on how to build (it will require to edit the config.mk).
Post Reply