You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+19
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,24 @@ A note to users on systems with advanced memory features like MMUs and MPUs:
68
68
Use a proper memory allocator for that use case (one that supports paging, etc.).
69
69
However, if you need dynamic memory before enabling the MMU, this crate certainly is an option.
70
70
71
+
# Platform support
72
+
73
+
This crate does not use any platform-specific features (e.g. an MMU or specific instructions), except for the requirement for a atomic compare-and-swap-instruction (CAS), which is widely available.
74
+
Therefore this crate works out-of-the-box on most architectures.
75
+
76
+
Some platforms however don't provide such an instruction (e.g. `thumbv6m-none-eabi` or the RISC-V OpenTitan) or totally lack atomic instructions (e.g. AVR) due to only a single-core nature.
77
+
On those platforms, where the CAS instruction is not available, one can use the workaround, that [`spin`][spin-docs] use: you can enable the `portable_atomic`-feature in your `Cargo.toml`, like this:
78
+
```toml
79
+
[dependencies.emballoc]
80
+
version = "*"# replace with current version from crates.io
81
+
features = ["portable_atomic"]
82
+
```
83
+
This enables the use of the `portable_atomic` instead of the `core`-atomics.
84
+
This is safe on any platform.
85
+
86
+
To actually enable atomics support on platforms without hardware support, the `--cfg portable_atomic_unsafe_assume_single_core`-option needs to be explicitly enabled when compiling.
87
+
For more details see the [documentation of `spin`][spin-docs].
88
+
71
89
# Minimum supported Rust version
72
90
73
91
This crate has a stability guarantee about the compiler version supported.
0 commit comments