Skip to content

Commit 7468bd6

Browse files
committed
Update riscv CI to 0.12.1
1 parent 90ef2a6 commit 7468bd6

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

ci/script.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,10 @@ main() {
498498
echo 'version = "1.0.0"' >> $td/Cargo.toml
499499

500500
echo '[dependencies.riscv]' >> $td/Cargo.toml
501-
echo 'version = "0.6.0"' >> $td/Cargo.toml
501+
echo 'version = "0.12.1"' >> $td/Cargo.toml
502502

503503
echo '[dependencies.riscv-rt]' >> $td/Cargo.toml
504-
echo 'version = "0.8.0"' >> $td/Cargo.toml
504+
echo 'version = "0.13.0"' >> $td/Cargo.toml
505505

506506
test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x/e310x.svd
507507
test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd

ci/svd2rust-regress/src/svd_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const CRATES_MSP430: &[&str] = &["msp430 = \"0.4.0\"", "msp430-rt = \"0.4.0\""];
1616
const CRATES_ATOMICS: &[&str] =
1717
&["portable-atomic = { version = \"0.3.16\", default-features = false }"];
1818
const CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.7.6\"", "cortex-m-rt = \"0.6.13\""];
19-
const CRATES_RISCV: &[&str] = &["riscv = \"0.9.0\"", "riscv-rt = \"0.9.0\""];
19+
const CRATES_RISCV: &[&str] = &["riscv = \"0.12.1\"", "riscv-rt = \"0.13.0\""];
2020
const CRATES_XTENSALX: &[&str] = &["xtensa-lx-rt = \"0.9.0\"", "xtensa-lx = \"0.6.0\""];
2121
const CRATES_MIPS: &[&str] = &["mips-mcu = \"0.1.0\""];
2222
const PROFILE_ALL: &[&str] = &["[profile.dev]", "incremental = false"];

src/generate/device.rs

+25-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use crate::svd::{array::names, Device, Peripheral};
22
use proc_macro2::{Span, TokenStream};
33
use quote::{quote, ToTokens};
44

5-
use log::debug;
5+
use log::{debug, warn};
66
use std::fs::File;
77
use std::io::Write;
88
use std::path::Path;
99

10-
use crate::config::{Config, Settings, Target};
10+
use crate::config::{Config, Target};
1111
use crate::util::{self, ident};
1212
use anyhow::{Context, Result};
1313

@@ -31,9 +31,9 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
3131
let settings = match config.settings.as_ref() {
3232
Some(settings) => {
3333
let file = std::fs::read_to_string(settings).context("could not read settings file")?;
34-
serde_yaml::from_str(&file).context("could not parse settings file")?
34+
Some(serde_yaml::from_str(&file).context("could not parse settings file")?)
3535
}
36-
None => Settings::default(),
36+
None => None,
3737
};
3838

3939
if config.target == Target::Msp430 {
@@ -197,8 +197,23 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
197197

198198
match config.target {
199199
Target::RISCV => {
200-
debug!("Rendering RISC-V specific code");
201-
out.extend(riscv::render(&d.peripherals, device_x, &settings)?);
200+
if settings.is_none() {
201+
warn!("No settings file provided for RISC-V target. Using legacy interrupts rendering");
202+
warn!("Please, consider migrating your PAC to riscv 0.12.0 or later");
203+
out.extend(interrupt::render(
204+
config.target,
205+
&d.peripherals,
206+
device_x,
207+
config,
208+
)?);
209+
} else {
210+
debug!("Rendering RISC-V specific code");
211+
out.extend(riscv::render(
212+
&d.peripherals,
213+
device_x,
214+
settings.as_ref().unwrap(),
215+
)?);
216+
}
202217
}
203218
_ => {
204219
debug!("Rendering interrupts");
@@ -219,7 +234,10 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
219234
// Core peripherals are handled above
220235
continue;
221236
}
222-
if config.target == Target::RISCV && riscv::is_riscv_peripheral(p, &settings) {
237+
if config.target == Target::RISCV
238+
&& settings.is_some()
239+
&& riscv::is_riscv_peripheral(p, settings.as_ref().unwrap())
240+
{
223241
// RISC-V specific peripherals are handled above
224242
continue;
225243
}

0 commit comments

Comments
 (0)