Skip to content

Add SDI print support for CH32H41x#118

Open
maximeborges wants to merge 1 commit into
ch32-rs:mainfrom
maximeborges:feat/ch32h41x-sdi-print
Open

Add SDI print support for CH32H41x#118
maximeborges wants to merge 1 commit into
ch32-rs:mainfrom
maximeborges:feat/ch32h41x-sdi-print

Conversation

@maximeborges

Copy link
Copy Markdown

Summary

Enables wlink sdi-print for 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, so wlink sdi-print enable --chip CH32H41X failed with "Chip doesn't support SDI print functionality".

This adds CH32H41X to that match, plus a unit test and a changelog entry.

Changes

  • src/lib.rs: add RiscvChip::CH32H41X to support_sdi_print().
  • src/lib.rs: add unit test ch32h41x_supports_sdi_print.
  • CHANGELOG.md: note under [Unreleased].

Testing

  • cargo test passes (incl. the new test).

  • Verified end-to-end on hardware: CH32H417QEU (ChipID 0x4170052d), WCH-LinkE (RV mode, firmware v2.18). After wlink 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 CH32H417 hartinfo (DMI 0x12) reads 0x00212340DATA0/DATA1 @ 0xE0000340/0xE0000344not the CH32V-series 0xE0000380.

A minimal, verified example is here: openwch/ch32h417#13 (cf. the ch32v003 SDI_Printf example already referenced in src/main.rs).

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