Skip to content

Commit

Permalink
add generic bootloader feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dotcypress committed Oct 15, 2023
1 parent f9e3508 commit 70dddac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,17 @@ jobs:
args: --release --target=thumbv6m-none-eabi
- name: Pack firmware
run: elf2uf2-rs target/thumbv6m-none-eabi/release/ula ula_${{ github.ref_name }}.uf2
- name: Build generic bootloader firmware
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=thumbv6m-none-eabi --features=generic-bootloader
- name: Pack generic bootloader firmware
run: elf2uf2-rs target/thumbv6m-none-eabi/release/ula ula_${{ github.ref_name }}_generic.uf2
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ula_${{ github.ref_name }}.uf2
files: |
ula_${{ github.ref_name }}.uf2
ula_${{ github.ref_name }}_generic.uf2
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ cortex-m = "0.7.7"
panic-probe = "0.3.1"
embedded-hal = "0.2.7"

[features]
default = []
generic-bootloader = []

[profile.dev]
codegen-units = 1
debug = 2
Expand Down
11 changes: 9 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ pub const SAMPLE_RATE: usize = 100_000_000;
pub const PIN_BASE: usize = 0;
pub const XTAL_FREQ_HZ: u32 = 12_000_000_u32;

#[link_section = ".boot2"]
#[no_mangle]
#[cfg(not(feature = "generic-bootloader"))]
#[used]
#[no_mangle]
#[link_section = ".boot2"]
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;

#[cfg(feature = "generic-bootloader")]
#[used]
#[no_mangle]
#[link_section = ".boot2"]
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;

#[rtic::app(device = pac, peripherals = true)]
mod app {
use super::*;
Expand Down

0 comments on commit 70dddac

Please sign in to comment.