Author Topic: Does anyone have experience debugging CMSIS-DAP firmware itself?  (Read 13399 times)

0 Members and 1 Guest are viewing this topic.

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #50 on: May 08, 2021, 05:21:08 pm »
I can't make sense of that log. The first communication that happens with the debugger is a series of ID_DAP_INFO (0x00) commands. The second byte of the command is the requested information type. The first 4 requested strings are DAP_INFO_VENDOR (0x01), DAP_INFO_PRODUCT (0x02), DAP_INFO_SER_NUM (0x03), DAP_INFO_FW_VER (0x04).

The first command makes sense. It starts with 0x00 0x01. This is ID_DAP_INFO / DAP_INFO_VENDOR. The response logically also makes sense, the first byte is the command, it must mirror data[0]. The second byte is the length of the response. It is 0 in this case, which is just means that there is no vendor string.

The second command is already strange. The command itself is fine, it is ID_DAP_INFO / DAP_INFO_PRODUCT. But the response starts with 0xff, which is not the copy of the command. This is the point where check(hid_buffer[0] == cmd, "invalid response received") should have failed, since cmd would be 0x00 and hid_buffer[0] is 0xff.

I don't understand why it continued from there. First of all, double check your modifications and that you are printing things in the correct place. And also add this right before the check(...):
Code: [Select]
verbose("buf = 0x%02x, cmd = 0x%02x\n", hid_buffer[0], cmd);
Those values must match what is printed by the loops, and if they do not match each other, then the check should fail.
« Last Edit: May 08, 2021, 05:22:43 pm by ataradov »
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #51 on: May 09, 2021, 12:59:45 pm »
I have found out that my specific USB library likes to spit FF FF bytes at me when reading from the USB endpoint and there is nothing there yet, so I implemented a filter to remove all of those junk frames and filed a bug to the upstream. Now it is progressing a little, even with the 8-slot buffer reinstated:

Code: [Select]
$ ./edbg -b -t samv71 -r -f temp.bin
---
0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x70 0x4f 0x00 0x39 0xa2 0x7f 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x00 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x04 0x31 0x2e 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x00 0xf0 0x2e 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Debugger: SushiBits Innovative SushiBits One with CMSIS-DAP 63C8AF92 1.0 (SJ)
Clock frequency: 16.0 MHz
---
0x03 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0x8f 0x70 0x04 0x0c 0x01 0x00 0x00
0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x02 0x01 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0x94 0x70 0x04 0x0c 0x01 0x00
0x02 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x04 0x00 0x00 0x80 0x80 0x00 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xa5 0x70
0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x13 0x00 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xac 0x70 0x04 0x0c 0x01 0x00
0x13 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x11 0x00 0x24 0xf4 0x00 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xb7 0x70 0x04
0x11 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x01 0x00 0x01 0x80 0xc2 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xc3 0x70 0x04 0x0c 0x01
0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x10 0x03 0x83 0x00 0x00 0x00 0x00 0x50 0xbf 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xa0
0x10 0x2f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x10 0x83 0x83 0x00 0x00 0x00 0x00 0x50 0xbf 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xa0
0x10 0xaf 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x12 0x88 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x9e 0xe7 0xff 0xff 0xff 0xff 0xff
0x12 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x05 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x05 0x00 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff 0xff
---
0x01 0x00 0x00 0x50 0xba 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xa4 0x67 0x04 0x0c 0x01
0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---
0x03 0x50 0xba 0xbb 0xe3 0xfe 0x7f 0x00 0x00 0xa9 0x67 0x04 0x0c 0x01 0x00 0x00
0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Error: invalid response during transfer (count = 0/1, status = 7)

I don't understand why it continued from there. First of all, double check your modifications and that you are printing things in the correct place. And also add this right before the check(...):
Code: [Select]
verbose("buf = 0x%02x, cmd = 0x%02x\n", hid_buffer[0], cmd);
Those values must match what is printed by the loops, and if they do not match each other, then the check should fail.
I think the continuing commands are just a teardown sequence with ID_DAP_LED and ID_DAP_DISCONNECT.
« Last Edit: May 09, 2021, 01:09:39 pm by technix »
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #52 on: May 09, 2021, 01:28:40 pm »
Further getting rid of some memcpy's and memset's:

Code: [Select]
$ ./edbg -b -c 1000 -t samv71 -r -f temp.bin
---
0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x03 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x04 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x04 0x31 0x2e 0x30 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0xf0 0x2e 0x30 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x01 0x03 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
Debugger: SushiBits Innovative SushiBits One with CMSIS-DAP 63C8AF92 1.0 (SJ)
Clock frequency: 1.0 MHz
---
0x03 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0x8f 0x50 0x4a 0x0d 0x01 0x00 0x00
0x03 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x02 0x01 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0x94 0x50 0x4a 0x0d 0x01 0x00
0x02 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x04 0x00 0x00 0x80 0x80 0x00 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xa5 0x50
0x04 0x00 0x00 0x80 0x80 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x13 0x00 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xac 0x50 0x4a 0x0d 0x01 0x00
0x13 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x11 0x40 0x42 0x0f 0x00 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xb7 0x50 0x4a
0x11 0x00 0x42 0x0f 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x01 0x00 0x01 0x70 0xe2 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xc3 0x50 0x4a 0x0d 0x01
0x01 0x00 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x10 0x03 0x83 0x00 0x00 0x00 0x00 0x40 0xdf 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xa0
0x10 0x2f 0x83 0x00 0x00 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x10 0x83 0x83 0x00 0x00 0x00 0x00 0x40 0xdf 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xa0
0x10 0xaf 0x83 0x00 0x00 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x12 0x88 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x9e 0xe7 0xff 0xff 0xff 0xff 0xff
0x12 0x88 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x9e 0xe7 0xff 0xff 0xff 0xff 0xff
---
0x01 0x00 0x00 0xb0 0xda 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xb1 0x46 0x4a 0x0d 0x01
0x01 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x03 0xb0 0xda 0x75 0xe2 0xfe 0x7f 0x00 0x00 0xb6 0x46 0x4a 0x0d 0x01 0x00 0x00
0x03 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
Error: SWJ_SEQUENCE failed
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #53 on: May 09, 2021, 04:53:59 pm »
Ye, teardown sequence makes sense. It was a later addition, and I forget that it is there.

What memcpy()s did you get rid of? It made more progress with the first log. In the last log the issue is that command "0x12 0x88 0xff ...." got a response that is just a copy of the request "0x12 0x88 0xff 0xff .....".

In your first log you see a correct response "0x12 0x00 0x00 0x00......". The only part that matter is first two bytes. And the second byte should be 0x00 (DAP_OK). There is no way SWJ_SEQUENCE can fail, it just blindly toggles the pins, so there is something wrong.

In your case "invalid response during transfer (count = 0/1, status = 7)" means that debugger attempted to perform a transfer, but status=7 means that the target did not respond, and the 3-bit ACK code was all 1s.

The transfer that fails is dap_read_idcode() following ID_DAP_SWJ_SEQUENCE in the dap_reset_link(). Reading the ID code is part of the switching to SWD mode.

So in your last log ID_DAP_SWJ_SEQUENCE of that function is broken. In the previous log, everything seems to work as expected, but it seems like the target is not connected properly or pins are not toggling correctly.

Get back to the status=7 situation and capture SWDIO/SWCLK pins on the scope. See that they are doing anything. You are very close.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #54 on: May 09, 2021, 06:06:20 pm »
What memcpy()s did you get rid of? It made more progress with the first log. In the last log the issue is that command "0x12 0x88 0xff ...." got a response that is just a copy of the request "0x12 0x88 0xff 0xff .....".
I used atomic-ish operations by always writing the DAP protocol core's response into a zeroed temporary buffer, then copied things into the 8-slot buffer array. That means a lot of 64-byte copies, although it does means operations are largely atomic.

So in your last log ID_DAP_SWJ_SEQUENCE of that function is broken. In the previous log, everything seems to work as expected, but it seems like the target is not connected properly or pins are not toggling correctly.
I know for the fact that my target is working and connected as I can use a J-Link to talk to the exact same target chip (while CMSIS-DAP has been disconnected.)

Get back to the status=7 situation and capture SWDIO/SWCLK pins on the scope. See that they are doing anything. You are very close.
Do I need to do two-channel capture? That would require me to create a rig.
« Last Edit: May 09, 2021, 06:11:50 pm by technix »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #55 on: May 09, 2021, 06:57:37 pm »
Do I need to do two-channel capture? That would require me to create a rig.
For a first pass single channel should be fine. Just to see if pins are toggling at all.

It may also be an issue with readback or switching SWDIO to input. Try to disconnect SWDIO from the target and pull it down on the debugger. Check that you get status = 0.

Obviously figure out how to get back to the state with status = 7 first.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #56 on: May 10, 2021, 02:33:05 am »
Obviously figure out how to get back to the state with status = 7 first.
That's a software bug in the implementation of the triple-pointer ring buffer, which has been fixed.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #57 on: May 12, 2021, 02:56:25 pm »
Now I got this:

Code: [Select]
$ ./edbg -b -c 1000 -t samv71 -r -f temp.bin
---
0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x03 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0x04 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x04 0x31 0x2e 0x30 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x00 0xf0 0x2e 0x30 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
0x00 0x01 0x03 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
Debugger: SushiBits Innovative SushiBits One with CMSIS-DAP 63C8AF92 1.0 (SJ)
Clock frequency: 1.0 MHz
---
0x03 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0x8f 0xb0 0x13 0x05 0x01 0x00 0x00
0x03 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x02 0x01 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0x94 0xb0 0x13 0x05 0x01 0x00
0x02 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x04 0x00 0x00 0x80 0x80 0x00 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0xa5 0xb0
0x04 0x00 0x00 0x80 0x80 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x13 0x00 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0xac 0xb0 0x13 0x05 0x01 0x00
0x13 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x11 0x40 0x42 0x0f 0x00 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0xb7 0xb0 0x13
0x11 0x00 0x42 0x0f 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x01 0x00 0x01 0x70 0x82 0xac 0xea 0xfe 0x7f 0x00 0x00 0xc3 0xb0 0x13 0x05 0x01
0x01 0x00 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x10 0x03 0x83 0x00 0x00 0x00 0x00 0x40 0x7f 0xac 0xea 0xfe 0x7f 0x00 0x00 0xa0
0x10 0x27 0x83 0x00 0x00 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x10 0x83 0x83 0x00 0x00 0x00 0x00 0x40 0x7f 0xac 0xea 0xfe 0x7f 0x00 0x00 0xa0
0x10 0xa7 0x83 0x00 0x00 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x12 0x88 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x9e 0xe7 0xff 0xff 0xff 0xff 0xff
0x12 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x9e 0xe7 0xff 0xff 0xff 0xff 0xff
---
0x05 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x05 0x01 0x01 0x77 0x14 0xa0 0x1b 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
---
0x05 0x00 0x03 0x00 0x16 0x00 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x04 0x00 0x0f
0x05 0x03 0x01 0x00 0x16 0x00 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x04 0x00 0x0f
---
0x05 0x00 0x03 0x01 0x12 0x00 0x00 0xff 0x05 0xf0 0xed 0x00 0xe0 0x0d 0x03 0x00
0x05 0x03 0x01 0x01 0x12 0x00 0x00 0xff 0x05 0xf0 0xed 0x00 0xe0 0x0d 0x03 0x00
---
0x05 0x00 0x03 0x01 0x12 0x00 0x00 0xff 0x05 0xfc 0xed 0x00 0xe0 0x0d 0x01 0x00
0x05 0x03 0x01 0x01 0x12 0x00 0x00 0xff 0x05 0xfc 0xed 0x00 0xe0 0x0d 0x01 0x00
---
0x05 0x00 0x03 0x01 0x12 0x00 0x00 0xff 0x05 0x0c 0xed 0x00 0xe0 0x0d 0x04 0x00
0x05 0x03 0x01 0x01 0x12 0x00 0x00 0xff 0x05 0x0c 0xed 0x00 0xe0 0x0d 0x04 0x00
---
0x05 0x00 0x03 0x01 0x12 0x00 0x00 0xff 0x05 0x00 0x20 0x04 0xe0 0x0f 0x00 0xfa
0x05 0x03 0x01 0x10 0x64 0x03 0x20 0xff 0x05 0x00 0x20 0x04 0xe0 0x0f 0xff 0xff
ID = 0x20036410
--- done ---

So is it working then?
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #58 on: May 12, 2021, 03:01:05 pm »
And in OpenOCD I now have this when talking SWD:

Code: [Select]
$ openocd -d3 -f interface/cmsis-dap.cfg -c "transport select swd" -c "adapter speed 1000" -f target/stm32f1x.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
[url]http://openocd.org/doc/doxygen/bugs.html[/url]
User : 13 1 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 1 options.c:63 configuration_output_handler():
Debug: 15 1 options.c:244 add_default_dirs(): bindir=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 16 1 options.c:245 add_default_dirs(): pkgdatadir=/usr/local/Cellar/open-ocd/0.11.0/share/openocd
Debug: 17 1 options.c:246 add_default_dirs(): exepath=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 18 1 options.c:247 add_default_dirs(): bin2data=../share/openocd
Debug: 19 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/Library/Preferences/org.openocd
Debug: 20 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/.config/openocd
Debug: 21 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/.openocd
Debug: 22 1 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/site
Debug: 23 1 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts
Debug: 24 1 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/interface/cmsis-dap.cfg
Debug: 25 2 command.c:146 script_debug(): command - adapter driver cmsis-dap
Debug: 27 2 command.c:146 script_debug(): command - transport select swd
User : 28 2 options.c:63 configuration_output_handler(): swdUser : 29 2 options.c:63 configuration_output_handler():
Debug: 30 2 command.c:146 script_debug(): command - adapter speed 1000
Debug: 32 2 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 33 2 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 34 2 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 35 2 options.c:63 configuration_output_handler(): adapter speed: 1000 kHz
User : 36 2 options.c:63 configuration_output_handler():
Debug: 37 2 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/stm32f1x.cfg
Debug: 38 2 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/swj-dp.tcl
Debug: 39 2 command.c:146 script_debug(): command - transport select
Debug: 40 3 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/mem_helper.tcl
Debug: 41 3 command.c:146 script_debug(): command - add_usage_text mrw address
Debug: 43 3 command.c:1115 help_add_command(): added 'mrw' help text
Debug: 44 3 command.c:146 script_debug(): command - add_help_text mrw Returns value of word in memory.
Debug: 46 3 command.c:1128 help_add_command(): added 'mrw' help text
Debug: 47 3 command.c:146 script_debug(): command - add_usage_text mrh address
Debug: 49 3 command.c:1115 help_add_command(): added 'mrh' help text
Debug: 50 3 command.c:146 script_debug(): command - add_help_text mrh Returns value of halfword in memory.
Debug: 52 3 command.c:1128 help_add_command(): added 'mrh' help text
Debug: 53 3 command.c:146 script_debug(): command - add_usage_text mrb address
Debug: 55 3 command.c:1115 help_add_command(): added 'mrb' help text
Debug: 56 3 command.c:146 script_debug(): command - add_help_text mrb Returns value of byte in memory.
Debug: 58 3 command.c:1128 help_add_command(): added 'mrb' help text
Debug: 59 3 command.c:146 script_debug(): command - add_usage_text mmw address setbits clearbits
Debug: 61 3 command.c:1115 help_add_command(): added 'mmw' help text
Debug: 62 3 command.c:146 script_debug(): command - add_help_text mmw Modify word in memory. new_val = (old_val & ~clearbits) | setbits;
Debug: 64 3 command.c:1128 help_add_command(): added 'mmw' help text
Debug: 65 3 command.c:146 script_debug(): command - transport select
Debug: 66 3 command.c:146 script_debug(): command - transport select
Debug: 67 3 command.c:146 script_debug(): command - transport select
Debug: 68 3 command.c:146 script_debug(): command - swd newdap stm32f1x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x1ba01477
Debug: 69 3 tcl.c:572 jim_newtap_cmd(): Creating New Tap, Chip: stm32f1x, Tap: cpu, Dotted: stm32f1x.cpu, 8 params
Debug: 70 3 core.c:1488 jtag_tap_init(): Created Tap: stm32f1x.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
Debug: 71 3 command.c:146 script_debug(): command - dap create stm32f1x.dap -chain-position stm32f1x.cpu
Debug: 72 3 command.c:146 script_debug(): command - transport select
Debug: 73 3 command.c:146 script_debug(): command - target create stm32f1x.cpu cortex_m -endian little -dap stm32f1x.dap
Debug: 74 3 command.c:376 register_command(): command 'rtt' is already registered in '<global>' context
Debug: 75 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
Debug: 76 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 77 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 78 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 79 3 command.c:146 script_debug(): command - flash bank stm32f1x.flash stm32f1x 0x08000000 0 0 0 stm32f1x.cpu
Debug: 81 3 tcl.c:1319 handle_flash_bank_command(): 'stm32f1x' driver usage field missing
Debug: 82 3 command.c:146 script_debug(): command - adapter speed 1000
Debug: 84 3 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 85 3 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 86 3 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 87 3 command.c:146 script_debug(): command - adapter srst delay 100
Debug: 89 3 command.c:146 script_debug(): command - transport select
Debug: 90 3 command.c:146 script_debug(): command - reset_config srst_nogate
Debug: 92 3 command.c:146 script_debug(): command - transport select
Debug: 93 3 command.c:146 script_debug(): command - cortex_m reset_config sysresetreq
Debug: 95 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event examine-end
# DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP |
#              DBG_STANDBY | DBG_STOP | DBG_SLEEP
mmw 0xE0042004 0x00000307 0

Debug: 96 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event trace-config
# Set TRACE_IOEN; TRACE_MODE is set to async; when using sync
# change this value accordingly to configure trace pins
# assignment
mmw 0xE0042004 0x00000020 0

Info : 97 3 server.c:312 add_service(): Listening on port 6666 for tcl connections
Info : 98 3 server.c:312 add_service(): Listening on port 4444 for telnet connections
Debug: 99 3 command.c:146 script_debug(): command - init
Debug: 101 3 command.c:146 script_debug(): command - target init
Debug: 103 3 command.c:146 script_debug(): command - target names
Debug: 104 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-erase-start
Debug: 105 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-erase-start reset init
Debug: 106 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-write-end
Debug: 107 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-write-end reset halt
Debug: 108 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-attach
Debug: 109 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-attach halt 1000
Debug: 110 3 target.c:1639 handle_target_init_command(): Initializing targets...
Debug: 111 3 semihosting_common.c:99 semihosting_common_init():
Debug: 112 17 cmsis_dap_usb_bulk.c:157 cmsis_dap_usb_open(): found product string of 0x0002:0xda42 'SushiBits One with CMSIS-DAP'
Debug: 113 17 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xda42
Debug: 114 17 cmsis_dap_usb_bulk.c:237 cmsis_dap_usb_open(): skipping interface 0, has only 1 endpoints
Debug: 115 17 cmsis_dap_usb_bulk.c:285 cmsis_dap_usb_open(): skipping interface 1, class 10 subclass 0 protocol 0
Debug: 116 17 cmsis_dap_usb_bulk.c:224 cmsis_dap_usb_open(): found interface 2 string 'SushiBits One Embedded CMSIS-DAP'
Debug: 117 17 cmsis_dap_usb_bulk.c:244 cmsis_dap_usb_open(): skipping interface 2, endpoint[0] is not bulk out
Debug: 118 18 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Debug: 119 18 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1366:0x0101
Debug: 120 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0xc52b
Debug: 121 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03f0:0x052a
Debug: 122 20 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x04d8:0x9012
Debug: 123 20 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03eb:0x2104
Debug: 124 20 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xf003
Debug: 125 21 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8140
Debug: 126 21 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1050:0x0407
Debug: 127 21 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 128 22 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0x085c
Debug: 129 22 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 130 22 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a86:0x752d
Debug: 131 22 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8142
Debug: 132 23 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Info : 133 32 cmsis_dap.c:788 cmsis_dap_get_caps_info(): CMSIS-DAP: SWD  Supported
Info : 134 32 cmsis_dap.c:790 cmsis_dap_get_caps_info(): CMSIS-DAP: JTAG Supported
Info : 135 34 cmsis_dap.c:768 cmsis_dap_get_version_info(): CMSIS-DAP: FW Version = 1.0
Info : 136 38 cmsis_dap.c:881 cmsis_dap_swd_open(): CMSIS-DAP: Interface Initialised (SWD)
Debug: 137 40 cmsis_dap.c:953 cmsis_dap_init(): CMSIS-DAP: Packet Size = 64
Debug: 138 42 cmsis_dap.c:966 cmsis_dap_init(): CMSIS-DAP: Packet Count = 8
Debug: 139 42 cmsis_dap.c:969 cmsis_dap_init(): Allocating FIFO for 3 pending packets
Info : 140 44 cmsis_dap.c:809 cmsis_dap_get_status(): SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 1 nRESET = 1
Info : 141 54 cmsis_dap.c:1023 cmsis_dap_init(): CMSIS-DAP: Interface ready
Debug: 142 54 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 143 54 core.c:1789 adapter_khz_to_speed(): have interface set up
Debug: 144 56 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 145 56 core.c:1789 adapter_khz_to_speed(): have interface set up
Info : 146 56 core.c:1565 adapter_init(): clock speed 1000 kHz
Debug: 147 56 openocd.c:143 handle_init_command(): Debug Adapter init complete
Debug: 148 56 command.c:146 script_debug(): command - transport init
Debug: 150 56 transport.c:229 handle_transport_init(): handle_transport_init
Debug: 151 56 command.c:146 script_debug(): command - dap init
Debug: 153 56 arm_dap.c:106 dap_init_all(): Initializing all DAPs ...
Debug: 154 60 cmsis_dap.c:843 cmsis_dap_swd_switch_seq(): JTAG-to-SWD
Info : 155 68 adi_v5_swd.c:148 swd_connect(): SWD DPIDR 0x1ba01477
Debug: 156 71 arm_adi_v5.c:653 dap_dp_init(): stm32f1x.dap
Debug: 157 71 arm_adi_v5.c:685 dap_dp_init(): DAP: wait CDBGPWRUPACK
Debug: 158 71 arm_adi_v5.h:507 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000
Debug: 159 74 arm_adi_v5.c:693 dap_dp_init(): DAP: wait CSYSPWRUPACK
Debug: 160 74 arm_adi_v5.h:507 dap_dp_poll_register(): DAP: poll 4, mask 0x80000000, value 0x80000000
Debug: 161 77 cmsis_dap.c:587 cmsis_dap_swd_write_from_queue(): refusing to enable sticky overrun detection
Debug: 162 80 openocd.c:160 handle_init_command(): Examining targets...
Debug: 163 80 target.c:1827 target_call_event_callbacks(): target event 19 (examine-start) for core stm32f1x.cpu
Debug: 164 83 arm_adi_v5.c:904 dap_find_ap(): Found AHB3-AP at AP index: 0 (IDR=0x14770011)
Debug: 165 87 arm_adi_v5.c:793 mem_ap_init(): MEM_AP Packed Transfers: enabled
Debug: 166 87 arm_adi_v5.c:804 mem_ap_init(): MEM_AP CFG: large data 0, long address 0, big-endian 0
Debug: 167 90 target.c:2589 target_read_u32(): address: 0xe000ed00, value: 0x411fc231
Debug: 168 90 cortex_m.c:2001 cortex_m_examine(): Cortex-M3 r1p1 processor detected
Debug: 169 90 cortex_m.c:2012 cortex_m_examine(): cpuid: 0x411fc231
Debug: 170 93 target.c:2589 target_read_u32(): address: 0xe000edf0, value: 0x00030003
Debug: 171 93 target.c:2677 target_write_u32(): address: 0xe000edfc, value: 0x01000000
Debug: 172 99 target.c:2589 target_read_u32(): address: 0xe0002000, value: 0x00000260
Debug: 173 99 target.c:2677 target_write_u32(): address: 0xe0002008, value: 0x00000000
Debug: 174 102 target.c:2677 target_write_u32(): address: 0xe000200c, value: 0x00000000
Debug: 175 105 target.c:2677 target_write_u32(): address: 0xe0002010, value: 0x00000000
Debug: 176 108 target.c:2677 target_write_u32(): address: 0xe0002014, value: 0x00000000
Debug: 177 111 target.c:2677 target_write_u32(): address: 0xe0002018, value: 0x00000000
Debug: 178 114 target.c:2677 target_write_u32(): address: 0xe000201c, value: 0x00000000
Debug: 179 117 target.c:2677 target_write_u32(): address: 0xe0002020, value: 0x00000000
Debug: 180 120 target.c:2677 target_write_u32(): address: 0xe0002024, value: 0x00000000
Debug: 181 123 cortex_m.c:2116 cortex_m_examine(): FPB fpcr 0x260, numcode 6, numlit 2
Debug: 182 126 target.c:2589 target_read_u32(): address: 0xe0001000, value: 0x40000000
Debug: 183 126 cortex_m.c:1830 cortex_m_dwt_setup(): DWT_CTRL: 0x40000000
Debug: 184 129 target.c:2589 target_read_u32(): address: 0xe0001fbc, value: 0x00000000
Debug: 185 129 cortex_m.c:1837 cortex_m_dwt_setup(): DWT_DEVARCH: 0x0
Debug: 186 129 target.c:2677 target_write_u32(): address: 0xe0001028, value: 0x00000000
Debug: 187 132 target.c:2677 target_write_u32(): address: 0xe0001038, value: 0x00000000
Debug: 188 135 target.c:2677 target_write_u32(): address: 0xe0001048, value: 0x00000000
Debug: 189 138 target.c:2677 target_write_u32(): address: 0xe0001058, value: 0x00000000
Debug: 190 141 cortex_m.c:1886 cortex_m_dwt_setup(): DWT dwtcr 0x40000000, comp 4, watch/trigger
Info : 191 141 cortex_m.c:2126 cortex_m_examine(): stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Debug: 192 141 target.c:1827 target_call_event_callbacks(): target event 21 (examine-end) for core stm32f1x.cpu
Debug: 193 141 target.c:4779 target_handle_event(): target(0): stm32f1x.cpu (cortex_m) event: 21 (examine-end) action:
# DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP |
#              DBG_STANDBY | DBG_STOP | DBG_SLEEP
mmw 0xE0042004 0x00000307 0

Debug: 194 144 command.c:146 script_debug(): command - mww 0xE0042004 775
Debug: 196 150 command.c:146 script_debug(): command - flash init
Debug: 198 153 tcl.c:1385 handle_flash_init_command(): Initializing flash devices...
Debug: 199 153 command.c:146 script_debug(): command - nand init
Debug: 201 156 tcl.c:498 handle_nand_init_command(): Initializing NAND devices...
Debug: 202 156 command.c:146 script_debug(): command - pld init
Debug: 204 159 pld.c:206 handle_pld_init_command(): Initializing PLDs...
Info : 205 159 gdb_server.c:3503 gdb_target_start(): starting gdb server for stm32f1x.cpu on 3333
Info : 206 159 server.c:312 add_service(): Listening on port 3333 for gdb connections
^CDebug: 207 7042 server.c:609 sig_handler(): Terminating on Signal 2
Debug: 208 7042 command.c:146 script_debug(): command - shutdown
User : 210 7045 server.c:755 handle_shutdown_command(): shutdown command invoked
Debug: 211 7045 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 212 7049 cmsis_dap.c:848 cmsis_dap_swd_switch_seq(): SWD-to-JTAG

(Notice that ^C, that is when I exited OpenOCD.)

Things still does not work when talking JTAG though:
Code: [Select]
$ openocd -d3 -f interface/cmsis-dap.cfg -c "transport select jtag" -c "adapter speed 4000" -f target/stm32f1x.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
[url]http://openocd.org/doc/doxygen/bugs.html[/url]
User : 13 1 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 1 options.c:63 configuration_output_handler():
Debug: 15 1 options.c:244 add_default_dirs(): bindir=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 16 1 options.c:245 add_default_dirs(): pkgdatadir=/usr/local/Cellar/open-ocd/0.11.0/share/openocd
Debug: 17 1 options.c:246 add_default_dirs(): exepath=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 18 1 options.c:247 add_default_dirs(): bin2data=../share/openocd
Debug: 19 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/Library/Preferences/org.openocd
Debug: 20 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/.config/openocd
Debug: 21 1 configuration.c:42 add_script_search_dir(): adding /Users/technix/.openocd
Debug: 22 1 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/site
Debug: 23 1 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts
Debug: 24 1 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/interface/cmsis-dap.cfg
Debug: 25 1 command.c:146 script_debug(): command - adapter driver cmsis-dap
Debug: 27 1 command.c:146 script_debug(): command - transport select jtag
User : 28 1 options.c:63 configuration_output_handler(): jtagUser : 29 1 options.c:63 configuration_output_handler():
Debug: 30 1 command.c:146 script_debug(): command - adapter speed 4000
Debug: 32 1 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 33 1 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 34 1 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 35 1 options.c:63 configuration_output_handler(): adapter speed: 4000 kHz
User : 36 1 options.c:63 configuration_output_handler():
Debug: 37 2 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/stm32f1x.cfg
Debug: 38 2 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/swj-dp.tcl
Debug: 39 2 command.c:146 script_debug(): command - transport select
Debug: 40 2 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/mem_helper.tcl
Debug: 41 3 command.c:146 script_debug(): command - add_usage_text mrw address
Debug: 43 3 command.c:1115 help_add_command(): added 'mrw' help text
Debug: 44 3 command.c:146 script_debug(): command - add_help_text mrw Returns value of word in memory.
Debug: 46 3 command.c:1128 help_add_command(): added 'mrw' help text
Debug: 47 3 command.c:146 script_debug(): command - add_usage_text mrh address
Debug: 49 3 command.c:1115 help_add_command(): added 'mrh' help text
Debug: 50 3 command.c:146 script_debug(): command - add_help_text mrh Returns value of halfword in memory.
Debug: 52 3 command.c:1128 help_add_command(): added 'mrh' help text
Debug: 53 3 command.c:146 script_debug(): command - add_usage_text mrb address
Debug: 55 3 command.c:1115 help_add_command(): added 'mrb' help text
Debug: 56 3 command.c:146 script_debug(): command - add_help_text mrb Returns value of byte in memory.
Debug: 58 3 command.c:1128 help_add_command(): added 'mrb' help text
Debug: 59 3 command.c:146 script_debug(): command - add_usage_text mmw address setbits clearbits
Debug: 61 3 command.c:1115 help_add_command(): added 'mmw' help text
Debug: 62 3 command.c:146 script_debug(): command - add_help_text mmw Modify word in memory. new_val = (old_val & ~clearbits) | setbits;
Debug: 64 3 command.c:1128 help_add_command(): added 'mmw' help text
Debug: 65 3 command.c:146 script_debug(): command - transport select
Debug: 66 3 command.c:146 script_debug(): command - transport select
Debug: 67 3 command.c:146 script_debug(): command - transport select
Debug: 68 3 command.c:146 script_debug(): command - jtag newtap stm32f1x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3ba00477
Debug: 69 3 tcl.c:572 jim_newtap_cmd(): Creating New Tap, Chip: stm32f1x, Tap: cpu, Dotted: stm32f1x.cpu, 8 params
Debug: 70 3 tcl.c:596 jim_newtap_cmd(): Processing option: -irlen
Debug: 71 3 tcl.c:596 jim_newtap_cmd(): Processing option: -ircapture
Debug: 72 3 tcl.c:596 jim_newtap_cmd(): Processing option: -irmask
Debug: 73 3 tcl.c:596 jim_newtap_cmd(): Processing option: -expected-id
Debug: 74 3 core.c:1488 jtag_tap_init(): Created Tap: stm32f1x.cpu @ abs position 0, irlen 4, capture: 0x1 mask: 0xf
Debug: 75 3 command.c:146 script_debug(): command - dap create stm32f1x.dap -chain-position stm32f1x.cpu
Debug: 76 3 command.c:146 script_debug(): command - transport select
Debug: 77 3 command.c:146 script_debug(): command - jtag newtap stm32f1x bs -irlen 5
Debug: 78 3 tcl.c:572 jim_newtap_cmd(): Creating New Tap, Chip: stm32f1x, Tap: bs, Dotted: stm32f1x.bs, 2 params
Debug: 79 3 tcl.c:596 jim_newtap_cmd(): Processing option: -irlen
Debug: 80 3 core.c:1488 jtag_tap_init(): Created Tap: stm32f1x.bs @ abs position 1, irlen 5, capture: 0x1 mask: 0x3
Debug: 81 3 command.c:146 script_debug(): command - target create stm32f1x.cpu cortex_m -endian little -dap stm32f1x.dap
Debug: 82 3 command.c:376 register_command(): command 'rtt' is already registered in '<global>' context
Debug: 83 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
Debug: 84 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 85 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 86 3 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 87 3 command.c:146 script_debug(): command - flash bank stm32f1x.flash stm32f1x 0x08000000 0 0 0 stm32f1x.cpu
Debug: 89 3 tcl.c:1319 handle_flash_bank_command(): 'stm32f1x' driver usage field missing
Debug: 90 3 command.c:146 script_debug(): command - adapter speed 1000
Debug: 92 3 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 93 3 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 94 3 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 95 3 command.c:146 script_debug(): command - adapter srst delay 100
Debug: 97 3 command.c:146 script_debug(): command - transport select
Debug: 98 3 command.c:146 script_debug(): command - jtag_ntrst_delay 100
Debug: 100 3 command.c:146 script_debug(): command - reset_config srst_nogate
Debug: 102 3 command.c:146 script_debug(): command - transport select
Debug: 103 3 command.c:146 script_debug(): command - cortex_m reset_config sysresetreq
Debug: 105 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event examine-end
# DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP |
#              DBG_STANDBY | DBG_STOP | DBG_SLEEP
mmw 0xE0042004 0x00000307 0

Debug: 106 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event trace-config
# Set TRACE_IOEN; TRACE_MODE is set to async; when using sync
# change this value accordingly to configure trace pins
# assignment
mmw 0xE0042004 0x00000020 0

Info : 107 3 server.c:312 add_service(): Listening on port 6666 for tcl connections
Info : 108 3 server.c:312 add_service(): Listening on port 4444 for telnet connections
Debug: 109 3 command.c:146 script_debug(): command - init
Debug: 111 3 command.c:146 script_debug(): command - target init
Debug: 113 3 command.c:146 script_debug(): command - target names
Debug: 114 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-erase-start
Debug: 115 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-erase-start reset init
Debug: 116 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-write-end
Debug: 117 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-write-end reset halt
Debug: 118 3 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-attach
Debug: 119 3 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-attach halt 1000
Debug: 120 3 target.c:1639 handle_target_init_command(): Initializing targets...
Debug: 121 3 semihosting_common.c:99 semihosting_common_init():
Debug: 122 16 cmsis_dap_usb_bulk.c:157 cmsis_dap_usb_open(): found product string of 0x0002:0xda42 'SushiBits One with CMSIS-DAP'
Debug: 123 16 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xda42
Debug: 124 16 cmsis_dap_usb_bulk.c:237 cmsis_dap_usb_open(): skipping interface 0, has only 1 endpoints
Debug: 125 16 cmsis_dap_usb_bulk.c:285 cmsis_dap_usb_open(): skipping interface 1, class 10 subclass 0 protocol 0
Debug: 126 16 cmsis_dap_usb_bulk.c:224 cmsis_dap_usb_open(): found interface 2 string 'SushiBits One Embedded CMSIS-DAP'
Debug: 127 16 cmsis_dap_usb_bulk.c:244 cmsis_dap_usb_open(): skipping interface 2, endpoint[0] is not bulk out
Debug: 128 16 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Debug: 129 17 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1366:0x0101
Debug: 130 17 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0xc52b
Debug: 131 17 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03f0:0x052a
Debug: 132 18 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x04d8:0x9012
Debug: 133 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03eb:0x2104
Debug: 134 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xf003
Debug: 135 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8140
Debug: 136 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1050:0x0407
Debug: 137 19 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 138 20 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0x085c
Debug: 139 20 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 140 24 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a86:0x752d
Debug: 141 24 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8142
Debug: 142 24 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Info : 143 34 cmsis_dap.c:788 cmsis_dap_get_caps_info(): CMSIS-DAP: SWD  Supported
Info : 144 34 cmsis_dap.c:790 cmsis_dap_get_caps_info(): CMSIS-DAP: JTAG Supported
Info : 145 35 cmsis_dap.c:768 cmsis_dap_get_version_info(): CMSIS-DAP: FW Version = 1.0
Info : 146 39 cmsis_dap.c:921 cmsis_dap_init(): CMSIS-DAP: Interface Initialised (JTAG)
Debug: 147 41 cmsis_dap.c:953 cmsis_dap_init(): CMSIS-DAP: Packet Size = 64
Debug: 148 43 cmsis_dap.c:966 cmsis_dap_init(): CMSIS-DAP: Packet Count = 8
Debug: 149 43 cmsis_dap.c:969 cmsis_dap_init(): Allocating FIFO for 3 pending packets
Info : 150 45 cmsis_dap.c:809 cmsis_dap_get_status(): SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 1 nRESET = 1
Info : 151 53 cmsis_dap.c:1023 cmsis_dap_init(): CMSIS-DAP: Interface ready
Debug: 152 53 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 153 53 core.c:1789 adapter_khz_to_speed(): have interface set up
Debug: 154 55 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 155 55 core.c:1789 adapter_khz_to_speed(): have interface set up
Info : 156 55 core.c:1565 adapter_init(): clock speed 1000 kHz
Debug: 157 55 openocd.c:143 handle_init_command(): Debug Adapter init complete
Debug: 158 55 command.c:146 script_debug(): command - transport init
Debug: 160 55 transport.c:229 handle_transport_init(): handle_transport_init
Debug: 161 57 core.c:830 jtag_add_reset(): SRST line released
Debug: 162 57 core.c:855 jtag_add_reset(): TRST line released
Debug: 163 57 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 164 286 command.c:146 script_debug(): command - jtag arp_init
Debug: 165 286 core.c:1578 jtag_init_inner(): Init JTAG chain
Debug: 166 286 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 167 286 cmsis_dap.c:1076 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Debug: 168 288 core.c:1243 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 169 288 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 170 292 cmsis_dap.c:1076 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Info : 171 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.cpu tap/device found: 0x00410041 (mfg: 0x020 (STMicroelectronics), part: 0x0410, ver: 0x0)
Warn : 172 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.cpu       UNEXPECTED: 0x00410041 (mfg: 0x020 (STMicroelectronics), part: 0x0410, ver: 0x0)
Error: 173 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.cpu  expected 1 of 1: 0x3ba00477 (mfg: 0x23b (ARM Ltd), part: 0xba00, ver: 0x3)
Info : 174 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.bs tap/device found: 0x00010041 (mfg: 0x020 (STMicroelectronics), part: 0x0010, ver: 0x0)
Debug: 175 294 core.c:1488 jtag_tap_init(): Created Tap: auto0.tap @ abs position 2, irlen 0, capture: 0x1 mask: 0x3
Info : 176 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: auto0.tap tap/device found: 0x00010041 (mfg: 0x020 (STMicroelectronics), part: 0x0010, ver: 0x0)
Debug: 177 294 core.c:1488 jtag_tap_init(): Created Tap: auto1.tap @ abs position 3, irlen 0, capture: 0x1 mask: 0x3
Debug: 178 294 jep106.c:33 jep106_manufacturer(): BUG: Caller passed out-of-range JEP106 ID!
Info : 179 294 core.c:1142 jtag_examine_chain_display(): JTAG tap: auto1.tap tap/device found: 0xff800001 (mfg: 0x000 (<invalid>), part: 0xf800, ver: 0xf)
Warn : 180 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 160 0x80ffffff
Warn : 181 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 256 0xffffff80
Warn : 182 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 320 0xffffff80
Warn : 183 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 384 0xffff80ff
Warn : 184 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 448 0xff80ffff
Warn : 185 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 512 0x80ffffff
Warn : 186 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 608 0xffffff80
Error: 187 294 core.c:1319 jtag_examine_chain(): double-check your JTAG setup (interface, speed, ...)
Error: 188 294 core.c:1623 jtag_init_inner(): Trying to use configured scan chain anyway...
Debug: 189 295 core.c:1374 jtag_validate_ircapture(): IR capture validation scan
Debug: 190 296 core.c:1432 jtag_validate_ircapture(): stm32f1x.cpu: IR capture 0x01
Error: 191 296 core.c:1426 jtag_validate_ircapture(): stm32f1x.bs: IR capture error; saw 0x04 not 0x01
Debug: 192 296 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 193 296 cmsis_dap.c:1076 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Warn : 194 298 core.c:1646 jtag_init_inner(): Bypassing JTAG setup events due to errors
Debug: 195 298 command.c:146 script_debug(): command - dap init
Debug: 197 298 arm_dap.c:106 dap_init_all(): Initializing all DAPs ...
Debug: 198 298 arm_adi_v5.c:653 dap_dp_init(): stm32f1x.dap
Debug: 199 298 arm_adi_v5.c:685 dap_dp_init(): DAP: wait CDBGPWRUPACK
Debug: 200 298 arm_adi_v5.h:507 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000
Debug: 201 298 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Debug: 202 298 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Info : 203 304 adi_v5_jtag.c:535 jtagdp_overrun_check(): DAP transaction stalled (WAIT) - slowing down
Error: 204 1306 adi_v5_jtag.c:581 jtagdp_overrun_check(): Timeout during WAIT recovery
Debug: 205 1306 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Debug: 206 1306 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Debug: 207 1308 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Debug: 208 1308 cmsis_dap.c:1323 cmsis_dap_execute_scan(): discarding trailing empty field
Debug: 209 1312 command.c:629 run_command(): Command 'dap init' failed with error code -107
User : 210 1312 command.c:694 command_run_line():
Debug: 211 1312 command.c:629 run_command(): Command 'init' failed with error code -4
User : 212 1312 command.c:694 command_run_line():
Debug: 213 1312 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #59 on: May 12, 2021, 03:05:22 pm »
Yep. It just read the value from the register. I would double check with the documentation that it is the correct value, but it looks good.

BTW, JTAG implementation in my firmware is coming along well. I will try to finish it this weekend. That is unless a second dose of the Moderna on Friday knocks me out.

I'm also making some improvements that I wanted to make for some time.
« Last Edit: May 12, 2021, 03:09:22 pm by ataradov »
Alex
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #60 on: May 12, 2021, 03:07:48 pm »
I will read though your JTAG log in more details a bit later to see if I can figure out what may be wrong.

Is this just the device by itself in the chain? Or there are other devices?
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #61 on: May 12, 2021, 03:26:29 pm »
Yep. It just read the value from the register. I would double check with the documentation that it is the correct value, but it looks good.
Awesome.

BTW, JTAG implementation in my firmware is coming along well. I will try to finish it this weekend. That is unless a second dose of the Moderna on Friday knocks me out.
I am still struggling with ARM's code. The problem I a getting is because ARM decided to pass in a whole 32-bit integer when only the lowest bit is supposed to be used, and not documenting that behavior. I had assumed that those uint32_t's are just bool's but apparantly they are not and I have to bulk replace "bit" with "(bit & 0b1)".

Also I am getting a second dose of Sinopharm Beijing Biotech's BBIBP-CorV this Friday.

I'm also making some improvements that I wanted to make for some time.
More awesome.

I will read though your JTAG log in more details a bit later to see if I can figure out what may be wrong.
On the surface one of the bytes in the ID is lost for whatever reason. Maybe I am having memory collision?

Is this just the device by itself in the chain? Or there are other devices?
It is STM32F103. Two TAPs in one chip.
« Last Edit: May 12, 2021, 03:28:29 pm by technix »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #62 on: May 12, 2021, 09:16:53 pm »
Is it possible that that specific device or revision is somehow not supported? It seems to be very close, you are getting meaningful values, but the overall output makes no sense.

Here is how relevant part looks in my case:
Quote
Info : 285 240 cmsis_dap_usb.c:1158 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Info : 286 242 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f3x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : 287 242 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f3x.bs tap/device found: 0x06438041 (mfg: 0x020 (STMicroelectronics), part: 0x6438, ver: 0x0)
Debug: 288 242 core.c:1374 jtag_validate_ircapture(): IR capture validation scan
Debug: 289 245 core.c:1431 jtag_validate_ircapture(): stm32f3x.cpu: IR capture 0x01
Debug: 290 245 core.c:1431 jtag_validate_ircapture(): stm32f3x.bs: IR capture 0x01
As you can see it just cleanly detects two devices.

In your case the phrase "UNEXPECTED: 0x00410041" is interesting. It looks like a correct value, just not recognized.
Alex
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #63 on: May 12, 2021, 09:23:29 pm »
Although your ID is not listed in the section 31.6.2 "Boundary scan TAP" of the reference manual.

They are generally similar, but none are the same: 0x06412041, 0x06410041, 0x16410041, 0x06414041, 0x06430041, 0x06418041. Their naming scheme with specifying "density" instead of the actual part numbers is stupid, so I have no idea which one corresponds to your device.

F103 is faked a lot, check that you don't have some really bad fake.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #64 on: May 12, 2021, 11:55:45 pm »
Although your ID is not listed in the section 31.6.2 "Boundary scan TAP" of the reference manual.

They are generally similar, but none are the same: 0x06412041, 0x06410041, 0x16410041, 0x06414041, 0x06430041, 0x06418041. Their naming scheme with specifying "density" instead of the actual part numbers is stupid, so I have no idea which one corresponds to your device.

F103 is faked a lot, check that you don't have some really bad fake.
It is not a fake, as scanning the chain using J-Link reports the correct ID's.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #65 on: May 13, 2021, 05:17:56 am »
In that case I really don't know what may be wrong or how to debug that with OpenOCD. It looks like it mostly works, and it also does not look like a signal integrity issue either.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #66 on: May 13, 2021, 05:35:41 am »
In that case I really don't know what may be wrong or how to debug that with OpenOCD. It looks like it mostly works, and it also does not look like a signal integrity issue either.
Code: [Select]
Warn : 180 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 160 0x80ffffff
Warn : 181 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 256 0xffffff80
Warn : 182 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 320 0xffffff80
Warn : 183 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 384 0xffff80ff
Warn : 184 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 448 0xff80ffff
Warn : 185 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 512 0x80ffffff
Warn : 186 294 core.c:1180 jtag_examine_chain_end(): Unexpected idcode after end of chain: 608 0xffffff80
Those are too periodic to be just random noise...
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #67 on: May 13, 2021, 05:37:13 am »
That's just some random stuff it tries to do after mistakenly detecting the wrong devices. I would not look at anything past the mis-detected chain. Until that works, everything else is useless.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #68 on: May 13, 2021, 09:00:23 am »
Well if it turns into hell supporting ARM's official code, I would rebase. Also once I got STM32F042 up and running I would be porting it to STM32F446 + USB HS with ULPI PHY. However I still don't have much idea on why that is not working...

(However with the current progress, my ATSAML11D16 module, also with a STM32F042-based CMSIS-DAP onboard debug probe and squeezed into a wide DIP-24 footprint, would be fully working.)
« Last Edit: May 13, 2021, 09:03:25 am by technix »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #69 on: May 14, 2021, 02:41:27 am »
JTAG support was now added - https://github.com/ataradov/free-dap

It was tested with ARM-specific commands (the handling between them and SWD was actually collapsed into a single function) and with simple bit-banging commands.

I can't guarantee that there are no errors, especially in edge cases, but generally it should work.

OpenOCD log attached for reference. It just does "mdw 0xe0042000" command as a test. This is the location of the device ID.

The size of the binary with JTAG support is 8296 bytes. Just SWD is 6824.
« Last Edit: May 14, 2021, 02:48:49 am by ataradov »
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #70 on: May 14, 2021, 03:21:34 am »
JTAG support was now added - https://github.com/ataradov/free-dap

It was tested with ARM-specific commands (the handling between them and SWD was actually collapsed into a single function) and with simple bit-banging commands.

I can't guarantee that there are no errors, especially in edge cases, but generally it should work.

OpenOCD log attached for reference. It just does "mdw 0xe0042000" command as a test. This is the location of the device ID.

The size of the binary with JTAG support is 8296 bytes. Just SWD is 6824.
Great!

On the other hand, I am having problems having edbg to talk to a ATSAML11D16 chip...
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #71 on: May 14, 2021, 03:33:40 am »
What sort of problems? There was an issue with L11 a few days ago, so make sure you are on the latest code base or binaries.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #72 on: May 14, 2021, 03:39:31 am »
What sort of problems? There was an issue with L11 a few days ago, so make sure you are on the latest code base or binaries.
Error connecting SWD. Somehow OpenOCD claim to have connected correctly, but not edbg.

I'll rebase first anyway, since it seem to me that your code is smaller than ARM's official code.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11258
  • Country: us
    • Personal site
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #73 on: May 14, 2021, 03:48:05 am »
I would need to see exact error message and how it was called to tell what may be wrong.

The issue was in an infinite loop when programming, but the part identification worked fine.
Alex
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Does anyone have experience debugging CMSIS-DAP firmware itself?
« Reply #74 on: May 14, 2021, 04:46:28 am »
I would need to see exact error message and how it was called to tell what may be wrong.
I think it was "Error: invalid response during transfer (count = 2/2, status = 3)" or something.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf