Skip to content

Update gd32vf103.cfg#640

Merged
timsifive merged 1 commit into
riscv-collab:riscvfrom
groencode:patch-1
Aug 26, 2021
Merged

Update gd32vf103.cfg#640
timsifive merged 1 commit into
riscv-collab:riscvfrom
groencode:patch-1

Conversation

@groencode
Copy link
Copy Markdown
Contributor

After compiling OpenOCD from source (commit: 6edf98d), OpenOCD could not connect with the target board which is a GD32VF103T_START development board,
when I used the command: openocd -f "interface/cmsis-dap.cfg" -f "target/gd32vf103.cfg"

Issue 1: The clock speed hasn't been set, the error message given is:
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.
Which can be solved by adding a clock speed setting to the gd32vf103.cfg file:
adapter speed 1000

Issue 2: The default transport is not set to jtag, which it requires, the error shown is:
Open On-Chip Debugger 0.11.0+dev-01861-g6edf98db7-dirty (2021-08-25-10:18)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select '.
embedded:startup.tcl:128: Error: session transport is "swd" but your config requires JTAG
in procedure 'script'
at file "embedded:startup.tcl", line 26
in procedure 'jtag' called at file "/home/user/riscv-openocd-tool/usr/local/bin/../share/openocd/scripts/target/gd32vf103.cfg", line 9
in procedure 'default_to_jtag' called at file "embedded:startup.tcl", line 133
at file "embedded:startup.tcl", line 128
This issue can be solved by adding the line:
transport select jtag

After adding these two lines, OpenOCD could connect to the development board successfully. Programming the flash also works.

After compiling OpenOCD from source (commit: 6edf98d), OpenOCD could not connect with the target board which is a GD32VF103T_START development board,
when I used the command: openocd -f "interface/cmsis-dap.cfg" -f "target/gd32vf103.cfg"

Issue 1: The clock speed hasn't been set, the error message given is:
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.
Which can be solved by adding a clock speed setting to the gd32vf103.cfg file:
adapter speed 1000

Issue 2: The default transport is not set to jtag, which it requires, the error shown is:
Open On-Chip Debugger 0.11.0+dev-01861-g6edf98db7-dirty (2021-08-25-10:18)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
embedded:startup.tcl:128: Error: session transport is "swd" but your config requires JTAG
in procedure 'script' 
at file "embedded:startup.tcl", line 26
in procedure 'jtag' called at file "/home/user/riscv-openocd-tool/usr/local/bin/../share/openocd/scripts/target/gd32vf103.cfg", line 9
in procedure 'default_to_jtag' called at file "embedded:startup.tcl", line 133
at file "embedded:startup.tcl", line 128
This issue can be solved by adding the line:
transport select jtag

After adding these two lines, OpenOCD could connect to the development board successfully. Programming the flash also works.
Copy link
Copy Markdown
Collaborator

@timsifive timsifive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right to me, but I don't have a board to test it on.

Comment thread tcl/target/gd32vf103.cfg
@@ -1,3 +1,6 @@
adapter speed 1000
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels slow. Does it not work at 10000?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the command is: adapter speed [kHz], the speed of 1000 equals 1MHz.
And it is the fastest I have seen in a few examples, like this one:
https://github.com/riscv-mcu/GD32VF103_Demo_Suites/blob/master/openocd_gdlink.cfg

I have tried running the programming sequence with the speed of 10MHz, the flash worked, but the time consumption is the same with approximately 12 seconds. I would say 1000 is the best option for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I do all my debugging at 10MHz, but I've never used this target. If it works, why not leave it at the faster speed?

@timsifive timsifive merged commit 13cfec4 into riscv-collab:riscv Aug 26, 2021
en-sc added a commit to en-sc/riscv-openocd that referenced this pull request Oct 27, 2025
This reverts commit 13cfec4 ("Update
gd32vf103.cfg (riscv-collab#640)")

Change-Id: I505f12a78efc2da498adb0648116581a5103ec4c
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants