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

New feature: Serial watch #36

Merged
merged 6 commits into from Nov 5, 2023
Merged

New feature: Serial watch #36

merged 6 commits into from Nov 5, 2023

Conversation

andelf
Copy link
Contributor

@andelf andelf commented Nov 4, 2023

This is designed to print serial logs.

  • Can be used with --enable-sdi-print for a smooth dev experience
  • Can be used with UART print

Usage:

wlink -v flash --enable-sdi-print --watch-serial xxx.bin
> wlink flash --enable-sdi-print --watch-serial target/riscv32ec-unknown-none-elf/release/examples/sdi-debug
16:04:37 [INFO] WCH-Link v2.11 (WCH-LinkE-CH32V305)
16:04:37 [INFO] Attached chip: CH32V003 [CH32V003F4P6] (ChipID: 0x00300500)
16:04:37 [INFO] Chip UID: cd-ab-80-17-48-bc-95-7f
16:04:37 [INFO] Flash protected: false
16:04:37 [INFO] Read target/riscv32ec-unknown-none-elf/release/examples/debug as ELF format
16:04:37 [INFO] Firmware size: 4037, start_address: 0x00000000, end_address: 0x00000fc5
16:04:37 [INFO] Flashing 4037 bytes to 0x08000000
16:04:37 [INFO] WCH-Link v2.11 (WCH-LinkE-CH32V305)
16:04:37 [INFO] Attached chip: CH32V003 [CH32V003F4P6] (ChipID: 0x00300500)
16:04:37 [INFO] Flash already unprotected
16:04:37 [INFO] Flash protected: false
16:04:38 [INFO] Flash done
16:04:38 [INFO] Now reset...
16:04:38 [INFO] Now connect to the WCH-Link serial port to read SDI print
gle
Hello world from ch32v003 SDI print!
led toggle
led toggle
led toggle
^C
>

Note that "gle" is from previous content(before reset).

@andelf
Copy link
Contributor Author

andelf commented Nov 4, 2023

@UCSIG I've tested on macOS.
Could you help to check if this works on Linux or Windows?

Cargo.toml Outdated Show resolved Hide resolved
@andelf andelf merged commit b54314c into main Nov 5, 2023
1 check passed
@andelf andelf deleted the feat/impl-sdi-print branch November 5, 2023 02:58
@UCSIG
Copy link

UCSIG commented Nov 14, 2023

That's a super useful feature, thanks!

@UCSIG I've tested on macOS. Could you help to check if this works on Linux or Windows?

Yes, it works perfectly. I've tested it on Windows 23H2 as well as under Ubuntu 22.04 in wsl.
I think it would also be beneficial to add the --watch-serial option to the sdi-print command when enable is specified as the subcommand.
Currently, when the wch-link debugger accidently disconnects or the user switches to a different usb port, the flash command has to be invoked again and a new flash process has to be started just to get the serial terminal active again.

@andelf
Copy link
Contributor Author

andelf commented Nov 14, 2023

I think it would also be beneficial to add the --watch-serial option to the sdi-print command when enable is specified as the subcommand.

Indeed.

@thirstyone
Copy link

stupid question about speed settings? (probably irrelevant) + feature request: make it warn users, that SDI print doesn't work with their WCH-Link v2.9 (and probably suggest to upgrade the probe firmware :-)

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.

None yet

4 participants