Skip to content

HAL Update Guide

Justin Beaurivage edited this page Sep 1, 2024 · 3 revisions

Unreleased

PAC updated to svd2rust 0.34.1

  • All peripherals are now lowercase. For example,
let pins = bsp::Pins::new(peripherals.PORT);

becomes

let pins = bsp::Pins::new(peripherals.port);
  • All peripheral types now use PascalCase. For example,
use bsp::pac::DMAC;

becomes

use bsp::pac::Dmac;
  • All register accessors are now methods instead of struct members. For example,
rtc.mode0().intflag.modify(|_, w| w.cmp0().set_bit());

becomes

rtc.mode0().intflag().modify(|_, w| w.cmp0().set_bit());

v0.17

usb-device updates

The interface for supplying string descriptors has changed from:

.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")

to

.strings(&[StringDescriptors::new(LangID::EN)
    .manufacturer("Fake company")
    .product("Serial port")
    .serial_number("TEST")])
.expect("Failed to set strings")

Critical Section feature required

Linking your firmware may result in errors like rust-lld: error: undefined symbol: _critical_section_1_0_acquire. In your firmware's Cargo.toml, specify the critical-section-single-core feature of cortex-m: cortex-m = {version = "0.7", features = ["critical-section-single-core"]}.

v0.15

SERCOM v2 now default

Code that had use hal::sercom::v2:: should be changed to use hal::sercom::, and usage of the v1 SERCOM implementation needs to be ported to v2.