File tree 2 files changed +36
-1
lines changed
2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 19
19
[ bss ] : https://en.wikipedia.org/wiki/.bss
20
20
21
21
## 相比之前的变化(diff)
22
+ 请检查[ 英文版本] ( README.md#diff-to-previous ) ,这是最新的。
22
23
23
- Please check [ the english version] ( README.md#diff-to-previous ) , which is kept up-to-date.
Original file line number Diff line number Diff line change
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 ) ,这是最新的。
You can’t perform that action at this time.
0 commit comments