-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46ce64f
commit 8469095
Showing
8 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Blink LED | ||
|
||
In this section, we'll learn how to blink an LED using the Raspberry Pi Pico 2. | ||
In this section, we'll learn how to blink an LED using the Raspberry Pi Pico 2. In embedded system programming, blinking an LED is the equivalent of "Hello, World!" | ||
|
||
- [With rp-rs](./rp-rs.md) | ||
- [With embassy](./embassy.md) |
This file contains 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
File renamed without changes.
This file contains 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,29 @@ | ||
# Introduction | ||
|
||
If you haven't read "The Embedded Rust Book" yet, I highly recommend you to check it out. | ||
[https://docs.rust-embedded.org/book/intro/index.html](https://docs.rust-embedded.org/book/intro/index.html) | ||
|
||
## #![no_std] | ||
The `#![no_std]` attribute disables the use of the standard library (std). This is necessary most of the times for embedded systems development, where the environment typically lacks many of the resources (like an operating system, file system, or heap allocation) that the standard library assumes are available. | ||
|
||
**Related Resources:** | ||
- [Rust official doc](https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute) | ||
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/intro/no-std.html) | ||
- [Writing an OS in Rust Book](https://os.phil-opp.com/freestanding-rust-binary/#the-no-std-attribute) | ||
|
||
## #![no_main] | ||
The `#![no_main]` attribute is to indicate that the program won't use the standard entry point (fn main). Instead, it provides a custom entry point, usually required when working with embedded systems where the runtime environment is minimal or non-existent. | ||
|
||
**Related Resources:** | ||
- [Rust official doc](https://doc.rust-lang.org/reference/crates-and-source-files.html?highlight=no_main#the-no_main-attribute) | ||
- [Writing an OS in Rust Book](https://os.phil-opp.com/freestanding-rust-binary/#overwriting-the-entry-point) | ||
|
||
|
||
## Panic Handler | ||
A panic handler is a function in Rust that defines what happens when your program encounters a panic. In environments without the standard library (when using no_std attribute), you need to create this function yourself using the #[panic_handler] attribute. This function must follow a specific format and can only appear once in your program. It provides details about the error, such as where it happened and why. By setting up a panic handler, you can choose how to respond to errors, like logging them for later review or stopping the program completely. | ||
|
||
You don't have to define your own panic handler function; you can use existing crates such as panic_halt or panic_probe instead. | ||
|
||
**Related Resources:** | ||
- [Rust official doc](https://doc.rust-lang.org/nomicon/panic-handler.html) | ||
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/start/panicking.html) |
This file contains 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,19 @@ | ||
# Introduction | ||
|
||
If you haven't read "The Embedded Rust Book" yet, I highly recommend you to check it out. | ||
[https://docs.rust-embedded.org/book/intro/index.html](https://docs.rust-embedded.org/book/intro/index.html) | ||
|
||
## #![no_std] | ||
The `#![no_std]` attribute disables the use of the standard library (std). This is necessary most of the times for embedded systems development, where the environment typically lacks many of the resources (like an operating system, file system, or heap allocation) that the standard library assumes are available. | ||
|
||
**Related Resources:** | ||
- [Rust official doc](https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute) | ||
- [The Embedded Rust Book](https://docs.rust-embedded.org/book/intro/no-std.html) | ||
- [Section from 'Writing an OS in Rust ' Book](https://os.phil-opp.com/freestanding-rust-binary/#the-no-std-attribute) | ||
|
||
## #![no_main] | ||
The `#![no_main]` attribute is to indicate that the program won't use the standard entry point (fn main). Instead, it provides a custom entry point, usually required when working with embedded systems where the runtime environment is minimal or non-existent. | ||
|
||
**Related Resources:** | ||
- [Rust official doc](https://doc.rust-lang.org/reference/crates-and-source-files.html?highlight=no_main#the-no_main-attribute) | ||
- [Section from 'Writing an OS in Rust ' Book](https://os.phil-opp.com/freestanding-rust-binary/#overwriting-the-entry-point) |
This file contains 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