diff options
| author | Román Cárdenas Rodríguez <rcardenas.rod@gmail.com> | 2024-03-20 21:06:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-20 20:06:47 +0000 |
| commit | 4060c3def88f82d4e4f48de7137ce365167ef265 (patch) | |
| tree | f326f0687092cab2b772952b579d63d12d3d34aa /xtask/src/run.rs | |
| parent | 22ac33a826dedacde5d3d5c0964ff072555a9b32 (diff) | |
RISC-V support over CLINT (#815)
* Rebase to master
* using interrupt_mod
* bug fixes
* fix other backends
* Add changelog
* forgot about rtic-macros
* backend-specific configuration
* core peripherals optional over macro argument
* pre_init_preprocessing binding
* CI for RISC-V (WIP)
* separation of concerns
* add targets for RISC-V examples
* remove qemu feature
* prepare examples folder
* move examples all together
* move ci out of examples
* minor changes
* add cortex-m
* new xtask: proof of concept
* fix build.yml
* feature typo
* clean rtic examples
* reproduce weird issue
* remove unsafe code in user app
* update dependencies
* allow builds on riscv32imc
* let's fix QEMU
* Update .github/workflows/build.yml
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
* New build.rs
* removing test features
* adapt ui test to new version of clippy
* add more examples to RISC-V backend
* proper configuration of heapless for riscv32imc
* opt-out examples for riscv32imc
* point to new version of riscv-slic
* adapt new macro bindings
* adapt examples and CI to stable
* fix cortex-m CI
* Review
---------
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'xtask/src/run.rs')
| -rw-r--r-- | xtask/src/run.rs | 78 |
1 files changed, 33 insertions, 45 deletions
diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 6057551..ff81e6a 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -15,7 +15,9 @@ mod iter; use iter::{into_iter, CoalescingRunner}; use crate::{ - argument_parsing::{Backends, BuildOrCheck, ExtraArguments, Globals, PackageOpt, TestMetadata}, + argument_parsing::{ + Backends, BuildOrCheck, ExtraArguments, Globals, PackageOpt, Platforms, TestMetadata, + }, cargo_command::{BuildMode, CargoCommand}, }; @@ -62,7 +64,12 @@ fn command_parser( }; match *command { - CargoCommand::Qemu { example, .. } | CargoCommand::Run { example, .. } => { + CargoCommand::Qemu { + platform, example, .. + } + | CargoCommand::Run { + platform, example, .. + } => { /// Check if `run` was successful. /// returns Ok in case the run went as expected, /// Err otherwise @@ -99,8 +106,9 @@ fn command_parser( res } + let platform_name = platform.name(); let run_file = format!("{example}.run"); - let expected_output_file = ["rtic", "ci", "expected", &run_file] + let expected_output_file = ["ci", "expected", &platform_name, &run_file] .iter() .collect::<PathBuf>() .into_os_string() @@ -191,72 +199,41 @@ 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 rtic/examples +/// The examples are in examples/<platform>/examples pub fn cargo_example<'c>( globals: &Globals, operation: BuildOrCheck, cargoarg: &'c Option<&'c str>, + platform: Platforms, backend: Backends, examples: &'c [String], ) -> Vec<FinalRunResult<'c>> { let runner = into_iter(examples).map(|example| { + let path = format!("examples/{}", platform.name()); + let dir = Some(PathBuf::from(path)); let features = Some(backend.to_target().and_features(backend.to_rtic_feature())); let command = match operation { BuildOrCheck::Check => CargoCommand::ExampleCheck { cargoarg, + platform, example, target: Some(backend.to_target()), features, mode: BuildMode::Release, + dir, deny_warnings: globals.deny_warnings, }, BuildOrCheck::Build => CargoCommand::ExampleBuild { cargoarg, + platform, example, target: Some(backend.to_target()), features, mode: BuildMode::Release, - dir: Some(PathBuf::from("./rtic")), + dir, deny_warnings: globals.deny_warnings, }, }; @@ -368,9 +345,12 @@ pub fn cargo_book<'c>( /// Run examples /// /// Supports updating the expected output via the overwrite argument +/// +/// The examples are in examples/<platform>/examples pub fn qemu_run_examples<'c>( globals: &Globals, cargoarg: &'c Option<&'c str>, + platform: Platforms, backend: Backends, examples: &'c [String], overwrite: bool, @@ -380,11 +360,13 @@ pub fn qemu_run_examples<'c>( into_iter(examples) .flat_map(|example| { + let path = format!("examples/{}", platform.name()); + let dir = Some(PathBuf::from(path)); let target = target.into(); - let dir = Some(PathBuf::from("./rtic")); let cmd_build = CargoCommand::ExampleBuild { cargoarg: &None, + platform, example, target, features: features.clone(), @@ -395,6 +377,7 @@ pub fn qemu_run_examples<'c>( let cmd_qemu = CargoCommand::Qemu { cargoarg, + platform, example, target, features: features.clone(), @@ -413,6 +396,7 @@ pub fn qemu_run_examples<'c>( pub fn build_and_check_size<'c>( globals: &Globals, cargoarg: &'c Option<&'c str>, + platform: Platforms, backend: Backends, examples: &'c [String], arguments: &'c Option<ExtraArguments>, @@ -422,27 +406,31 @@ pub fn build_and_check_size<'c>( let runner = into_iter(examples) .flat_map(|example| { + let path = format!("examples/{}", platform.name()); + let dir = Some(PathBuf::from(path)); let target = target.into(); // Make sure the requested example(s) are built let cmd_build = CargoCommand::ExampleBuild { cargoarg: &Some("--quiet"), + platform, example, target, features: features.clone(), mode: BuildMode::Release, - dir: Some(PathBuf::from("./rtic")), + dir: dir.clone(), deny_warnings: globals.deny_warnings, }; let cmd_size = CargoCommand::ExampleSize { cargoarg, + platform, example, target, features: features.clone(), mode: BuildMode::Release, arguments: arguments.clone(), - dir: Some(PathBuf::from("./rtic")), + dir, deny_warnings: globals.deny_warnings, }; |
