Replaced exclude_firmwares feature with include_firmwares and added invert_rx feature
This commit is contained in:
parent
eed8db4863
commit
419a960500
|
@ -114,7 +114,8 @@ dotenvy = "0.15"
|
|||
[features]
|
||||
# With this feature enabled the cyw43 fiwmares are not included in the build and need to be manually flashed
|
||||
# This helps speed up development
|
||||
exclude_firmwares = []
|
||||
include_firmwares = []
|
||||
invert_rx = []
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
mkdir -p target/firmware
|
||||
cargo objcopy --release -- -O binary target/firmware/firmware
|
||||
cargo objcopy --release --features=include_firmwares,invert_rx -- -O binary target/firmware/firmware
|
||||
shasum -a 512 -b target/firmware/firmware | dd ibs=128 count=1 | xxd -p -r > target/firmware/checksum
|
||||
signify -S -m target/firmware/checksum -s ~/Projects/crypt/R0/private/keys/firmware/pico_p1.sec -x target/firmware/checksum.sig
|
||||
tail -n1 target/firmware/checksum.sig | base64 -d -i | dd ibs=10 skip=1 > target/firmware/signed
|
||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -177,7 +177,7 @@ async fn uart_rx_task(
|
|||
/// Get the cyw43 firmware blobs
|
||||
///
|
||||
/// # Safety
|
||||
/// When building with `exclude_firmwares` make sure to flash the firmwares using the following
|
||||
/// When building without `include_firmwares` make sure to flash the firmwares using the following
|
||||
/// commands:
|
||||
/// ```bash
|
||||
/// probe-rs download firmware/43439A0.bin --format bin --chip RP2040 --base-address 0x101BE000
|
||||
|
@ -185,7 +185,12 @@ async fn uart_rx_task(
|
|||
/// ```
|
||||
unsafe fn get_firmware() -> (&'static [u8], &'static [u8]) {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "exclude_firmwares")] {
|
||||
if #[cfg(feature = "include_firmwares")] {
|
||||
let fw = include_bytes!("../firmware/43439A0.bin");
|
||||
let clm = include_bytes!("../firmware/43439A0_clm.bin");
|
||||
|
||||
(fw, clm)
|
||||
} else {
|
||||
// TODO: It would be nice if it could automatically get the correct size
|
||||
extern "C" {
|
||||
#[link_name = "__fw_start"]
|
||||
|
@ -195,11 +200,6 @@ unsafe fn get_firmware() -> (&'static [u8], &'static [u8]) {
|
|||
}
|
||||
|
||||
(&fw, &clm)
|
||||
} else {
|
||||
let fw = include_bytes!("../firmware/43439A0.bin");
|
||||
let clm = include_bytes!("../firmware/43439A0_clm.bin");
|
||||
|
||||
(fw, clm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,10 @@ async fn main(spawner: Spawner) {
|
|||
// === UART ===
|
||||
let mut config = uart::Config::default();
|
||||
config.parity = Parity::ParityNone;
|
||||
// config.invert_rx = true;
|
||||
#[cfg(feature = "invert_rx")]
|
||||
{
|
||||
config.invert_rx = true;
|
||||
}
|
||||
|
||||
let rx = UartRx::new(p.UART0, p.PIN_17, Irqs, p.DMA_CH0, config);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user