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

Disable several warnings that show up with rust 1.82.0(beta) #849

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rp-binary-info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub static PICOTOOL_HEADER: Header = unsafe {
/// This tells picotool how to convert RAM addresses back into Flash addresses
pub static MAPPING_TABLE: [MappingTableEntry; 2] = [
// This is the entry for .data
#[allow(unused_unsafe)]
MappingTableEntry {
source_addr_start: unsafe { core::ptr::addr_of!(__sidata) },
dest_addr_start: unsafe { core::ptr::addr_of!(__sdata) },
Expand Down
21 changes: 15 additions & 6 deletions rp2040-hal/src/rom_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
//! > functionality that would otherwise have to take up space in most user
//! > binaries.

#![allow(unknown_lints)]
#![allow(clippy::too_long_first_doc_paragraph)]

/// A bootrom function table code.
pub type RomFnTableCode = [u8; 2];

Expand Down Expand Up @@ -211,6 +214,7 @@ rom_functions! {
b"T3" fn ctz32(value: u32) -> u32;

/// Resets the RP2040 and uses the watchdog facility to re-start in BOOTSEL mode:
///
/// * gpio_activity_pin_mask is provided to enable an 'activity light' via GPIO attached LED
/// for the USB Mass Storage Device:
/// * 0 No pins are used as per cold boot.
Expand Down Expand Up @@ -254,16 +258,18 @@ rom_functions! {
/// function configures the SSI with a fixed SCK clock divisor of /6.
b"EX" unsafe fn flash_exit_xip() -> ();

/// Erase a count bytes, starting at addr (offset from start of flash). Optionally, pass a
/// block erase command e.g. D8h block erase, and the size of the block erased by this
/// command — this function will use the larger block erase where possible, for much higher
/// Erase a count bytes, starting at addr (offset from start of flash).
///
/// Optionally, pass a block erase command e.g. D8h block erase, and the size of the block erased
/// by this command — this function will use the larger block erase where possible, for much higher
/// erase speed. addr must be aligned to a 4096-byte sector, and count must be a multiple of
/// 4096 bytes.
b"RE" unsafe fn flash_range_erase(addr: u32, count: usize, block_size: u32, block_cmd: u8) -> ();

/// Program data to a range of flash addresses starting at `addr` (and
/// offset from the start of flash) and `count` bytes in size. The value
/// `addr` must be aligned to a 256-byte boundary, and `count` must be a
/// offset from the start of flash) and `count` bytes in size.
///
/// The value `addr` must be aligned to a 256-byte boundary, and `count` must be a
/// multiple of 256.
b"RP" unsafe fn flash_range_program(addr: u32, data: *const u8, count: usize) -> ();

Expand All @@ -272,13 +278,16 @@ rom_functions! {
b"FC" unsafe fn flash_flush_cache() -> ();

/// Configure the SSI to generate a standard 03h serial read command, with 24 address bits,
/// upon each XIP access. This is a very slow XIP configuration, but is very widely supported.
/// upon each XIP access.
///
/// This is a very slow XIP configuration, but is very widely supported.
/// The debugger calls this function after performing a flash erase/programming operation, so
/// that the freshly-programmed code and data is visible to the debug host, without having to
/// know exactly what kind of flash device is connected.
b"CX" unsafe fn flash_enter_cmd_xip() -> ();

/// This is the method that is entered by core 1 on reset to wait to be launched by core 0.
///
/// There are few cases where you should call this method (resetting core 1 is much better).
/// This method does not return and should only ever be called on core 1.
b"WV" unsafe fn wait_for_vector() -> !;
Expand Down
4 changes: 4 additions & 0 deletions rp2040-hal/src/sio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ impl SioFifo {
}
}

#[cfg(target_arch = "arm")]
macro_rules! concatln {
($(,)*) => {
""
Expand All @@ -220,6 +221,8 @@ macro_rules! concatln {
// alias the division operators to these for a similar reason r0 is the
// result either way and r1 a scratch register, so the caller can't assume it
// retains the argument value.

#[cfg(target_arch = "arm")]
macro_rules! hwdivider_head {
() => {
concatln!(
Expand All @@ -238,6 +241,7 @@ macro_rules! hwdivider_head {
};
}

#[cfg(target_arch = "arm")]
macro_rules! hwdivider_tail {
() => {
concatln!(
Expand Down
1 change: 1 addition & 0 deletions rp2040-hal/src/uart/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for UartPeripheral<Enabled,
}

fn flush(&mut self) -> nb::Result<(), Self::Error> {
#[allow(unreachable_patterns)]
super::writer::transmit_flushed(&self.device).map_err(|e| match e {
WouldBlock => WouldBlock,
Other(v) => match v {},
Expand Down
2 changes: 2 additions & 0 deletions rp2040-hal/src/uart/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub(crate) fn write_raw<'d>(
pub(crate) fn write_full_blocking(rb: &RegisterBlock, data: &[u8]) {
let mut temp = data;

#[allow(unreachable_patterns)]
while !temp.is_empty() {
temp = match write_raw(rb, temp) {
Ok(remaining) => remaining,
Expand Down Expand Up @@ -279,6 +280,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for Writer<D, P> {
}

fn flush(&mut self) -> nb::Result<(), Self::Error> {
#[allow(unreachable_patterns)]
transmit_flushed(&self.device).map_err(|e| match e {
WouldBlock => WouldBlock,
Other(v) => match v {},
Expand Down
11 changes: 7 additions & 4 deletions rp235x-hal/src/rom_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ declare_rom_function! {

declare_rom_function! {
/// Configure QMI for one of a small menu of XIP read modes supported by the
/// bootrom. This mode is configured for both memory windows (both chip
/// bootrom.
///
/// This mode is configured for both memory windows (both chip
/// selects), and the clock divisor is also applied to direct mode.
///
/// The available modes are:
Expand Down Expand Up @@ -393,9 +395,10 @@ declare_rom_function! {

declare_rom_function! {
/// Restore the QMI address translation registers, ATRANS0 through ATRANS7,
/// to their reset state. This makes the runtime- to-storage address map an
/// identity map, i.e. the mapped and unmapped address are equal, and the
/// entire space is fully mapped.
/// to their reset state.
///
/// This makes the runtime- to-storage address map an identity map, i.e. the
/// mapped and unmapped address are equal, and the entire space is fully mapped.
///
/// See [Section 12.14.4](https://rptl.io/rp2350-datasheet#section_bootrom) of the RP2350
/// datasheet.
Expand Down
1 change: 1 addition & 0 deletions rp235x-hal/src/uart/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for UartPeripheral<Enabled,
}

fn flush(&mut self) -> nb::Result<(), Self::Error> {
#[allow(unreachable_patterns)]
super::writer::transmit_flushed(&self.device).map_err(|e| match e {
WouldBlock => WouldBlock,
Other(v) => match v {},
Expand Down
2 changes: 2 additions & 0 deletions rp235x-hal/src/uart/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub(crate) fn write_raw<'d>(
pub(crate) fn write_full_blocking(rb: &RegisterBlock, data: &[u8]) {
let mut temp = data;

#[allow(unreachable_patterns)]
while !temp.is_empty() {
temp = match write_raw(rb, temp) {
Ok(remaining) => remaining,
Expand Down Expand Up @@ -280,6 +281,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for Writer<D, P> {
}

fn flush(&mut self) -> nb::Result<(), Self::Error> {
#[allow(unreachable_patterns)]
transmit_flushed(&self.device).map_err(|e| match e {
WouldBlock => WouldBlock,
Other(v) => match v {},
Expand Down