Skip to content

Commit c8c422e

Browse files
JzowFengqixian
andauthored
Translation tutorial 3 (#167)
* Translation tutorial 3 * Update README.CN.md * Update README.CN.md * Update README.CN.md * Update README.CN.md * Translate Chapter 4 Safe Globals * remove Chapter 4 Translation, modify the diff in Chapter 2 and Chapter 3 Co-authored-by: Fengqixian <[email protected]>
1 parent d942e0f commit c8c422e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

02_runtime_init/README.CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
[bss]: https://en.wikipedia.org/wiki/.bss
2020

2121
## 相比之前的变化(diff)
22+
请检查[英文版本](README.md#diff-to-previous),这是最新的。
2223

23-
Please check [the english version](README.md#diff-to-previous), which is kept up-to-date.

03_hacky_hello_world/README.CN.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 教程 03 - Hacky Hello World
2+
3+
## tl;dr
4+
5+
- 介绍全局的`println!()`宏以便尽早启用"printf debugging"。
6+
- 为了保持教程长度合理,打印函数目前 "滥用" 了 QEMU 属性,该属性允许我们在没有正确设置的情况下使用树莓派的`UART`
7+
- 在接下来的教程中将逐步使用真实硬件的`UART`
8+
9+
## 值得注意的补充
10+
11+
- `src/console.rs`为控制台命令和通过`console::console()`对内核控制台的全局访问引入了接口`Traits`
12+
- `src/bsp/raspberrypi/console.rs` 实现QEMU仿真UART的接口。
13+
- 紧急处理程序使用新的`println!()`以显示用户错误消息。
14+
- 有一个新的Makefile目录`make test`,用于自动测试。它在`QEMU`中引导编译后的内核,并检查内核生成的预期输出字符串。
15+
- 在本教程中,它检查字符串`Stopping here`,该字符串由`panic!()``main.rs`的末尾。
16+
17+
## 测试一下
18+
19+
QEMU不再以汇编模式运行。从现在起,它将显示`console`的输出。
20+
21+
```console
22+
$ make qemu
23+
[...]
24+
25+
Hello from Rust!
26+
Kernel panic!
27+
28+
Panic location:
29+
File 'src/main.rs', line 126, column 5
30+
31+
Stopping here.
32+
```
33+
34+
## 相比之前的变化(diff)
35+
请检查[英文版本](README.md#diff-to-previous),这是最新的。

0 commit comments

Comments
 (0)