Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to svd2rust 0.30.2 #1

Merged
merged 40 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8723087
Update svd2rust and form version
May 7, 2023
c53b3d7
CreatePatch file for the EVSYS channel
May 8, 2023
054e4fe
Regenerate PAC's with svd2rut 0.28.0
May 7, 2023
abfa485
Apply manual patch for wrong generation of svd2rust
May 14, 2023
918eea5
Update Cargo.toml to the new Versions of the pacs
May 13, 2023
7be5e8e
Update hal to the new pacs
May 13, 2023
7f02579
Create new optional dependency for critical sections
May 13, 2023
9d20393
Make the tier one examples compileable
May 14, 2023
d078c06
Update the changelog
May 14, 2023
a5103a5
Fix formating
May 14, 2023
59df225
Fix wio_terminal
May 14, 2023
328d713
Rename port config variables back to the right name
May 14, 2023
ef00865
Created the generic snake game (the one on the old Nokias) for the Wi…
jsh3lly May 14, 2023
e4b07c0
Update NVM API (#674)
nilfit May 15, 2023
67561d0
Fix itsybitsy_m4 CI error (#685)
jbeaurivage May 15, 2023
9f1f658
Add critical section to crates.json
May 15, 2023
91a2f19
Change the rename in EVSYS to the Channel struct.
May 17, 2023
52073e8
Add defmt feature and derive error types (#684)
jbeaurivage May 26, 2023
eb0c887
Add `Qspi::free()` to release consumed pins (#667)
tgross35 May 27, 2023
8e9117a
Migration to `fugit` (#672)
glaeqen May 29, 2023
a971cbf
Fix example in wio_terminal (#687)
glaeqen May 29, 2023
063fd8f
Impl more standard traits for error types (#691)
jbeaurivage Jun 10, 2023
2b4410c
Add missing ADC pins for ATSAMD11D (#686)
Tremoneck Jun 10, 2023
74220dc
Fix incorrect APB clock state (#688)
glaeqen Jun 13, 2023
54bed01
v0.16.0 release (#692)
jbeaurivage Jul 15, 2023
bb0d07e
Add HAL version dep to atsame54_xpro (#694)
jbeaurivage Jul 15, 2023
0820f0d
Fix samd11_bare version (#695)
jbeaurivage Jul 15, 2023
fcbb7e5
Point pac/atsamd11d to correct docs (#698)
TG-Techie Sep 9, 2023
72e40ff
Mkrzero update (#697)
johngigantic Oct 2, 2023
85feef0
Merge atsamd-rs/master
jbeaurivage Oct 24, 2023
b11b060
Update to svd2rust 0.30.2
jbeaurivage Oct 24, 2023
3833523
Update changelogs
jbeaurivage Oct 24, 2023
74d6848
Make critical-section a default feature and update changelog
jbeaurivage Oct 24, 2023
7666fce
Turn on critical-section-single-core cortex-m flag in PACs
jbeaurivage Oct 24, 2023
43931de
Remove feature-gating of critical-section in PACs and update changelogs
jbeaurivage Oct 24, 2023
54651e7
Add changelog entries for Tier 1 boards
jbeaurivage Oct 24, 2023
85ab423
Fix release HAL crate workflow (#693)
jbeaurivage Oct 25, 2023
06c5dae
Merge branch 'master' into tremoneck_updatePAC
jbeaurivage Oct 25, 2023
2803d11
Remove critical-section features from crates.json
jbeaurivage Oct 25, 2023
1be89f3
Remove critical-section features of T1 BSPs
jbeaurivage Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions .github/workflows/release-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
run: |
set -ex

# Install random crate to force update of the registry
cargo install lazy_static || true
# Force update of the registry
cargo update || true

cd "hal" && cargo publish --no-verify

Expand All @@ -84,8 +84,8 @@ jobs:
run: |
set -ex

# Install random crate to force update of the registry
cargo install lazy_static || true
# Force update of the registry
cargo update || true

sudo apt-get install -y jq

Expand Down
5 changes: 5 additions & 0 deletions boards/arduino_mkrzero/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unreleased

# v0.12.1

- update to `atsamd-hal-0.16`, along with redefining pins using the bsp_pins! macro
- split up library into pin definitions and peripheral & USB setup function definitions

# v0.12.0

- update to `atsamd-hal-0.14` and other latest dependencies (#564)
Expand Down
17 changes: 15 additions & 2 deletions boards/arduino_mkrzero/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "arduino_mkrzero"
version = "0.12.0"
version = "0.12.1"
authors = ["Wez Furlong <wez@wezfurlong.org>", "David McGillicuddy <contact@djmcgill.co.uk>"]
description = "Board Support crate for the Arduino MKRZERO"
keywords = ["no-std", "arm", "cortex-m", "embedded-hal", "arduino"]
Expand All @@ -15,18 +15,23 @@ version = "0.7"
optional = true

[dependencies.atsamd-hal]
version = "0.14"
version = "0.16"
default-features = false

[dependencies.usb-device]
version = "0.2"
optional = true

[dependencies.embedded-sdmmc]
version = "0.3"
optional = true

[dev-dependencies]
cortex-m = "0.7"
usbd-serial = "0.1"
panic-halt = "0.2"
panic-semihosting = "0.5"
cortex-m-rtic = "1.0"

[features]
# ask the HAL to enable atsamd21g support
Expand All @@ -35,14 +40,22 @@ rt = ["cortex-m-rt", "atsamd-hal/samd21g-rt"]
usb = ["atsamd-hal/usb", "usb-device"]
unproven = ["atsamd-hal/unproven"]
use_semihosting = []
rtic = ["atsamd-hal/rtic"]

# for cargo flash
[package.metadata]
chip = "ATSAMD21G18A"

[dependencies]
embedded-hal = "0.2.7"

[[example]]
name = "blinky_basic"

[[example]]
name = "blinky_rtic"
required-features = ["rtic", "unproven"]

[[example]]
name = "usb_logging"
required-features = ["usb"]
Expand Down
4 changes: 2 additions & 2 deletions boards/arduino_mkrzero/examples/blinky_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ fn main() -> ! {
&mut peripherals.SYSCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = bsp::Pins::new(peripherals.PORT);
let mut led = pins.led_builtin.into_open_drain_output(&mut pins.port);
let pins = bsp::pins::Pins::new(peripherals.PORT);
let mut led = bsp::pin_alias!(pins.led).into_push_pull_output();
let mut delay = Delay::new(core.SYST, &mut clocks);

loop {
Expand Down
73 changes: 73 additions & 0 deletions boards/arduino_mkrzero/examples/blinky_rtic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//! Uses RTIC with the RTC as time source to blink an LED.
//!
//! The idle task is sleeping the CPU, so in practice this gives similar power
//! figure as the "sleeping_timer_rtc" example.
#![no_std]
#![no_main]

use arduino_mkrzero as bsp;

#[cfg(not(feature = "use_semihosting"))]
use panic_halt as _;
#[cfg(feature = "use_semihosting")]
use panic_semihosting as _;
use rtic::app;

#[app(device = bsp::pac, peripherals = true, dispatchers = [EVSYS])]
mod app {
use super::*;
use bsp::hal;
use hal::clock::{ClockGenId, ClockSource, GenericClockController};
use hal::pac::Peripherals;
use hal::prelude::*;
use hal::rtc::{Count32Mode, Duration, Rtc};

#[local]
struct Local {}

#[shared]
struct Shared {
// The LED could be a local resource, since it is only used in one task
// But we want to showcase shared resources and locking
led: bsp::pins::Led,
}

#[monotonic(binds = RTC, default = true)]
type RtcMonotonic = Rtc<Count32Mode>;

#[init]
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let mut peripherals: Peripherals = cx.device;
let pins = bsp::pins::Pins::new(peripherals.PORT);
let mut core: rtic::export::Peripherals = cx.core;
let mut clocks = GenericClockController::with_external_32kosc(
peripherals.GCLK,
&mut peripherals.PM,
&mut peripherals.SYSCTRL,
&mut peripherals.NVMCTRL,
);
let _gclk = clocks.gclk0();
let rtc_clock_src = clocks
.configure_gclk_divider_and_source(ClockGenId::GCLK2, 1, ClockSource::XOSC32K, false)
.unwrap();
clocks.configure_standby(ClockGenId::GCLK2, true);
let rtc_clock = clocks.rtc(&rtc_clock_src).unwrap();
let rtc = Rtc::count32_mode(peripherals.RTC, rtc_clock.freq(), &mut peripherals.PM);
let led = bsp::pin_alias!(pins.led).into();

// We can use the RTC in standby for maximum power savings
core.SCB.set_sleepdeep();

// Start the blink task
blink::spawn().unwrap();

(Shared { led }, Local {}, init::Monotonics(rtc))
}

#[task(shared = [led])]
fn blink(mut cx: blink::Context) {
// If the LED were a local resource, the lock would not be necessary
let _ = cx.shared.led.lock(|led| led.toggle());
blink::spawn_after(Duration::secs(3)).ok();
}
}
7 changes: 4 additions & 3 deletions boards/arduino_mkrzero/examples/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use panic_semihosting as _;
use bsp::entry;
use hal::clock::{GenericClockController, Tcc0Tcc1Clock};
use hal::delay::Delay;
use hal::gpio::AlternateE;
use hal::pac::{CorePeripherals, Peripherals};
use hal::prelude::*;
use hal::pwm::{Channel, Pwm0};
Expand All @@ -27,18 +28,18 @@ fn main() -> ! {
&mut peripherals.NVMCTRL,
);
let mut delay = Delay::new(core.SYST, &mut clocks);
let mut pins = bsp::Pins::new(peripherals.PORT);
let pins = bsp::pins::Pins::new(peripherals.PORT);

// PWM0_CH1 is A4 on the board - pin 19 or PA05
// see: https://github.com/arduino/ArduinoCore-samd/blob/master/variants/mkrzero/variant.cpp
let _a4 = pins.a4.into_function_e(&mut pins.port);
let _a4 = pins.pa04.into_mode::<AlternateE>();
let gclk0 = clocks.gclk0();

let tcc0_tcc1_clock: &Tcc0Tcc1Clock = &clocks.tcc0_tcc1(&gclk0).unwrap();

let mut pwm0 = Pwm0::new(
&tcc0_tcc1_clock,
1.khz(),
1u32.kHz(),
peripherals.TCC0,
&mut peripherals.PM,
);
Expand Down
37 changes: 17 additions & 20 deletions boards/arduino_mkrzero/examples/usb_logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

use arduino_mkrzero as bsp;
use bsp::hal;
use usb_device;
use usbd_serial;

#[cfg(not(feature = "use_semihosting"))]
use panic_halt as _;
Expand Down Expand Up @@ -38,25 +36,28 @@ fn main() -> ! {
&mut peripherals.SYSCTRL,
&mut peripherals.NVMCTRL,
);
let mut pins = bsp::Pins::new(peripherals.PORT);
let mut led = pins.led_builtin.into_open_drain_output(&mut pins.port);
let pins = bsp::pins::Pins::new(peripherals.PORT);
let mut led = bsp::pin_alias!(pins.led).into_push_pull_output();
let mut delay = Delay::new(core.SYST, &mut clocks);

let usb_n = bsp::pin_alias!(pins.usb_n);
let usb_p = bsp::pin_alias!(pins.usb_p);

let bus_allocator = unsafe {
USB_ALLOCATOR = Some(bsp::usb_allocator(
USB_ALLOCATOR = Some(bsp::usb::usb_allocator(
peripherals.USB,
&mut clocks,
&mut peripherals.PM,
pins.usb_n, // PA24, also usb_dm
pins.usb_p, // PA24 also usb_dp
usb_n.into(),
usb_p.into(),
));
USB_ALLOCATOR.as_ref().unwrap()
};

unsafe {
USB_SERIAL = Some(SerialPort::new(&bus_allocator));
USB_SERIAL = Some(SerialPort::new(bus_allocator));
USB_BUS = Some(
UsbDeviceBuilder::new(&bus_allocator, UsbVidPid(0x2222, 0x3333))
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x2222, 0x3333))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
Expand All @@ -78,27 +79,23 @@ fn main() -> ! {

// Turn off interrupts so we don't fight with the interrupt
cortex_m::interrupt::free(|_| unsafe {
USB_BUS.as_mut().map(|_| {
USB_SERIAL.as_mut().map(|serial| {
// Skip errors so we can continue the program
let _ = serial.write("log line\r\n".as_bytes());
});
})
if let Some(serial) = USB_SERIAL.as_mut() {
let _ = serial.write("log line\r\n".as_bytes());
}
});
}
}

fn poll_usb() {
unsafe {
USB_BUS.as_mut().map(|usb_dev| {
USB_SERIAL.as_mut().map(|serial| {
if let Some(usb_dev) = USB_BUS.as_mut() {
if let Some(serial) = USB_SERIAL.as_mut() {
usb_dev.poll(&mut [serial]);

// Make the other side happy
let mut buf = [0u8; 16];
let _ = serial.read(&mut buf);
});
});
}
}
};
}

Expand Down
Loading