-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from absw/staging
Sprint 4 release
- Loading branch information
Showing
65 changed files
with
839 additions
and
5,177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: actions | ||
on: [push] | ||
jobs: | ||
build-loadstone: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Authentication | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: | | ||
${{ secrets.PATHFINDERDELL_PRIVATE_KEY }} | ||
- name: Cargo initialisation | ||
run: | | ||
~/.cargo/bin/rustup default nightly | ||
~/.cargo/bin/rustup update | ||
~/.cargo/bin/rustup component add llvm-tools-preview | ||
~/.cargo/bin/rustup target add thumbv7em-none-eabihf | ||
~/.cargo/bin/cargo install cargo-binutils | ||
- name: Documentation | ||
run: ~/.cargo/bin/cargo d | ||
|
||
- name: Tests | ||
run: ~/.cargo/bin/cargo test --release | ||
|
||
- name: Building | ||
run: ~/.cargo/bin/cargo gen_loadstone | ||
|
||
- name: Upload loadstone | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: loadstone | ||
path: loadstone.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.gdb_history | ||
Cargo.lock | ||
target/ | ||
blue_hal/ | ||
*.bin | ||
|
||
# editor files | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,36 +14,36 @@ default = [ | |
"stm32f412_discovery", | ||
"defmt-default", | ||
] | ||
stm32f412_discovery = ["blue_hal/stm32f412_discovery", "stm32f412"] | ||
stm32f429 = ["stm32f4_any"] | ||
stm32f469 = ["stm32f4_any"] | ||
stm32f407 = ["stm32f4_any"] | ||
stm32f412 = ["stm32f4_any"] | ||
stm32f4_any = ["stm32_any"] | ||
stm32_any = ["cortex_m_any"] | ||
cortex_m_any = [] | ||
defmt-default = [] | ||
defmt-trace = [] | ||
defmt-debug = [] | ||
defmt-info = [] | ||
defmt-warn = [] | ||
defmt-error = [] | ||
stm32f412_discovery = ["stm32f412"] | ||
stm32f429 = ["stm32f4/stm32f429", "stm32f4_any"] | ||
stm32f469 = ["stm32f4/stm32f469", "stm32f4_any"] | ||
stm32f407 = ["stm32f4/stm32f407", "stm32f4_any"] | ||
stm32f412 = ["stm32f4/stm32f412", "stm32f4_any"] | ||
stm32f4_any = ["stm32_any"] | ||
stm32_any = ["cortex_m_any"] | ||
cortex_m_any = [] | ||
|
||
[dependencies] | ||
cortex-m = "0.6.0" | ||
cortex-m-rt = "0.6.10" | ||
cortex-m-semihosting = "0.3.3" | ||
bluefruit_rust_hal = { path = "bluefruit_rust_hal" } | ||
panic-abort = "*" | ||
nb = "*" | ||
paste = "*" | ||
panic-abort = "*" | ||
static_assertions = "*" | ||
defmt = { git = "https://github.com/knurling-rs/defmt.git", branch = "main" } | ||
defmt-rtt = { git = "https://github.com/knurling-rs/defmt.git", branch = "main" } | ||
defmt = "0.1" | ||
defmt-rtt = "0.1" | ||
|
||
[dependencies.nom] | ||
version = "*" | ||
default-features = false | ||
[dependencies.blue_hal] | ||
# Uncomment the next line and comment the next two lines to develop blue_hal locally in parallel | ||
#path = "blue_hal" | ||
git = "ssh://[email protected]/absw/blue_hal.git" | ||
branch = "main" | ||
|
||
[dependencies.ufmt] | ||
version = "*" | ||
|
@@ -53,10 +53,6 @@ default-features = false | |
version = "*" | ||
default-features = false | ||
|
||
[dependencies.stm32f4] | ||
version = "*" | ||
features = ["rt"] | ||
|
||
[lib] | ||
name = "loadstone_lib" | ||
test = true | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#![cfg_attr(test, allow(unused_attributes))] | ||
#![cfg_attr(all(not(test), target_arch = "arm"), no_std)] | ||
#![cfg_attr(target_arch = "arm", no_main)] | ||
|
||
#[allow(unused_imports)] | ||
use cortex_m_rt::{entry, exception}; | ||
|
||
#[cfg(target_arch = "arm")] | ||
#[entry] | ||
fn main() -> ! { | ||
use loadstone_lib::devices::boot_manager; | ||
let app = boot_manager::BootManager::new(); | ||
app.run(); | ||
} | ||
|
||
#[cfg(not(target_arch = "arm"))] | ||
fn main() {} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//! Fully CLI interactive boot manager for the demo application. | ||
use super::{ | ||
cli::{file_transfer, Cli}, | ||
image, | ||
}; | ||
use crate::error::Error; | ||
use blue_hal::{ | ||
hal::{flash, serial}, | ||
stm32pac::SCB, | ||
utilities::xmodem, | ||
}; | ||
|
||
pub struct BootManager<EXTF, SRL> | ||
where | ||
EXTF: flash::ReadWrite, | ||
Error: From<EXTF::Error>, | ||
SRL: serial::ReadWrite + file_transfer::FileTransfer, | ||
Error: From<<SRL as serial::Read>::Error>, | ||
{ | ||
pub(crate) external_banks: &'static [image::Bank<<EXTF as flash::ReadWrite>::Address>], | ||
pub(crate) external_flash: EXTF, | ||
pub(crate) cli: Option<Cli<SRL>>, | ||
} | ||
|
||
impl<EXTF, SRL> BootManager<EXTF, SRL> | ||
where | ||
EXTF: flash::ReadWrite, | ||
Error: From<EXTF::Error>, | ||
SRL: serial::ReadWrite + file_transfer::FileTransfer, | ||
Error: From<<SRL as serial::Read>::Error>, | ||
{ | ||
/// Returns an iterator of all external flash banks. | ||
pub fn external_banks(&self) -> impl Iterator<Item = image::Bank<EXTF::Address>> { | ||
self.external_banks.iter().cloned() | ||
} | ||
|
||
/// Writes a firmware image to an external flash bank. | ||
pub fn store_image<I>( | ||
&mut self, | ||
blocks: I, | ||
bank: image::Bank<EXTF::Address>, | ||
) -> Result<(), Error> | ||
where | ||
I: Iterator<Item = [u8; xmodem::PAYLOAD_SIZE]>, | ||
{ | ||
for (i, block) in blocks.enumerate() { | ||
nb::block!(self.external_flash.write(bank.location + block.len() * i, &block))?; | ||
} | ||
Ok(()) | ||
} | ||
|
||
pub fn format_external(&mut self) -> Result<(), Error> { | ||
nb::block!(self.external_flash.erase())?; | ||
Ok(()) | ||
} | ||
|
||
pub fn reset(&mut self) -> ! { SCB::sys_reset(); } | ||
|
||
pub fn run(mut self) -> ! { | ||
let mut cli = self.cli.take().unwrap(); | ||
loop { | ||
cli.run(&mut self) | ||
} | ||
} | ||
} |
Oops, something went wrong.