mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix dabao mode
This commit is contained in:
parent
527f256ec1
commit
6427979446
3 changed files with 26 additions and 13 deletions
|
|
@ -92,6 +92,7 @@ impl MiniElf {
|
|||
let mut current_page_addr: usize = 0;
|
||||
let mut previous_addr: usize = 0;
|
||||
let mut last_mapped_xip = 0;
|
||||
#[cfg(feature = "swap")]
|
||||
let mut last_mapped_swap_virt = 0; // track the last virtual address mapped to swap, to catch gaps
|
||||
let image_phys_base = allocator.base_addr as usize + self.load_offset as usize;
|
||||
// It is a requirement that the image generator lay out the artifacts on disk such that
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
use core::{mem::size_of, slice};
|
||||
|
||||
#[cfg(any(feature = "board-baosec", feature = "board-baosor"))]
|
||||
use ux_api::minigfx::FrameBuffer;
|
||||
|
||||
#[cfg(feature = "atsama5d27")]
|
||||
pub use crate::platform::atsama5d27::load::InitialProcess;
|
||||
use crate::*;
|
||||
// define an uninhabited stub type for boards without framebuffers
|
||||
#[cfg(any(feature = "board-dabao"))]
|
||||
pub trait FrameBuffer {}
|
||||
|
||||
#[repr(C)]
|
||||
#[cfg(not(feature = "atsama5d27"))]
|
||||
|
|
@ -30,7 +36,7 @@ pub struct InitialProcess {
|
|||
/// We don't memorize the allocated results (in part because we don't have malloc/alloc to stick
|
||||
/// the table, and we don't know a priori how big it will be); we simply memorize the maximum extent,
|
||||
/// after which we allocate the book-keeping tables.
|
||||
pub fn phase_1(cfg: &mut BootConfig, detached_app: bool, fb: Option<&mut dyn ux_api::minigfx::FrameBuffer>) {
|
||||
pub fn phase_1(cfg: &mut BootConfig, detached_app: bool, fb: Option<&mut dyn FrameBuffer>) {
|
||||
// Allocate space for the stack pointer.
|
||||
// The bootloader should have placed the stack pointer at the end of RAM
|
||||
// prior to jumping to our program. Reserve space for the stack, so that it does not smash
|
||||
|
|
@ -499,10 +505,11 @@ impl TagType {
|
|||
|
||||
/// Copy program data from the SPI flash into newly-allocated RAM
|
||||
/// located at the end of memory space.
|
||||
fn copy_processes(cfg: &mut BootConfig, mut fb: Option<&mut dyn ux_api::minigfx::FrameBuffer>) {
|
||||
fn copy_processes(cfg: &mut BootConfig, mut _fb: Option<&mut dyn FrameBuffer>) {
|
||||
let mut _pid = 1;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
let arg_len = cfg.args.iter().count();
|
||||
for (i, tag) in cfg.args.iter().enumerate() {
|
||||
for (_i, tag) in cfg.args.iter().enumerate() {
|
||||
let tag_type = TagType::from(tag.name);
|
||||
match tag_type {
|
||||
TagType::IniF | TagType::IniE => {
|
||||
|
|
@ -880,13 +887,13 @@ fn copy_processes(cfg: &mut BootConfig, mut fb: Option<&mut dyn ux_api::minigfx:
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(ref mut fb) = fb {
|
||||
#[cfg(feature = "board-baosec")]
|
||||
if let Some(ref mut fb) = _fb {
|
||||
let start = 5;
|
||||
let end = 70;
|
||||
let increment = (end - start) / arg_len;
|
||||
let _percentage = start + increment * i;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
crate::platform::progress_bar(*fb, _percentage);
|
||||
let percentage = start + increment * _i;
|
||||
crate::platform::progress_bar(*fb, percentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#[cfg(any(feature = "board-baosec", feature = "board-baosor"))]
|
||||
use ux_api::minigfx::FrameBuffer;
|
||||
#[cfg(feature = "swap")]
|
||||
use xous::arch::{SWAP_CFG_VADDR, SWAP_COUNT_VADDR, SWAP_PT_VADDR};
|
||||
|
|
@ -5,12 +6,15 @@ use xous::arch::{SWAP_CFG_VADDR, SWAP_COUNT_VADDR, SWAP_PT_VADDR};
|
|||
#[cfg(feature = "swap")]
|
||||
use crate::swap::*;
|
||||
use crate::{env::EnvVariables, *};
|
||||
// define an uninhabited stub type for boards without framebuffers
|
||||
#[cfg(any(feature = "board-dabao"))]
|
||||
pub trait FrameBuffer {}
|
||||
|
||||
/// Phase 2 bootloader
|
||||
///
|
||||
/// Set up all the page tables, allocating new root page tables for SATPs and corresponding
|
||||
/// sub-pages starting from the base of previously copied process data.
|
||||
pub fn phase_2(cfg: &mut BootConfig, env_variables: EnvVariables, mut fb: Option<&mut dyn FrameBuffer>) {
|
||||
pub fn phase_2(cfg: &mut BootConfig, env_variables: EnvVariables, mut _fb: Option<&mut dyn FrameBuffer>) {
|
||||
let args = cfg.args;
|
||||
|
||||
// This is the offset in RAM where programs are loaded from.
|
||||
|
|
@ -42,8 +46,9 @@ pub fn phase_2(cfg: &mut BootConfig, env_variables: EnvVariables, mut fb: Option
|
|||
#[cfg(feature = "bao1x")]
|
||||
trng.setup_raw_generation(32); // this is safe to call multiple times to affirm the TRNG state
|
||||
|
||||
#[cfg(feature = "board-baosec")]
|
||||
let arg_len = args.iter().count();
|
||||
for (i, tag) in args.iter().enumerate() {
|
||||
for (_i, tag) in args.iter().enumerate() {
|
||||
let mut env_header = crate::env::EnvHeader::default();
|
||||
#[allow(unused_mut)]
|
||||
let mut pid_env = env_variables.clone();
|
||||
|
|
@ -106,13 +111,13 @@ pub fn phase_2(cfg: &mut BootConfig, env_variables: EnvVariables, mut fb: Option
|
|||
}
|
||||
process_offset -= load_size_rounded;
|
||||
}
|
||||
if let Some(ref mut fb) = fb {
|
||||
#[cfg(feature = "board-baosec")]
|
||||
if let Some(ref mut fb) = _fb {
|
||||
let start = 70;
|
||||
let end = 95;
|
||||
let increment = (end - start) / arg_len;
|
||||
let _percentage = start + increment * i;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
crate::platform::progress_bar(*fb, _percentage);
|
||||
let percentage = start + increment * _i;
|
||||
crate::platform::progress_bar(*fb, percentage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue