-
-
Notifications
You must be signed in to change notification settings - Fork 833
Translation tutorial 3 #167
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9db3966
Translation tutorial 3
Fengqixian 1d49c9d
Update README.CN.md
Jzow 85fa50a
Update README.CN.md
Jzow 1275cfa
Update README.CN.md
Jzow 6c4d1fc
Update README.CN.md
Jzow ebb662c
Translate Chapter 4 Safe Globals
Jzow b90cb10
remove Chapter 4 Translation, modify the diff in Chapter 2 and Chapter 3
Jzow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`的末尾。 | ||
Jzow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 测试一下 | ||
|
||
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),这是最新的。 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.