Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading and Debugging for e505 fails with OpenOCD #45

Open
MarvFPV opened this issue Apr 18, 2023 · 15 comments
Open

Uploading and Debugging for e505 fails with OpenOCD #45

MarvFPV opened this issue Apr 18, 2023 · 15 comments

Comments

@MarvFPV
Copy link

MarvFPV commented Apr 18, 2023

Hiya,
am getting an issue where i can't seem to get opencd to work on a gd32e505re.

This is the error message:

Building in release mode
Checking size .pio\build\genericGD32E505RE\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 36 bytes from 131072 bytes)
Flash: [          ]   0.2% (used 976 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, gdlinkcli, jlink, serial, sipeed-rv-debugger, stlink
CURRENT: upload_protocol = cmsis-dap
Uploading .pio\build\genericGD32E505RE\firmware.elf
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:33)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

swd
0
embedded:startup.tcl:26: Error: Can't find target/gd32e50x.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 26
*** [upload] Error 1

I tried manually adding the gd32e50x.cfg from here but that gives me this error message:

Building in release mode
Checking size .pio\build\genericGD32E505RE\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 36 bytes from 131072 bytes)
Flash: [          ]   0.2% (used 976 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, gdlinkcli, jlink, serial, sipeed-rv-debugger, stlink
CURRENT: upload_protocol = cmsis-dap
Uploading .pio\build\genericGD32E505RE\firmware.elf
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:33)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

swd
0
target halted due to debug-request, current mode: Thread 
xPSR: 0xf9000000 pc: 0x080001e0 msp: 0x20020000
** Programming Started **
Error: Cannot identify target as a stm32x
Error: auto_probe failed
embedded:startup.tcl:1136: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1201
at file "embedded:startup.tcl", line 1136
*** [upload] Error 1

For reference, this is what my env looks like:

[env:genericGD32E505RE]
board = genericGD32E505RE
framework = spl
upload_protocol = cmsis-dap
debug_tool = cmsis-dap

Any input on what i'm doing wrong?

@maxgerhardt
Copy link
Member

maxgerhardt commented Apr 18, 2023

Not good at all. What's your full platformio.ini? The config you show is at least missing platform = ...

You may also be running an old version of it, in which case I'd recommend the simplest update / reinstall way of deleting C:\Users\<user>\.platformio\platforms\gd32* and rebuilding.

@MarvFPV
Copy link
Author

MarvFPV commented Apr 18, 2023

I installed everything a good... 3 weeks ago. but yea, i'll retry. With this chip i'm still dabbling around in the blinky example so the platform is set further at the top in the file😅

@MarvFPV MarvFPV changed the title Uploading and Debugging gor e505 fails with OpenOCD Uploading and Debugging for e505 fails with OpenOCD Apr 18, 2023
@MarvFPV
Copy link
Author

MarvFPV commented Apr 18, 2023

Update, same issue after reinstalling (and removing my "custom" .cfg file)

@maxgerhardt
Copy link
Member

I'm having the feeling the wrong OpenOCD version is used. I need to check some things.

@maxgerhardt
Copy link
Member

The latest published version does indeed not have a gd32e50x.cfg. This likely means I screwed up and haven't yet published the latest version into the PIO registry. I need to double check this on my computer later.

@maxgerhardt
Copy link
Member

Ha. The last OpenOCD build of us seems to still be at

https://github.com/CommunityGD32Cores/pre-releases/releases/tag/test

For Windows, please download https://github.com/CommunityGD32Cores/pre-releases/releases/download/test/xpack-openocd-0.11.0-3-win32-x64.zip

Go to C:\Useres\<user>\.platformio\packages\tool-openocd-gd32. Delete all files except the package.json. Then extract the above zip file in the folder. Does it work now?

@MarvFPV
Copy link
Author

MarvFPV commented Apr 18, 2023

almost, after also not deleting the .piopm file^^

I can flash code now but debugging using cmsis-dap still does not work. i get a unable to find a matching CMSIS-DAP device error.

@MarvFPV
Copy link
Author

MarvFPV commented Apr 18, 2023

Interesting, after trying a second time it works. flashing also doesn't seem to always work... probably wiring issues... i'll play around a bit more and report if i find a pattern.

@maxgerhardt
Copy link
Member

If upload_protocol = cmsis-dap does not work consistently, does upload_protocol = gdlinkcli work? This uses the original GigaDevice upload tool. (But no debugging possible with that tool)

@MarvFPV
Copy link
Author

MarvFPV commented Apr 18, 2023

so far, the cmsis-dap has worked fine(after that initial hiccup).

@MarvFPV
Copy link
Author

MarvFPV commented Apr 20, 2023

@maxgerhardt last question(ish), do you have an estimate when the changes will be added to the release version?

@maxgerhardt
Copy link
Member

I'll be publishing the up-to-date packages today, but that just sends them in "for review", after which by experience it'll take 1-2 weeks to appear in the PIO registry.

@josedelinux
Copy link

josedelinux commented Aug 15, 2024

Please update OpenOCD to 0.12.0, current version 0.11.0 failed to upload on my cheap Chinese dap debugger
mine work on upstream OpenOCD 0.12.0 (installed from scoop)
and while with gd32-openocd i got this


pio run --target upload --verbose
Processing PDA_GD32F103VE (board: genericGD32F103VE; framework: spl; upload_protocol: cmsis-dap; build_flags: -Wno-unused-function, -Wno-unused-variable; debug_tool: cmsis-dap; debug_speed: 72000; platform: https://github.com/CommunityGD32Cores/platform-gd32.git; platform_packages: framework-spl-gd32@https://github.com/josedelinux/gd32-pio-spl-package.git)
------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/gd32/genericGD32F103VE.html
PLATFORM: GD GD32 (1.0.0+sha.8df3968) (git+https://github.com/CommunityGD32Cores/platform-gd32.git) > GD32F103VE (64k RAM, 512k Flash)
HARDWARE: GD32F103VET6 108MHz, 64KB RAM, 512KB Flash
DEBUG: Current (cmsis-dap) External (blackmagic, cmsis-dap, jlink, sipeed-rv-debugger, stlink)
PACKAGES:
 - framework-spl-gd32 @ 2.10000.0+sha.3854db9 (git+https://github.com/josedelinux/gd32-pio-spl-package.git)
 - tool-dfuutil @ 1.9.200310
 - tool-gdlinkcli @ 2.40611.220807+sha.74386ec (git+https://github.com/CommunityGD32Cores/pio-gd32-gdlinkcli.git)
 - tool-openocd-gd32 @ 2.1100.211207 (11.0)
 - tool-stm32duino @ 1.0.2
 - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1)
==== STARTUP FILE: startup_gd32f10x_hd.S ======
SPL libraries are included: True
CMSIS libraries are included: True
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Added CMSIS-DSP library for arm_cortexM3l_math
Found 14 compatible libraries
Scanning dependencies...
Dependency Graph
|-- printf (License: Unknown, Path: lib\printf)
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\PDA_GD32F103VE\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.1% (used 36 bytes from 65536 bytes)
Flash: [          ]   1.8% (used 9268 bytes from 524288 bytes)
.pio\build\PDA_GD32F103VE\firmware.elf  :

section              size        addr

.isr_vector           304   134217728

.text                9088   134218032

.rodata               168   134227120

.ARM                    8   134227288

.init_array             4   134227296

.fini_array             4   134227300

.data                   4   536870912

.bss                   32   536870916

._user_heap_stack    1536   536870948

.ccram_bss              0   268435456

.ccram_data             0   268435456

.ARM.attributes        41           0

.comment              102           0

.debug_frame          660           0

Total               11951
<lambda>(["upload"], [".pio\build\PDA_GD32F103VE\firmware.elf"])
AVAILABLE: blackmagic, cmsis-dap, dfu, gdlinkcli, jlink, serial, sipeed-rv-debugger, stlink
CURRENT: upload_protocol = cmsis-dap
openocd -d2 -s C:\Users\Jose\.platformio\packages\tool-openocd-gd32/scripts -f interface/cmsis-dap.cfg -c "transport select swd" -c "set CPUTAPID 0" -f target/stm32f1x.cfg -c "adapter speed 72000" -c "program {.pio\build\PDA_GD32F103VE\firmware.elf}  verify reset; shutdown;"
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:33)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

swd
0
Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,disable}
adapter speed: 72000 kHz

Error: unable to find a matching CMSIS-DAP device
Error: No Valid JTAG Interface Configured.
*** [upload] Error 4294967295
============================================== [FAILED] Took 1.65 seconds ==============================================

@maxgerhardt
Copy link
Member

The platform mostly uses STM32 scripts anyways for GD32. Can you manually overwrite the files in C:\Users\<user>\.platformio\packages\tool-openocd-gd32 with your 0.12.0 version?

@josedelinux
Copy link

josedelinux commented Aug 16, 2024

manually overwrite the files in C:\Users\<user>\.platformio\packages\tool-openocd-gd32 with your 0.12.0 version?

Yeah, it works when I overwrite the bin directory with binaries copy from tool-openocd
thanks

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

No branches or pull requests

3 participants