Embedded Rust on RISC-V Part 1

所在平台: Udemy

课程主页: https://www.udemy.com/course/embedded-rust-on-risc-v-part-1/

课程评论:没有评论

第一个写评论        关注课程

课程简介

**Coursera 课程概览:RISC-V 嵌入式 Rust(第一部分)** 本课程专注于将 Rust 语言应用于 RISC-V 嵌入式系统,重点在于从零开始构建并最终在 HiFive1-RevB 开发板上运行嵌入式 Rust 程序。课程**不包含**工具链的安装指导。 **核心内容与结构:** * **第一部分:入门介绍** * 课程内容概览(涵盖与未涵盖部分) * 资源说明与学习期望 * **第二部分:Cargo 工作区管理** * 创建 Cargo 工作区 * 构建可执行二进制 crate * 创建可复用代码的库 crate * 配置 `Cargo.toml` 管理依赖 * **第三部分:RISC-V 嵌入式 Rust 与 Cargo 配置** * 理解嵌入式 Rust 的目标 (Target) * Rust 属性 (Attributes) 的作用 * 定义自定义 panic 处理函数和入口函数 * `Cargo.toml` 与 `Cargo.toml` 之间的区别 * 配置 Cargo 工作区以针对 RISC-V 构建而非宿主 * 向 Rust 编译器传递额外标志 * 为目标(HiFive1-RevB)传递自定义链接器文件 (注:不讲解如何编写链接器文件,但提供下载资源) * **第四部分:解析 ELF 和 RUSTFLAGS 命令** * 从 ELF 文件提取信息的命令 * `RUSTFLAGS` 变量用于调整编译器行为 * 使用 `RUSTFLAGS` 添加自定义链接器文件 * **第五部分:简单的 RISC-V 启动代码 (二进制 Crate)** * 添加汇编文件 (`.S`) * 在启动时禁用中断 * 设置堆栈指针 (Stack Pointer) 到有效位置 * 实现从 RISC-V 汇编跳转到嵌入式 Rust 入口函数 * 构建包含 RISC-V 汇编启动代码和 Rust 入口/panic 处理的出色可执行文件 * **第六部分:Rust UART 驱动 (库 Crate)** * 使用 Rust 的结构体 (Structs) 和实现 (Impls) * 实现 UART 驱动函数 * 构建包含 RISC-V 汇编启动代码和 Rust UART 驱动的可执行文件 * 使用 OpenOCD 和 GDB 服务器连接到 HiFive1-RevB 开发板 * 将可执行文件加载到 HiFive1-RevB * 通过串口工具读取输出信息 (注:使用 OpenOCD 脚本,但不深入讲解脚本内容,提供下载资源) **更新:** 2024年12月5日,在第五部分附加了 `boot.S` 文件。

课程评论(0条)

课程详情

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: IntroductionIntroductionPreambleWhat is covered & what isn'tResources & expectationSection 2: Cargo WorkspaceCreate Cargo workspaceCreate a binary crate to build an executableCreate library crate to keep reusable codeCreate Cargo.toml to manage dependenciesThen this course jumps into the Embedded-rust & Cargo settings. Section 3: Embedded-rust and Cargo settings for RISC-V Embedded Rust targetWhat are attributes in Rust?What is Embedded Rust?Provide custom panic handler and entry functionThe difference between Cargo toml file vs config fileHow 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 ELFRUSTFLAGS in rust to tweak compiler behaviourHow to add custom linker file with RUSTFLAGSWith 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 timeSet the stack pointer to valid locationHow 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 RustSection 6: UART Driver in Rust (Library Crate)Structs and Impls in RustUart driver functionsBuild an executable with boot code in RISC-V asm and UART driver in Rust.Connect to Hifive1-RevB board with OpenOCD & GDB serverLoad the executable into Hifive1-RevBRead messages from serial out with serial toolsNOTE: 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

课程标签

0人关注该课程

主题相关的课程