Skip to content

Update RISC-V Demo for Spike simulator - #1415

Draft
JanMatCodasip wants to merge 1 commit into
FreeRTOS:mainfrom
JanMatCodasip:fix-riscv-spike-demo
Draft

JanMatCodasip wants to merge 1 commit into
FreeRTOS:mainfrom
JanMatCodasip:fix-riscv-spike-demo

Conversation

@JanMatCodasip

@JanMatCodasip JanMatCodasip commented Jun 24, 2026

Copy link
Copy Markdown

Description

Some commands in the Makefile and OpenOCD config file had to be updated to work with the current OpenOCD and RISC-V toolchain.

Makefile:

  • Zicsr is now a standalone extension, so update the value of the -march argument, passed to GCC.

spike-1.cfg for OpenOCD:

  • Update commands that changed their syntax - avoid deprecation warnings.
  • Remove "adapter_khz" command - the virtual jtag_vpi adapter does not have any concept of clock frequency.
  • Update -expected-id to match the JTAG IDCODE used by the Spike simulator.
  • Fix the syntax of the "expr" command.
  • Remove the command that zeroes mstatus register upon startup, as this would break the program operation. It is unclear why the command was there in the first place.

Test Steps

...
Info : [riscv.cpu] Examined RISC-V core
Info : [riscv.cpu]  XLEN=32, misa=0x40141101
Info : [riscv.cpu] Examination succeed
Info : [riscv.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
...

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Some commands in the Makefile and OpenOCD config file
had to be updated to work with the current OpenOCD
and RISC-V toolchain.

Makefile:

- Zicsr is now a standalone extension, so update the value
  of the -march argument, passed to GCC.

spike-1.cfg for OpenOCD:

- Update commands that changed their syntax - avoid
  deprecation warnings.
- Remove "adapter_khz" command - the virtual jtag_vpi
  adapter does not have any concept of clock frequency.
- Update -expected-id to match the JTAG IDCODE used
  by the Spike simulator.
- Fix the syntax of the "expr" command.
- Remove the command that zeroes mstatus register upon
  startup, as this would break the program operation.
  It is unclear why the command was there in the first place.

Signed-off-by: Jan Matyas <[email protected]>
@JanMatCodasip
JanMatCodasip marked this pull request as draft June 24, 2026 11:38
@JanMatCodasip

JanMatCodasip commented Jun 24, 2026

Copy link
Copy Markdown
Author

I’m keeping this PR in draft for now because, as of June 2026, FreeRTOS support for RISC-V in OpenOCD is still in a complicated state:

  • The riscv-openocd fork includes some FreeRTOS support for RISC-V, but the codebase is outdated and stale.
  • Mainline OpenOCD currently does not support FreeRTOS on RISC-V.

Even so, the changes in this PR may be useful to other developers working on FreeRTOS support in OpenOCD, so I’m publishing them in draft form.

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.

1 participant