diff options
| author | Caleb Jamison <[email protected]> | 2023-05-09 17:55:27 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-09 17:55:27 -0400 |
| commit | 9d971e5b150e2ebe51570040ea59e3ccdbef7b17 (patch) | |
| tree | 153a70e9123bbbd876f3a4b08659181d83ccec89 /embassy-rp | |
| parent | 5cfe1a1fb40470dfaf256fc87989fd67884113f1 (diff) | |
| parent | 856b944eaf20bbd5f1625226415af210a28af89a (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'embassy-rp')
| -rw-r--r-- | embassy-rp/Cargo.toml | 10 | ||||
| -rw-r--r-- | embassy-rp/src/boot2.bin | bin | 256 -> 0 bytes | |||
| -rw-r--r-- | embassy-rp/src/flash.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/i2c.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/interrupt.rs | 6 | ||||
| -rw-r--r-- | embassy-rp/src/lib.rs | 29 | ||||
| -rw-r--r-- | embassy-rp/src/uart/buffered.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/uart/mod.rs | 4 |
8 files changed, 47 insertions, 8 deletions
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index a2eb6c581..e395a994f 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -30,6 +30,15 @@ rom-func-cache = [] | |||
| 30 | intrinsics = [] | 30 | intrinsics = [] |
| 31 | rom-v2-intrinsics = [] | 31 | rom-v2-intrinsics = [] |
| 32 | 32 | ||
| 33 | # boot2 flash chip support. if none of these is enabled we'll default to w25q080 (used on the pico) | ||
| 34 | boot2-at25sf128a = [] | ||
| 35 | boot2-gd25q64cs = [] | ||
| 36 | boot2-generic-03h = [] | ||
| 37 | boot2-is25lp080 = [] | ||
| 38 | boot2-ram-memcpy = [] | ||
| 39 | boot2-w25q080 = [] | ||
| 40 | boot2-w25x10cl = [] | ||
| 41 | |||
| 33 | # Enable nightly-only features | 42 | # Enable nightly-only features |
| 34 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] | 43 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] |
| 35 | 44 | ||
| @@ -71,3 +80,4 @@ embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true} | |||
| 71 | paste = "1.0" | 80 | paste = "1.0" |
| 72 | pio-proc = {version= "0.2" } | 81 | pio-proc = {version= "0.2" } |
| 73 | pio = {version= "0.2.1" } | 82 | pio = {version= "0.2.1" } |
| 83 | rp2040-boot2 = "0.3" | ||
diff --git a/embassy-rp/src/boot2.bin b/embassy-rp/src/boot2.bin deleted file mode 100644 index fdc1fc756..000000000 --- a/embassy-rp/src/boot2.bin +++ /dev/null | |||
| Binary files differ | |||
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs index 6ab05ff0b..51c7af913 100644 --- a/embassy-rp/src/flash.rs +++ b/embassy-rp/src/flash.rs | |||
| @@ -25,7 +25,7 @@ pub const ERASE_SIZE: usize = 4096; | |||
| 25 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] | 25 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 26 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 26 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 27 | pub enum Error { | 27 | pub enum Error { |
| 28 | /// Opration using a location not in flash. | 28 | /// Operation using a location not in flash. |
| 29 | OutOfBounds, | 29 | OutOfBounds, |
| 30 | /// Unaligned operation or using unaligned buffers. | 30 | /// Unaligned operation or using unaligned buffers. |
| 31 | Unaligned, | 31 | Unaligned, |
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index cd5364393..d5dc94406 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -551,7 +551,7 @@ impl<'d, T: Instance + 'd, M: Mode> I2c<'d, T, M> { | |||
| 551 | 551 | ||
| 552 | if abort_reason.is_err() || (send_stop && last) { | 552 | if abort_reason.is_err() || (send_stop && last) { |
| 553 | // If the transaction was aborted or if it completed | 553 | // If the transaction was aborted or if it completed |
| 554 | // successfully wait until the STOP condition has occured. | 554 | // successfully wait until the STOP condition has occurred. |
| 555 | 555 | ||
| 556 | while !p.ic_raw_intr_stat().read().stop_det() {} | 556 | while !p.ic_raw_intr_stat().read().stop_det() {} |
| 557 | 557 | ||
diff --git a/embassy-rp/src/interrupt.rs b/embassy-rp/src/interrupt.rs index f21a5433b..989f5dc2d 100644 --- a/embassy-rp/src/interrupt.rs +++ b/embassy-rp/src/interrupt.rs | |||
| @@ -34,3 +34,9 @@ declare!(ADC_IRQ_FIFO); | |||
| 34 | declare!(I2C0_IRQ); | 34 | declare!(I2C0_IRQ); |
| 35 | declare!(I2C1_IRQ); | 35 | declare!(I2C1_IRQ); |
| 36 | declare!(RTC_IRQ); | 36 | declare!(RTC_IRQ); |
| 37 | declare!(SWI_IRQ_0); | ||
| 38 | declare!(SWI_IRQ_1); | ||
| 39 | declare!(SWI_IRQ_2); | ||
| 40 | declare!(SWI_IRQ_3); | ||
| 41 | declare!(SWI_IRQ_4); | ||
| 42 | declare!(SWI_IRQ_5); | ||
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index 118ce5237..980ebe7f4 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -131,9 +131,32 @@ embassy_hal_common::peripherals! { | |||
| 131 | WATCHDOG, | 131 | WATCHDOG, |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | #[link_section = ".boot2"] | 134 | macro_rules! select_bootloader { |
| 135 | #[used] | 135 | ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => { |
| 136 | static BOOT2: [u8; 256] = *include_bytes!("boot2.bin"); | 136 | $( |
| 137 | #[cfg(feature = $feature)] | ||
| 138 | #[link_section = ".boot2"] | ||
| 139 | #[used] | ||
| 140 | static BOOT2: [u8; 256] = rp2040_boot2::$loader; | ||
| 141 | )* | ||
| 142 | |||
| 143 | #[cfg(not(any( $( feature = $feature),* )))] | ||
| 144 | #[link_section = ".boot2"] | ||
| 145 | #[used] | ||
| 146 | static BOOT2: [u8; 256] = rp2040_boot2::$default; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | select_bootloader! { | ||
| 151 | "boot2-at25sf128a" => BOOT_LOADER_AT25SF128A, | ||
| 152 | "boot2-gd25q64cs" => BOOT_LOADER_GD25Q64CS, | ||
| 153 | "boot2-generic-03h" => BOOT_LOADER_GENERIC_03H, | ||
| 154 | "boot2-is25lp080" => BOOT_LOADER_IS25LP080, | ||
| 155 | "boot2-ram-memcpy" => BOOT_LOADER_RAM_MEMCPY, | ||
| 156 | "boot2-w25q080" => BOOT_LOADER_W25Q080, | ||
| 157 | "boot2-w25x10cl" => BOOT_LOADER_W25X10CL, | ||
| 158 | default => BOOT_LOADER_W25Q080 | ||
| 159 | } | ||
| 137 | 160 | ||
| 138 | pub mod config { | 161 | pub mod config { |
| 139 | use crate::clocks::ClockConfig; | 162 | use crate::clocks::ClockConfig; |
diff --git a/embassy-rp/src/uart/buffered.rs b/embassy-rp/src/uart/buffered.rs index 59fec8f1b..9d3de1bd8 100644 --- a/embassy-rp/src/uart/buffered.rs +++ b/embassy-rp/src/uart/buffered.rs | |||
| @@ -544,7 +544,7 @@ pub(crate) unsafe fn on_interrupt<T: Instance>(_: *mut ()) { | |||
| 544 | s.rx_waker.wake(); | 544 | s.rx_waker.wake(); |
| 545 | } | 545 | } |
| 546 | // Disable any further RX interrupts when the buffer becomes full or | 546 | // Disable any further RX interrupts when the buffer becomes full or |
| 547 | // errors have occured. this lets us buffer additional errors in the | 547 | // errors have occurred. This lets us buffer additional errors in the |
| 548 | // fifo without needing more error storage locations, and most applications | 548 | // fifo without needing more error storage locations, and most applications |
| 549 | // will want to do a full reset of their uart state anyway once an error | 549 | // will want to do a full reset of their uart state anyway once an error |
| 550 | // has happened. | 550 | // has happened. |
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index 4084c158a..a0ee6b4ce 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs | |||
| @@ -231,7 +231,7 @@ impl<'d, T: Instance> UartTx<'d, T, Async> { | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | impl<'d, T: Instance, M: Mode> UartRx<'d, T, M> { | 233 | impl<'d, T: Instance, M: Mode> UartRx<'d, T, M> { |
| 234 | /// Create a new DMA-enabled UART which can only recieve data | 234 | /// Create a new DMA-enabled UART which can only receive data |
| 235 | pub fn new( | 235 | pub fn new( |
| 236 | _uart: impl Peripheral<P = T> + 'd, | 236 | _uart: impl Peripheral<P = T> + 'd, |
| 237 | rx: impl Peripheral<P = impl RxPin<T>> + 'd, | 237 | rx: impl Peripheral<P = impl RxPin<T>> + 'd, |
| @@ -690,7 +690,7 @@ impl<'d, T: Instance, M: Mode> Uart<'d, T, M> { | |||
| 690 | self.tx.send_break(bits).await | 690 | self.tx.send_break(bits).await |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | /// Split the Uart into a transmitter and receiver, which is particuarly | 693 | /// Split the Uart into a transmitter and receiver, which is particularly |
| 694 | /// useful when having two tasks correlating to transmitting and receiving. | 694 | /// useful when having two tasks correlating to transmitting and receiving. |
| 695 | pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) { | 695 | pub fn split(self) -> (UartTx<'d, T, M>, UartRx<'d, T, M>) { |
| 696 | (self.tx, self.rx) | 696 | (self.tx, self.rx) |
