-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We vendor it for a few reasons: It simplifies our build, so that we no longer have to specify the LIBTOCK environment variables We can make more easily make changes to accommodate our user-mod testing We can integrate async support more seamlessly. I also took this opportunity to rename pldm-app to example-app. I ran cargo clippy --fix and did some other clippy fixes. (This also reordered some of the tests in other files.) * Check in most of the libtock-rs code unmodified from f0fe5198524252887a71cea25093123afa6f429d * Delete libtock stuff we don't need; add no-op impl for the host so that the compiles are clean * Use local libtock; remane pldm-app to example-app
- Loading branch information
Showing
230 changed files
with
24,191 additions
and
284 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Licensed under the Apache-2.0 license | ||
|
||
[package] | ||
name = "example-app" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
|
||
[dependencies] | ||
|
||
[target.'cfg(target_arch = "riscv32")'.dependencies] | ||
critical-section = "1.1.2" | ||
embassy-executor = "0.5.0" | ||
embedded-alloc = "0.5.1" | ||
libtock = { path = "../libtock" } | ||
libtock_alarm = { path = "../libtock/apis/peripherals/alarm" } | ||
libtock_console = { path = "../libtock/apis/interface/console" } | ||
libtock_debug_panic = { path = "../libtock/panic_handlers/debug_panic" } | ||
libtock_platform = { path = "../libtock/platform" } | ||
libtock_runtime = { path = "../libtock/runtime" } | ||
portable-atomic = "1.7.0" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/Cargo.lock | ||
/nightly/target | ||
/target | ||
/demos/*/target |
This file contains 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Releases | ||
|
||
## 0.2.0 (WIP) | ||
|
||
### Comprehensive Changes | ||
|
||
- Many functions are asynchronous | ||
- To create an `async` main function you can use the attribute `#[libtock::main]` | ||
- To retrieve the value of an asynchronous `value`, use `value.await` | ||
- This is only possible within an `async fn`, so either | ||
- Make the caller `fn` of `.await` an `async fn` | ||
- Not recommended: Use `libtock::executor::block_on(value)` to retrieve the `value` | ||
- Most API functions, including `main()`, return a `Result<T, TockError>` | ||
- All drivers can exclusively be retrieved by `retrieve_drivers` which returns a `Drivers` singleton. Drivers can be shared between different tasks only if it is safe to do so. | ||
- The low-level functions have been moved to a new crate called `libtock-core`. This crate is intended to be less experimental and more stable. | ||
|
||
### Changed APIs | ||
|
||
- The basic APIs have been made consistent. They are initialized via driver factories and no longer require a `WithCallback` object, s.t. the callback subscription is more intuitive. The affected APIs are: | ||
- LEDs | ||
- Buttons | ||
- GPIO | ||
- Temperature | ||
- ADC (partially) | ||
- The timer API now supports concurrent sleep operations | ||
|
||
### Syscalls | ||
|
||
- `syscalls::subscribe` is actually usable | ||
- `syscalls::yieldk_for` is no longer available | ||
- Yielding manually is discouraged as it conflicts with Rust's safety guarantees. If you need to wait for a condition, use `futures::wait_until` and `.await`. | ||
- `syscalls::yieldk` has become `unsafe` for the same reason | ||
- `syscalls::command` is no longer `unsafe` | ||
- The low-level syscalls have been moved to `syscalls::raw` | ||
- `syscalls::subscribe_ptr` becomes `syscalls::raw::subscribe` | ||
- `syscalls::allow_ptr` becomes `syscalls::raw::allow` | ||
|
||
### Miscellaneous | ||
|
||
- Flashing examples is no longer restricted to the nRF52 DK board | ||
- `./run_example.sh` has been deleted | ||
- Instead, use `PLATFORM=<platform> cargo r<arch> <your_app>`. This will build the app for your CPU architecture and platform-specific memory layout and flash it via J-Link to your board | ||
- Targets without support for atomics can be built | ||
- The `TockAllocator` is no longer included by default and needs to to be opted-in via `--features=alloc` | ||
- `hardware_test.rs` is now called `libtock_test.rs` to make clear that the intent is to test the correctness of `libtock-rs`, not the hardware or the kernel | ||
- The panic handler can now be customized using the `custom_panic_handler` feature | ||
- The error alloc handler can now be customized using the `custom_alloc_error_handler` feature | ||
|
||
## a8bb4fa9be504517d5533511fd8e607ea61f1750 (0.1.0) | ||
|
||
- First and highly experimental `libtock-rs` API |
This file contains 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[package] | ||
authors = ["Tock Project Developers <[email protected]>"] | ||
categories = ["embedded", "no-std", "os"] | ||
description = """Tock Rust userspace library collection. Provides all the \ | ||
tools needed to create a Tock Rust process binary.""" | ||
edition = "2021" | ||
license = "Apache-2.0 OR MIT" | ||
name = "libtock" | ||
repository = "https://www.github.com/tock/libtock-rs" | ||
version = "0.1.0" | ||
|
||
[features] | ||
rust_embedded = [ | ||
"embedded-hal", | ||
"libtock_platform/rust_embedded", | ||
"libtock_gpio/rust_embedded", | ||
] | ||
|
||
[dependencies] | ||
libtock_adc = { path = "apis/peripherals/adc" } | ||
libtock_air_quality = { path = "apis/sensors/air_quality" } | ||
libtock_alarm = { path = "apis/peripherals/alarm" } | ||
libtock_ambient_light = { path = "apis/sensors/ambient_light" } | ||
libtock_buttons = { path = "apis/interface/buttons" } | ||
libtock_buzzer = { path = "apis/interface/buzzer" } | ||
libtock_console = { path = "apis/interface/console" } | ||
libtock_debug_panic = { path = "panic_handlers/debug_panic" } | ||
libtock_gpio = { path = "apis/peripherals/gpio" } | ||
libtock_i2c_master = { path = "apis/peripherals/i2c_master" } | ||
libtock_ieee802154 = { path = "apis/net/ieee802154" } | ||
libtock_i2c_master_slave = { path = "apis/peripherals/i2c_master_slave" } | ||
libtock_key_value = { path = "apis/storage/key_value" } | ||
libtock_leds = { path = "apis/interface/leds" } | ||
libtock_low_level_debug = { path = "apis/kernel/low_level_debug" } | ||
libtock_ninedof = { path = "apis/sensors/ninedof" } | ||
libtock_platform = { path = "platform" } | ||
libtock_proximity = { path = "apis/sensors/proximity" } | ||
libtock_rng = { path = "apis/peripherals/rng" } | ||
libtock_runtime = { path = "runtime" } | ||
libtock_small_panic = { path = "panic_handlers/small_panic" } | ||
libtock_sound_pressure = { path = "apis/sensors/sound_pressure" } | ||
libtock_spi_controller = { path = "apis/peripherals/spi_controller" } | ||
libtock_temperature = { path = "apis/sensors/temperature" } | ||
|
||
embedded-hal = { version = "1.0", optional = true } |
Oops, something went wrong.