diff options
| author | bernard <[email protected]> | 2025-12-13 21:42:29 +0800 |
|---|---|---|
| committer | R b b666 <[email protected]> | 2025-12-15 12:50:49 +0800 |
| commit | 4f154d8207be7320be07477fe3857523b1704977 (patch) | |
| tree | d32fa76e74dccef9a58c7b5d54d10a2f4f54c4d6 /components/rust/docs/4.modules/modules.md | |
| parent | 3c459aecea7135f96d9ebd291d276a6e18fd97c7 (diff) | |
[rust] Tidy core defaults and migrate docs to README
Diffstat (limited to 'components/rust/docs/4.modules/modules.md')
| -rw-r--r-- | components/rust/docs/4.modules/modules.md | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/components/rust/docs/4.modules/modules.md b/components/rust/docs/4.modules/modules.md deleted file mode 100644 index 501a27215d..0000000000 --- a/components/rust/docs/4.modules/modules.md +++ /dev/null @@ -1,47 +0,0 @@ -# Writing a Rust Dynamic Library Usable by RT-Thread - -1. Set up the project -Create a new `cargo` project as usual. There are some flags to tell `cargo` to generate a system library instead of a regular Rust target. - -```toml -[lib] -name = "your_crate" -crate-type = ["cdylib"] # generate a dynamic library -# crate-type = ["staticlib"] # generate a static library -``` - -Add the following to `config.toml` to specify the target platform: - -```toml -[build] -target = "your_target" -``` - -2. Enable RT-Thread dynamic module loading -To load dynamic modules in RT-Thread, enable it in `Kconfig`: -``` -RT-Thread Components → C/C++ and POSIX layer - → POSIX (Portable Operating System Interface) layer - → Enable dynamic module APIs, dlopen()/dlsym()/dlclose() etc -``` - -3. Enable the filesystem -To place dynamic modules into RT-Thread, enable a filesystem in `Kconfig`: -``` -RT-Thread online packages → system packages - → lwext4: an excellent choice of ext2/3/4 filesystem for microcontrollers. -``` - -## Using the rust library - -Add `rt_rust` dependency in `Cargo.toml`: - -```toml -[dependencies] -rt_rust = { path = "PATH/TO/rust/rt-rust" } -``` - -Currently the macro-main library is not supported because it causes entry detection issues. - -## References -- [The Embedded Rust Book](https://xxchang.github.io/book/interoperability/rust-with-c.html#extern-c)
\ No newline at end of file |
