-
Notifications
You must be signed in to change notification settings - Fork 0
Update README.md #2
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6881515
Update README.md
LirisFlow c47725f
Update README.md
LirisFlow f642860
Update freertos/README.md
LirisFlow ddd5876
Update README.md
LirisFlow 03b19f6
Update README.md
LirisFlow e6d1c96
Update README.md
LirisFlow c0024d0
Update README.md
LirisFlow 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 |
|---|---|---|
| @@ -1,60 +1,69 @@ | ||
| # FreeRTOS | ||
|
|
||
| [](https://github.com/mcu-rust/freertos/actions) | ||
| [](https://crates.io/crates/freertos-next) | ||
| [](https://docs.rs/freertos-next) | ||
| [](./LICENSE) | ||
| [](https://crates.io/crates/freertos-next) | ||
|
|
||
| `freertos-next` is a Rust wrapper for the FreeRTOS API. | ||
|
|
||
| Wrapper library to use FreeRTOS API in Rust. | ||
| - It bundles the official [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel) sources (currently `V11.2.0`). | ||
| If you need a customized setup, you can prepare your own kernel source files and call `b.freertos("path/to/your/kernel");` in your `build.rs`. | ||
| - It implements several traits to ensure smooth integration with embedded projects: | ||
| - [`os-trait`](https://crates.io/crates/os-trait) | ||
| - [`critical-section`](https://crates.io/crates/critical-section) | ||
| - [`mutex-traits`](https://crates.io/crates/mutex-traits) | ||
|
|
||
| - It includes the source code of [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel). Current version is `V11.2.0`. | ||
| - If you have any specific requirements, please prepare your source code and call `b.freertos("path/to/your/kernel");` in your `build.rs` file. | ||
| - It implements some useful traits: | ||
| - [os-trait](https://crates.io/crates/os-trait) | ||
| - [critical-section](https://crates.io/crates/critical-section). | ||
| - [mutex-traits](https://crates.io/crates/mutex-traits). | ||
| The crate is published as **freertos-next** on crates.io because the more obvious names (`freertos`, `freertos-rust`) are already taken. | ||
|
|
||
| It's named **freertos-next** on crates.io right now, because we can't choose a shorter name. | ||
| ## 📦 Usage | ||
|
|
||
| ## Usage | ||
| 1. Add the dependencies to your application: | ||
|
|
||
| 1. Add dependencies to your Rust APP | ||
| ```shell | ||
| ```sh | ||
| cargo add freertos-next | ||
| cargo add --build freertos-build | ||
| ``` | ||
|
|
||
| 2. Add this snippet to your APP's `build.rs`: | ||
| 2. Add the following snippet to your application's `build.rs`: | ||
| ```rust | ||
| fn main() { | ||
| let mut b = freertos_build::Builder::new(); | ||
| b.freertos_config("src_c"); // Location of `FreeRTOSConfig.h` | ||
| b.freertos_config("src_c"); // Path to your FreeRTOSConfig.h | ||
| b.compile().unwrap(); | ||
| } | ||
| ``` | ||
| 3. Optional: | ||
| 3. Optional configuration: | ||
| ```rust | ||
| // If you want to use you own source code. | ||
| // Use your own FreeRTOS-Kernel source tree | ||
| b.freertos("path/to/FreeRTOS-Kernel"); | ||
| // Path relative to 'FreeRTOS-Kernel/portable'. | ||
| // If the default path is not what you want. | ||
|
|
||
| // Override the default port (relative to FreeRTOS-Kernel/portable) | ||
| b.freertos_port("GCC/ARM_CM3"); | ||
| // Set the heap_?.c allocator to use from 'FreeRTOS-Kernel/portable/MemMang' | ||
| // (Default: heap_4.c) | ||
|
|
||
| // Select the heap allocator from FreeRTOS-Kernel/portable/MemMang | ||
| // Default: heap_4.c | ||
| b.heap("heap_4.c"); | ||
| ``` | ||
| [freertos-next](https://github.com/mcu-rust/FreeRTOS/tree/main/freertos) works together with [freertos-build](https://crates.io/crates/freertos-build). A complete example using [freertos-next](https://github.com/mcu-rust/FreeRTOS/tree/main/freertos) with [stm32f1-hal](https://crates.io/crates/stm32f1-hal) is available here: [stm32f1-FreeRTOS-example](https://github.com/mcu-rust/stm32f1-FreeRTOS-example) | ||
|
|
||
| ## 📘 C Compiler | ||
|
|
||
| `freertos-build` uses the [`cc`](https://docs.rs/crate/cc) crate to compile the FreeRTOS kernel. | ||
| The C compiler can be configured via the `CC` environment variable, or it will fall back to the defaults provided by `cc`. | ||
|
|
||
| It needs [freertos-build](https://crates.io/crates/freertos-build) to work with. [stm32f1-FreeRTOS-example](https://github.com/mcu-rust/stm32f1-FreeRTOS-example) shows how to use this crate with [stm32f1-hal](https://crates.io/crates/stm32f1-hal) together. | ||
| For ARM targets, the expected compiler is `arm-none-eabi-gcc`, which can be obtained from the [ARM GNU toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads). | ||
|
|
||
| ### Used C compiler | ||
| `freertos-build` depends on the [cc crate](https://docs.rs/crate/cc). So the C compiler | ||
| used can be set by using the `CC` enviroment variable or otherwise defined by internal | ||
| defaults. For the ARM architecture this is the `arm-none-eabi-gcc` which can be found [here](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads). | ||
| ### Install | ||
|
|
||
| Install: | ||
| ```shell | ||
| # on Ubuntu | ||
| ```sh | ||
| # Ubuntu | ||
| sudo apt-get install -y gcc-arm-none-eabi | ||
| # on Windows | ||
|
|
||
| # Windows (Scoop) | ||
| scoop install gcc-arm-none-eabi | ||
| ``` | ||
| For more details, see the main [repository](https://github.com/mcu-rust/FreeRTOS). | ||
|
|
||
| ## 🔖 Keywords | ||
|
|
||
| See also [repository](https://github.com/mcu-rust/FreeRTOS). | ||
| freertos · rtos · rust · embedded · embedded-hal · no-std · arm · cortex-m · scheduler · multitasking · bindings · wrapper | ||
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.