mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
cleanup functional code specifiers for boot partitions
This commit is contained in:
parent
e7135d9e80
commit
6b8d8f09f7
2 changed files with 18 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ use alloc::collections::VecDeque;
|
|||
#[cfg(feature = "unsafe-dev")]
|
||||
use core::cell::RefCell;
|
||||
|
||||
use bao1x_api::signatures::FunctionCode;
|
||||
#[cfg(feature = "unsafe-dev")]
|
||||
use critical_section::Mutex;
|
||||
use platform::*;
|
||||
|
|
@ -81,11 +82,14 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_REVOCATION_OFFSET,
|
||||
&[FunctionCode::Boot0 as u32], // only boot0 is allowed for boot0
|
||||
false,
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
seal_boot0_keys();
|
||||
let allowed_functions =
|
||||
[FunctionCode::Boot1 as u32, FunctionCode::UpdatedBoot1 as u32, FunctionCode::Developer as u32];
|
||||
let one_way_access = bao1x_hal::acram::OneWayCounter::new();
|
||||
match one_way_access.get_decoded::<bao1x_api::AltBootCoding>() {
|
||||
Ok(bao1x_api::AltBootCoding::PrimaryPartition) => {
|
||||
|
|
@ -94,6 +98,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
bao1x_api::BOOT1_START as *const u32,
|
||||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_REVOCATION_OFFSET,
|
||||
&allowed_functions,
|
||||
true,
|
||||
)
|
||||
.ok();
|
||||
|
|
@ -101,6 +106,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
bao1x_api::LOADER_START as *const u32,
|
||||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_REVOCATION_OFFSET,
|
||||
&allowed_functions,
|
||||
true,
|
||||
)
|
||||
.ok();
|
||||
|
|
@ -111,6 +117,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
bao1x_api::LOADER_START as *const u32,
|
||||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_REVOCATION_OFFSET,
|
||||
&allowed_functions,
|
||||
true,
|
||||
)
|
||||
.ok();
|
||||
|
|
@ -118,6 +125,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
bao1x_api::BOOT1_START as *const u32,
|
||||
bao1x_api::BOOT0_START as *const u32,
|
||||
bao1x_api::BOOT0_REVOCATION_OFFSET,
|
||||
&allowed_functions,
|
||||
true,
|
||||
)
|
||||
.ok();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
use bao1x_api::*;
|
||||
use bao1x_api::{signatures::FunctionCode, *};
|
||||
use bao1x_hal::board::KeyPress;
|
||||
|
||||
const ALLOWED_FUNCTIONS: [u32; 5] = [
|
||||
FunctionCode::Baremetal as u32,
|
||||
FunctionCode::UpdatedBaremetal as u32,
|
||||
FunctionCode::Loader as u32,
|
||||
FunctionCode::UpdatedLoader as u32,
|
||||
FunctionCode::Developer as u32,
|
||||
];
|
||||
pub fn try_boot<T: IoSetup + IoGpio>(board_type: &BoardTypeCoding, iox: &T) -> Option<KeyPress> {
|
||||
if let Some(key) = crate::platform::get_key(board_type, iox) {
|
||||
// TODO: on baosec v2, we should not get Invalid keys. However, as we wait for the new
|
||||
|
|
@ -26,6 +33,7 @@ pub fn try_boot<T: IoSetup + IoGpio>(board_type: &BoardTypeCoding, iox: &T) -> O
|
|||
bao1x_api::LOADER_START as *const u32,
|
||||
bao1x_api::BOOT1_START as *const u32,
|
||||
bao1x_api::BOOT1_REVOCATION_OFFSET,
|
||||
&ALLOWED_FUNCTIONS,
|
||||
true,
|
||||
) {
|
||||
Ok(k) => crate::println!("**should be unreachable** Booted with key {}", k),
|
||||
|
|
@ -55,6 +63,7 @@ pub fn boot_or_die() -> ! {
|
|||
bao1x_api::LOADER_START as *const u32,
|
||||
bao1x_api::BOOT1_START as *const u32,
|
||||
bao1x_api::BOOT1_REVOCATION_OFFSET,
|
||||
&ALLOWED_FUNCTIONS,
|
||||
true,
|
||||
) {
|
||||
Ok(k) => crate::println!("**should be unreachable** Booted with key {}", k),
|
||||
|
|
|
|||
Loading…
Reference in a new issue