Electronics > Microcontrollers

Does anyone have experience debugging CMSIS-DAP firmware itself?

(1/20) > >>

technix:
I am not talking about debugging with a CMSIS-DAP, I am talking about debugging the debugger itself.

The project is about putting a full JTAG + SWD debugger into a STM32F042F4 chip. The existing DAP42 project by Devan Lai only supports SWD, not full JTAG, and it is too large for my 16kB chip.

Currently I have the following fails when coupled to OpenOCD:

* The JTAG to SWD dance doesn't work.
* While I can scan the JTAG chain, access to the TAP is not fully working.

Can someone give me some pointers at what I should look at?

ataradov:
I have this https://github.com/ataradov/free-dap . It is SWD-only as well, but it will fit into 16 kB chip easily.

As far as JTAG goes, the whole thing  boils down to one function (dap_jtag_sequence() in my case). So if you have something working at all, it all should be working.

And you can have a look at the  official ARM firmware. Again, you don't need the whole thing, just this function.

What specifically fails in your case?

I did not implement JTAG since I did not have any targets on hand to test it. I don't think I've ever seen  JTAG work over CMSIS-DAP.

technix:

--- Quote from: ataradov on May 05, 2021, 04:12:54 am ---I have this https://github.com/ataradov/free-dap . It is SWD-only as well, but it will fit into 16 kB chip easily.

--- End quote ---
Thanks to the link and I will look into it.


--- Quote from: ataradov on May 05, 2021, 04:12:54 am ---As far as JTAG goes, the whole thing  boils down to one function (dap_jtag_sequence() in my case). So if you have something working at all, it all should be working.

And you can have a look at the  official ARM firmware. Again, you don't need the whole thing, just this function.

--- End quote ---
Can I just transplant code from official ARM code to this?


--- Quote from: ataradov on May 05, 2021, 04:12:54 am ---What specifically fails in your case?

--- End quote ---
I have no idea how to read openocd -d3 output. I will post a console dump later for checking.


--- Quote from: ataradov on May 05, 2021, 04:12:54 am ---I did not implement JTAG since I did not have any targets on hand to test it. I don't think I've ever seen  JTAG work over CMSIS-DAP.

--- End quote ---
I have a board that paired that CMSIS-DAP to an LPC2103, so JTAG is a must have. Also for my boards I do tend to prefer full JTAG over SWD for it being full duplex can allow for some fast debugging actions.

ataradov:

--- Quote from: technix on May 05, 2021, 04:18:43 am ---Can I just transplant code from official ARM code to this?

--- End quote ---
Yes, with obvious corrections for the pin manipulation function names. The function just takes raw payload of the frame sent over USB and expects to produce the response payload. So parsing of that data would be very similar. I have not looked at the official code in great details, but it does something very similar.


--- Quote from: technix on May 05, 2021, 04:18:43 am ---I have no idea how to read openocd -d3 output. I will post a console dump later for checking.

--- End quote ---
I have not used OpenOCD. But it may be a source of errors too, I don't know how much testing JTAG over CMSIS-DAP is tested.


--- Quote from: technix on May 05, 2021, 04:18:43 am ---Also for my boards I do tend to prefer full JTAG over SWD for it being full duplex can allow for some fast debugging actions.

--- End quote ---
With the same clock frequency SWD has higher throughput. It is a well designed interface.

Bidirectional nature of the JTAG does not help, since you are still clocking in dummy cycles to get your data back. There cases where data is sent and received at the same time are extremely rare, and usually it is just a few status bits.

technix:

--- Quote from: ataradov on May 05, 2021, 04:31:21 am ---With the same clock frequency SWD has higher throughput. It is a well designed interface.

Bidirectional nature of the JTAG does not help, since you are still clocking in dummy cycles to get your data back. There cases where data is sent and received at the same time are extremely rare, and usually it is just a few status bits.

--- End quote ---
There are some other features of JTAG I use:

* JTAG is, in a sense, multi-drop. I can have multiple chips hooked to the same JTAG chain regardless of vendor, for example STM32F103 + XC2C32A. Ever since I start using this cross-vendor multi-drop feature of JTAG, I have standardized my JTAG connector on all designs into the ARM CoreSight Debug 10-pin interface and built adapters that converts all kinds of other pinouts into that.
* I can do boundary scan over JTAG as well, not just debugging. That would be useful for testing, and especially for writing to external memory devices as I would be able to bit bang the memory bus without software support. Even my planned retro projects will have JTAG-enabled bus transceivers so I can use surface-mount Flash ROM.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version