Skip to content

Commit d6afbf9

Browse files
bors[bot]MabezDev
andauthored
Merge #536
536: Xtensa updates r=adamgreig a=MabezDev * Switch to bare-metal 1.0.0 * Use xtensa-lx `InterruptNumber` trait * Update CI script Co-authored-by: Scott Mabin <[email protected]>
2 parents ead1f51 + 64c1c53 commit d6afbf9

File tree

6 files changed

+69
-30
lines changed

6 files changed

+69
-30
lines changed

.github/bors.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ status = [
1515
"ci-linux (stable, Spansion, x86_64-unknown-linux-gnu, linux)",
1616
"ci-linux (stable, STMicro, x86_64-unknown-linux-gnu, linux)",
1717
"ci-linux (stable, Toshiba, x86_64-unknown-linux-gnu, linux)",
18-
"ci-linux (1.40.0, Nordic, x86_64-unknown-linux-gnu, linux)",
18+
"ci-linux (1.46.0, Nordic, x86_64-unknown-linux-gnu, linux)",
1919
"ci-linux (stable, x86_64-apple-darwin, osx)",
2020
"ci-linux (stable, x86_64-pc-windows-msvc, windows)",
2121
]

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
include:
3131
# Test MSRV
32-
- rust: 1.40.0
32+
- rust: 1.46.0
3333
VENDOR: Nordic
3434
TARGET: x86_64-unknown-linux-gnu
3535
TRAVIS_OS_NAME: linux

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- More Cluster arrays are now emitted as an array rather than a list of
1313
elements. An `ArrayProxy` wrapper is used when a Rust built-in array does not
1414
match the cluster layout. Requires the `--const_generic` command line option.
15+
- Bumped `xtensa-lx` and add `xtensa_lx::interrupt::InterruptNumber` implementation.
1516

1617
## [v0.19.0] - 2021-05-26
1718

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ This project is developed and maintained by the [Tools team][team].
1313

1414
## Minimum Supported Rust Version (MSRV)
1515

16-
The **generated code** is guaranteed to compile on stable Rust 1.40.0 and up.
16+
The **generated code** is guaranteed to compile on stable Rust 1.46.0 and up.
1717

18-
If you encounter compilation errors on any stable version newer than 1.40.0, please open an issue.
18+
If you encounter compilation errors on any stable version newer than 1.46.0, please open an issue.
1919

2020
# Testing Locally
2121

ci/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,11 @@ main() {
590590
echo 'version = "1.0.0"' >> $td/Cargo.toml
591591

592592
echo '[dependencies.xtensa-lx]' >> $td/Cargo.toml
593-
echo 'version = "0.3.0"' >> $td/Cargo.toml
593+
echo 'version = "0.4.0"' >> $td/Cargo.toml
594594
echo 'features = ["lx6"]' >> $td/Cargo.toml
595595

596596
echo '[dependencies.xtensa-lx-rt]' >> $td/Cargo.toml
597-
echo 'version = "0.5.0"' >> $td/Cargo.toml
597+
echo 'version = "0.7.0"' >> $td/Cargo.toml
598598
echo 'features = ["lx6"]' >> $td/Cargo.toml
599599

600600
test_svd_for_target xtensa-lx https://raw.githubusercontent.com/esp-rs/esp32/master/svd/esp32.svd

src/generate/interrupt.rs

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -206,34 +206,68 @@ pub fn render(
206206
}
207207
};
208208

209-
if target == Target::CortexM {
210-
root.extend(quote! {
211-
#interrupt_enum
212-
213-
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
214-
#[inline(always)]
215-
fn number(#self_token) -> u16 {
216-
#nr_expr
209+
match target {
210+
Target::CortexM => {
211+
root.extend(quote! {
212+
#interrupt_enum
213+
214+
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
215+
#[inline(always)]
216+
fn number(#self_token) -> u16 {
217+
#nr_expr
218+
}
219+
}
220+
});
221+
}
222+
Target::XtensaLX => {
223+
root.extend(quote! {
224+
#interrupt_enum
225+
226+
unsafe impl xtensa_lx::interrupt::InterruptNumber for Interrupt {
227+
#[inline(always)]
228+
fn number(#self_token) -> u16 {
229+
#nr_expr
230+
}
217231
}
218-
}
219-
});
220-
} else {
221-
mod_items.extend(quote! {
222-
#interrupt_enum
223232

224-
#[derive(Debug, Copy, Clone)]
225-
pub struct TryFromInterruptError(());
233+
/// TryFromInterruptError
234+
#[derive(Debug, Copy, Clone)]
235+
pub struct TryFromInterruptError(());
226236

227-
impl Interrupt {
228-
#[inline]
229-
pub fn try_from(value: u8) -> Result<Self, TryFromInterruptError> {
230-
match value {
231-
#from_arms
232-
_ => Err(TryFromInterruptError(())),
237+
impl Interrupt {
238+
239+
/// Attempt to convert a given value into an `Interrupt`
240+
#[inline]
241+
pub fn try_from(value: u16) -> Result<Self, TryFromInterruptError> {
242+
match value {
243+
#from_arms
244+
_ => Err(TryFromInterruptError(())),
245+
}
233246
}
234247
}
235-
}
236-
});
248+
});
249+
}
250+
_ => {
251+
mod_items.extend(quote! {
252+
#interrupt_enum
253+
254+
/// TryFromInterruptError
255+
#[derive(Debug, Copy, Clone)]
256+
pub struct TryFromInterruptError(());
257+
258+
impl Interrupt {
259+
260+
/// Attempt to convert a given value into an `Interrupt`
261+
#[inline]
262+
pub fn try_from(value: u8) -> Result<Self, TryFromInterruptError> {
263+
match value {
264+
#from_arms
265+
_ => Err(TryFromInterruptError(())),
266+
}
267+
}
268+
}
269+
});
270+
}
237271
}
238272
}
239273

@@ -330,7 +364,11 @@ pub fn render(
330364
}
331365
}
332366

333-
if !interrupts.is_empty() && target != Target::CortexM && target != Target::Msp430 {
367+
if !interrupts.is_empty()
368+
&& target != Target::CortexM
369+
&& target != Target::XtensaLX
370+
&& target != Target::Msp430
371+
{
334372
root.extend(quote! {
335373
#[doc(hidden)]
336374
pub mod interrupt {

0 commit comments

Comments
 (0)