aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
authorCaleb Jamison <[email protected]>2023-05-09 17:55:27 -0400
committerGitHub <[email protected]>2023-05-09 17:55:27 -0400
commit9d971e5b150e2ebe51570040ea59e3ccdbef7b17 (patch)
tree153a70e9123bbbd876f3a4b08659181d83ccec89 /embassy-rp
parent5cfe1a1fb40470dfaf256fc87989fd67884113f1 (diff)
parent856b944eaf20bbd5f1625226415af210a28af89a (diff)
Merge branch 'master' into master
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/Cargo.toml10
-rw-r--r--embassy-rp/src/boot2.binbin256 -> 0 bytes
-rw-r--r--embassy-rp/src/flash.rs2
-rw-r--r--embassy-rp/src/i2c.rs2
-rw-r--r--embassy-rp/src/interrupt.rs6
-rw-r--r--embassy-rp/src/lib.rs29
-rw-r--r--embassy-rp/src/uart/buffered.rs2
-rw-r--r--embassy-rp/src/uart/mod.rs4
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 = []
30intrinsics = [] 30intrinsics = []
31rom-v2-intrinsics = [] 31rom-v2-intrinsics = []
32 32
33# boot2 flash chip support. if none of these is enabled we'll default to w25q080 (used on the pico)
34boot2-at25sf128a = []
35boot2-gd25q64cs = []
36boot2-generic-03h = []
37boot2-is25lp080 = []
38boot2-ram-memcpy = []
39boot2-w25q080 = []
40boot2-w25x10cl = []
41
33# Enable nightly-only features 42# Enable nightly-only features
34nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly", "dep:embassy-usb-driver", "dep:embedded-io"] 43nightly = ["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}
71paste = "1.0" 80paste = "1.0"
72pio-proc = {version= "0.2" } 81pio-proc = {version= "0.2" }
73pio = {version= "0.2.1" } 82pio = {version= "0.2.1" }
83rp2040-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))]
27pub enum Error { 27pub 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);
34declare!(I2C0_IRQ); 34declare!(I2C0_IRQ);
35declare!(I2C1_IRQ); 35declare!(I2C1_IRQ);
36declare!(RTC_IRQ); 36declare!(RTC_IRQ);
37declare!(SWI_IRQ_0);
38declare!(SWI_IRQ_1);
39declare!(SWI_IRQ_2);
40declare!(SWI_IRQ_3);
41declare!(SWI_IRQ_4);
42declare!(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"] 134macro_rules! select_bootloader {
135#[used] 135 ( $( $feature:literal => $loader:ident, )+ default => $default:ident ) => {
136static 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
150select_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
138pub mod config { 161pub 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
233impl<'d, T: Instance, M: Mode> UartRx<'d, T, M> { 233impl<'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)