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 <570311238@qq.com>
pull/171/head
James Zow 2 years ago committed by GitHub
parent d942e0f953
commit c8c422e995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,5 +19,5 @@
[bss]: https://en.wikipedia.org/wiki/.bss
## 相比之前的变化diff
请检查[英文版本](README.md#diff-to-previous),这是最新的。
Please check [the english version](README.md#diff-to-previous), which is kept up-to-date.

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