Add SDI print support for CH32H41x#118
Open
maximeborges wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables
wlink sdi-printfor the CH32H41x family (CH32H415/H416/H417). The chip already has flashing/chip-id/alias support (added in #), but SDI print was gated off:RiscvChip::support_sdi_print()listed every SDI-capable family except CH32H41x, sowlink sdi-print enable --chip CH32H41Xfailed with "Chip doesn't support SDI print functionality".This adds
CH32H41Xto that match, plus a unit test and a changelog entry.Changes
src/lib.rs: addRiscvChip::CH32H41Xtosupport_sdi_print().src/lib.rs: add unit testch32h41x_supports_sdi_print.CHANGELOG.md: note under[Unreleased].Testing
cargo testpasses (incl. the new test).Verified end-to-end on hardware: CH32H417QEU (ChipID
0x4170052d), WCH-LinkE (RV mode, firmware v2.18). Afterwlink sdi-print enable --chip CH32H41X,printf()output streamed out the WCH-Link CDC serial port at 115200 with no UART wiring:SystemClk:400000000
V3F SystemCoreClk:100000000
SDI print test 0
SDI print test 1
...
Firmware-side note
SDI print requires the firmware to write to the memory-mapped Debug Module data registers
DATA0/DATA1. Their address is chip-specific:0xE0000000 + hartinfo.dataaddr. On the CH32H417hartinfo(DMI0x12) reads0x00212340→DATA0/DATA1 @ 0xE0000340/0xE0000344— not the CH32V-series0xE0000380.A minimal, verified example is here: openwch/ch32h417#13 (cf. the ch32v003 SDI_Printf example already referenced in
src/main.rs).