Embedded Rust on RISC-V Part 1
Benix Samuel Vincent Theogaraj
2:43:24
Description
Bootstrap RISC-V target
What You'll Learn?
- How to create a rust workspace ?
- How to configure the rust toolchain for RISC-V?
- How to mix RISC-V assembly with rust?
- Code to bootstrap RISC-V target into embedded rust
Who is this for?
What You Need to Know?
More details
DescriptionFirst and foremost, this course don't cover toolchain installation This course starts with building blocks needed to bootstrap RISC-V processor into rust and finishes by booting Hifive1-Rev B board into Embedded Rust. Regarding the code management, there are many ways to manage code in rust; this course adopts Cargo workspace.
Section 1: Introduction
Introduction
Preamble
What is covered & what isn't
Resources &Â expectation
Section 2: Cargo Workspace
Create Cargo workspace
Create a binary crate to build an executable
Create library crate to keep reusable code
Create Cargo.toml to manage dependencies
Then this course jumps into the Embedded-rust & Cargo settings.
Section 3: Embedded-rust and Cargo settings for RISC-V Embedded Rust target
What are attributes in Rust?
What is Embedded Rust?
Provide custom panic handler and entry function
The difference between Cargo toml file vs config file
How to configure Cargo Workspace to build for RISC-V instead of host?
How to pass additional flags to Rust compiler?
How to pass custom linker file for target (Hifive1-RevB board)?
NOTE: This course don't cover how to write linker file. However, the linker file is shared as downloadable resource.
Section 4: Commands to dissect ELF and RUSTFLAGS
Commands to extract information from ELF
RUSTFLAGS in rust to tweak compiler behaviour
How to add custom linker file with RUSTFLAGS
With workspace & code management taken care, next is to add RISC-VÂ boot up code in RISC-V assembly.
Section 5: Simple RISC-V boot code  (Binary Crate)
How to add a assembly (.S)Â file?
Disable interrupts at boot time
Set the stack pointer to valid location
How to jump from RISC-V assembly to Embedded Rust entry function?
Build an executable with boot code in RISC-V assembly with entry &Â panic handler in Rust
Section 6: UART Driver in Rust (Library Crate)
Structs and Impls in Rust
Uart driver functions
Build an executable with boot code in RISC-VÂ asm and UART driver in Rust.
Connect to Hifive1-RevB board with OpenOCDÂ &Â GDBÂ server
Load the executable into Hifive1-RevB
Read messages from serial out with serial tools
NOTE: This section uses a OpenOCDÂ script but don't discuss about the script content. However, the script is shared as downloadable resource.Â
Update on Dec 5, 2024:Â Attached boot.S file on Section #5
Who this course is for:
- Beginner embedded rust developers interested to run rust on RISC-V
First and foremost, this course don't cover toolchain installation This course starts with building blocks needed to bootstrap RISC-V processor into rust and finishes by booting Hifive1-Rev B board into Embedded Rust. Regarding the code management, there are many ways to manage code in rust; this course adopts Cargo workspace.
Section 1: Introduction
Introduction
Preamble
What is covered & what isn't
Resources &Â expectation
Section 2: Cargo Workspace
Create Cargo workspace
Create a binary crate to build an executable
Create library crate to keep reusable code
Create Cargo.toml to manage dependencies
Then this course jumps into the Embedded-rust & Cargo settings.
Section 3: Embedded-rust and Cargo settings for RISC-V Embedded Rust target
What are attributes in Rust?
What is Embedded Rust?
Provide custom panic handler and entry function
The difference between Cargo toml file vs config file
How to configure Cargo Workspace to build for RISC-V instead of host?
How to pass additional flags to Rust compiler?
How to pass custom linker file for target (Hifive1-RevB board)?
NOTE: This course don't cover how to write linker file. However, the linker file is shared as downloadable resource.
Section 4: Commands to dissect ELF and RUSTFLAGS
Commands to extract information from ELF
RUSTFLAGS in rust to tweak compiler behaviour
How to add custom linker file with RUSTFLAGS
With workspace & code management taken care, next is to add RISC-VÂ boot up code in RISC-V assembly.
Section 5: Simple RISC-V boot code  (Binary Crate)
How to add a assembly (.S)Â file?
Disable interrupts at boot time
Set the stack pointer to valid location
How to jump from RISC-V assembly to Embedded Rust entry function?
Build an executable with boot code in RISC-V assembly with entry &Â panic handler in Rust
Section 6: UART Driver in Rust (Library Crate)
Structs and Impls in Rust
Uart driver functions
Build an executable with boot code in RISC-VÂ asm and UART driver in Rust.
Connect to Hifive1-RevB board with OpenOCDÂ &Â GDBÂ server
Load the executable into Hifive1-RevB
Read messages from serial out with serial tools
NOTE: This section uses a OpenOCDÂ script but don't discuss about the script content. However, the script is shared as downloadable resource.Â
Update on Dec 5, 2024:Â Attached boot.S file on Section #5
Who this course is for:
- Beginner embedded rust developers interested to run rust on RISC-V
User Reviews
Rating
Benix Samuel Vincent Theogaraj
Instructor's Courses
Udemy
View courses Udemy- language english
- Training sessions 18
- duration 2:43:24
- Release Date 2025/03/09