riscv-rust / riscv-rust-quickstart

A template for building Rust applications for HiFive1 boards
205 stars 24 forks source link

Where is stdout? #16

Closed githubquestions closed 4 years ago

githubquestions commented 4 years ago

Another beginnger question. Working my way through examples, and sprintln macro very useful to make sure working. Problem is not exactly sure how to view output.

As example, hello_world, upon running, output:

0x00001004 in ?? ()
JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive Inc),      part: 0x0000, ver: 0x2)
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not      sent! (2135). Workaround: increase "set remotetimeout" in GDB
Loading section .text, size 0x5c4a lma 0x20010000
Loading section .rodata, size 0xa94 lma 0x20015c50
Start address 0x20010000, load size 26334
Transfer rate: 4 KB/sec, 8778 bytes/write.

In openocd

Info : accepting 'gdb' connection on tcp/3333
Info : JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive     Inc), part: 0x0000, ver: 0x2)
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet   not sent! (1993). Workaround: increase "set remotetimeout" in GDB
Info : JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive     Inc), part: 0x0000, ver: 0x2)
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet   not sent! (2043). Workaround: increase "set remotetimeout" in GDB
Info : Padding image section 0 at 0x20015c4a with 6 bytes
Info : JTAG tap: riscv.cpu tap/device found: 0x20000913 (mfg: 0x489 (SiFive     Inc), part: 0x0000, ver: 0x2)
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet
not sent! (2134). Workaround: increase "set remotetimeout" in GDB
Disasm commented 4 years ago

You need to connect to the on-board seral port exposed to your operating system. sprintln will not print to the gdb nor openocd output.

Disasm commented 4 years ago

See also: https://docs.rust-embedded.org/discovery/10-serial-communication/index.html

githubquestions commented 4 years ago

Wow thanks for very fast response and it works! Some reason serial output is not as expected though where sprintln! output is single unicode char like sprintln!("hello world!"); appears as T, sprintln!("Starting blink loop") as b

edit: hooray it works was just an issue with emulator. Thank you this is getting fun!