Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
romancardenas committed Mar 7, 2024
1 parent 27da4a2 commit b2fa209
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 115 deletions.
1 change: 0 additions & 1 deletion examples/hifive1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ rtic = { path = "../../rtic" }
heapless = "0.8.0"
hifive1 = { git = "https://github.com/romancardenas/hifive1.git", features = ["board-redv"] }
e310x = { git = "https://github.com/greenlsi/e310x.git", features = ["rt"]}
# riscv-rt = {path = "../../../riscv/riscv-rt", features = ["single-hart"]}
riscv-rt = {version = "0.12.1", features = ["single-hart"]}
riscv = "0.11.0"
semihosting = { version = "0.1", features = ["stdio", "panic-handler"] }
Expand Down
1 change: 0 additions & 1 deletion examples/hifive1/examples/prio_inheritance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_main]
#![no_std]
// #![feature(type_alias_impl_trait)]

use riscv_rt as _;

Expand Down
1 change: 0 additions & 1 deletion examples/hifive1/examples/static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![deny(warnings)]
#![deny(unsafe_code)]
#![deny(missing_docs)]
// #![feature(type_alias_impl_trait)]

use hifive1 as _;
use riscv_rt as _;
Expand Down
1 change: 0 additions & 1 deletion examples/hifive1/examples/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![deny(warnings)]
#![deny(unsafe_code)]
#![deny(missing_docs)]
// #![feature(type_alias_impl_trait)]

use hifive1 as _;
use riscv_rt as _;
Expand Down
1 change: 0 additions & 1 deletion examples/hifive1/examples/zero_prio_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![deny(warnings)]
#![deny(unsafe_code)]
#![deny(missing_docs)]
// #![feature(type_alias_impl_trait)]

use core::marker::PhantomData;
use hifive1 as _;
Expand Down
2 changes: 1 addition & 1 deletion rtic-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!

### Added

- RTIC v2 now works on stable.
- Unstable support for RISC-V targets compatible with `riscv-slic`
- RTIC v2 now works on stable.
- Unstable ESP32-C3 support.

### Changed
Expand Down
2 changes: 1 addition & 1 deletion rtic-macros/src/codegen/bindings/riscv_slic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub fn architecture_specific_analysis(app: &App, _analysis: &SyntaxAnalysis) ->
));
}

Ok(()) // TODO
Ok(())
}

/// Macro to add statements to be executed at the beginning of all the interrupt handlers.
Expand Down
2 changes: 1 addition & 1 deletion rtic-monotonics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!

### Changed

- Tweak `build.rs` to avoid warnings in Nightly 1.78+
- Removed unused `rust-toolchain.toml`
Tweak `build.rs` to avoid warnings in Nightly 1.78+

## v1.5.0 - 2024-01-10

Expand Down
1 change: 0 additions & 1 deletion rtic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ features = ["rtic-macros/test-template"]
name = "rtic"

[dependencies]
# riscv-slic = { path = "../../riscv-slic/riscv-slic", optional = true }
riscv-slic = { git = "https://github.com/romancardenas/riscv-slic.git", rev = "2a91edb", optional = true }
esp32c3 = { version = "0.20.0", optional = true}
riscv = {version = "0.11.0", optional = true}
Expand Down
5 changes: 3 additions & 2 deletions rtic/src/export/riscv_common.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/// GENERIC RE-EXPORTS: needed for all RTIC backends
// pub use riscv::interrupt;
/// Read the stack pointer.
#[inline(always)]
pub fn read_sp() -> u32 {
let r;
unsafe { core::arch::asm!("mv {}, sp", out(reg) r, options(nomem, nostack, preserves_flags)) };
unsafe {
core::arch::asm!("mv {0:w}, sp", out(reg) r, options(nomem, nostack, preserves_flags))
};
r
}
58 changes: 0 additions & 58 deletions xtask/src/argument_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,6 @@ impl Backends {
Backends::Riscv32ImcClint | Backends::Riscv32ImacClint => "riscv-clint",
}
}
// #[allow(clippy::wrong_self_convention)]
// pub fn to_rtic_uitest_feature(&self) -> &'static str {
// match self {
// Backends::Thumbv6 | Backends::Thumbv8Base => "rtic-uitestv6",
// Backends::Thumbv7 | Backends::Thumbv8Main => "rtic-uitestv7",
// Backends::RiscvEsp32C3 => "rtic-uitestesp32c3",
// Backends::Riscv32ImcClint | Backends::Riscv32ImacClint => "rtic-uitestclint",
// }
// }
}

#[derive(Copy, Clone, Default, Debug)]
Expand Down Expand Up @@ -438,55 +429,6 @@ pub enum Commands {

/// Build books with mdbook
Book(Arg),

/// Check one or more usage examples.
///
/// Usage examples are located in ./examples
UsageExampleCheck(UsageExamplesOpt),

/// Build one or more usage examples.
///
/// Usage examples are located in ./examples
#[clap(alias = "./examples")]
UsageExampleBuild(UsageExamplesOpt),
}

#[derive(Args, Clone, Debug)]
pub struct UsageExamplesOpt {
/// The usage examples to build. All usage examples are selected if this argument is not provided.
///
/// Example: `rp2040_local_i2c_init,stm32f3_blinky`.
examples: Option<String>,
}

impl UsageExamplesOpt {
pub fn examples(&self) -> anyhow::Result<Vec<String>> {
let usage_examples: Vec<_> = std::fs::read_dir("./examples")?
.filter_map(Result::ok)
.filter(|p| p.metadata().ok().map(|p| p.is_dir()).unwrap_or(false))
.filter_map(|p| p.file_name().to_str().map(ToString::to_string))
.collect();

let selected_examples: Option<Vec<String>> = self
.examples
.clone()
.map(|s| s.split(',').map(ToString::to_string).collect());

if let Some(selected_examples) = selected_examples {
if let Some(unfound_example) = selected_examples
.iter()
.find(|e| !usage_examples.contains(e))
{
Err(anyhow::anyhow!(
"Usage example {unfound_example} does not exist"
))
} else {
Ok(selected_examples)
}
} else {
Ok(usage_examples)
}
}
}

#[derive(Args, Debug, Clone)]
Expand Down
9 changes: 0 additions & 9 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@ fn main() -> anyhow::Result<()> {
info!("Running mdbook");
cargo_book(globals, &args.arguments)
}
// TODO these two commands are not needed anymore
Commands::UsageExampleCheck(examples) => {
info!("Checking usage examples");
cargo_usage_example(globals, BuildOrCheck::Check, examples.examples()?)
}
Commands::UsageExampleBuild(examples) => {
info!("Building usage examples");
cargo_usage_example(globals, BuildOrCheck::Build, examples.examples()?)
}
};

handle_results(globals, final_run_results).map_err(|_| anyhow::anyhow!("Commands failed"))
Expand Down
37 changes: 0 additions & 37 deletions xtask/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,43 +199,6 @@ pub fn cargo<'c>(
runner.run_and_coalesce()
}

/// Cargo command to build a usage example.
///
/// The usage examples are in examples/
pub fn cargo_usage_example(
globals: &Globals,
operation: BuildOrCheck,
usage_examples: Vec<String>,
) -> Vec<FinalRunResult<'_>> {
into_iter(&usage_examples)
.map(|example| {
let path = format!("examples/{example}");

let command = match operation {
BuildOrCheck::Check => CargoCommand::Check {
cargoarg: &None,
mode: BuildMode::Release,
dir: Some(path.into()),
package: None,
target: None,
features: None,
deny_warnings: globals.deny_warnings,
},
BuildOrCheck::Build => CargoCommand::Build {
cargoarg: &None,
package: None,
target: None,
features: None,
mode: BuildMode::Release,
dir: Some(path.into()),
deny_warnings: globals.deny_warnings,
},
};
(globals, command, false)
})
.run_and_coalesce()
}

/// Cargo command to either build or check all examples
///
/// The examples are in examples/<platform>/examples
Expand Down

0 comments on commit b2fa209

Please sign in to comment.