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

Add support for "Sipeed RV Debugger" (OCD-304) #142

Closed
wants to merge 1 commit into from

Conversation

markg85
Copy link

@markg85 markg85 commented Feb 12, 2021

Hi,

I asked support on the platformio forum to get this JTAG debugger working.
maxgerhardt, from that forum, helped me and asked me to make a pull request to add this file to this repository.

Note that i was using the ESP32-WROOM-32D.

Along with that i have to note that you folks are probably able to add proper support for that debugger with this file?
I intended to use this with:

debug_tool = sipeed-rv-debugger

in platformio but that currently doesn't work. The way i have it working now is with this platformio config:

debug_tool = custom
debug_port = localhost:3333

And in a command line from within the folder: ~/.platformio/packages/tool-openocd-esp32/ i'm running:

./bin/openocd -s share/openocd/scripts -f interface/ftdi/sipeed-rv-debugger.cfg -c "set ESP32_FLASH_VOLTAGE 3.3" -f target/esp32.cfg

Then it works and allows me to step through ESP code. Awesome!

The ESP32 pins i'm using to connect the debugger are:
GPIO12 — TDI
GPIO15 — TDO
GPIO13 — TCK
GPIO14 — TMS

As per the espressif documentation.

Lastly, i haven't done a compile test for this change. I followed how other config files were added and just adding the file seemed to be the way to go. Please let me know if more testing is required. If that is the case, please do tell me what and how to test that. Personally, i'd also love to have that debug_tool = sipeed-rv-debugger working in platformio. So if someone could help me a bit in understanding what needs to change to get that working?

Cheers,
Mark

@github-actions github-actions bot changed the title Add support for "Sipeed RV Debugger" Add support for "Sipeed RV Debugger" (OCD-304) Feb 12, 2021
@erhankur
Copy link
Collaborator

erhankur commented Feb 3, 2023

Hi @markg85, sorry for the late reply.

Can you please create a patch for the upstream OpenOCD repo? https://review.openocd.org/q/status:open+-is:wip

Our fork is completely aligned with the upstream. So, as soon as your patch is accepted, I will cherry-pick that commit.

I am closing this PR.

Thanks for your contribution.

@gudvinr
Copy link
Contributor

gudvinr commented Jul 26, 2023

I found out that bl702-based debugger might not work with stock firmware. With latest official firmware it does work but onboard UART stops working.

With firmware from jspngh both UART and JTAG debugging work with your config file using custom debug tool in PIO:

debug_tool = custom
debug_server =
  ${platformio.packages_dir}/tool-openocd-esp32/bin/openocd
  -c "gdb_port pipe; tcl_port disabled; telnet_port disabled"
  -f "interface/ftdi/sipeed-rv-debugger.cfg"
  -c "set ESP32_FLASH_VOLTAGE 3.3"
  -f "target/esp32.cfg"

Uploading via esptool doesn't work and times out but using openocd to upload works using this custom upload_protocol:

upload_protocol = custom
upload_flags =
  -c
  gdb_port pipe; tcl_port disabled; telnet_port disabled
  -f
  interface/ftdi/sipeed-rv-debugger.cfg
  -c
  set ESP32_FLASH_VOLTAGE 3.3
  -f
  target/esp32.cfg
upload_command = ${platformio.packages_dir}/tool-openocd-esp32/bin/openocd $UPLOAD_FLAGS -c "program_esp $SOURCE 0x10000 verify exit"

You can't use "Upload filesystem Image" because espressif32 platform file hardcodes uploader code for the case when upload protocol is the same as one of the debug_tool and with custom I don't see how to pass offset there.

For debug_tool = sipeed-rv-debugger to work I think espressif32 platform should be updated (platform.py specifically, to pass proper parameters to openocd).

@gudvinr
Copy link
Contributor

gudvinr commented Jul 27, 2023

@erhankur I submitted the patch for a review.
Config format was changed since this PR was created so I made a new one.

@gudvinr
Copy link
Contributor

gudvinr commented Aug 13, 2023

@erhankur it was merged into upstream

@erhankur
Copy link
Collaborator

Thanks @gudvinr it will be cherry-picked to our repo soon.

@erhankur
Copy link
Collaborator

@gudvinr 888e446 is merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants