mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
extend the image building tools to handle detached apps
This commit is contained in:
parent
fd6077a64d
commit
12e6292325
3 changed files with 10 additions and 2 deletions
|
|
@ -48,6 +48,9 @@ name = "read-tags"
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "sign-image"
|
name = "sign-image"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "create-detached-app"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
precursor = []
|
precursor = []
|
||||||
renode = []
|
renode = []
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ where
|
||||||
Some("baremetal") => bao1x_api::BAREMETAL_START,
|
Some("baremetal") => bao1x_api::BAREMETAL_START,
|
||||||
Some("kernel") => bao1x_api::KERNEL_START,
|
Some("kernel") => bao1x_api::KERNEL_START,
|
||||||
Some("swap") => bao1x_api::SWAP_START_UF2,
|
Some("swap") => bao1x_api::SWAP_START_UF2,
|
||||||
|
Some("app") => bao1x_api::dabao::APP_RRAM_START,
|
||||||
_ => return Err(String::from("UF2 Image Requires a function code").into()),
|
_ => return Err(String::from("UF2 Image Requires a function code").into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ pub struct XousArguments {
|
||||||
pub ram_length: XousSize,
|
pub ram_length: XousSize,
|
||||||
ram_name: u32,
|
ram_name: u32,
|
||||||
pub arguments: Vec<Box<dyn XousArgument>>,
|
pub arguments: Vec<Box<dyn XousArgument>>,
|
||||||
|
pub detached_offset: Option<XousSize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for XousArguments {
|
impl fmt::Display for XousArguments {
|
||||||
|
|
@ -72,11 +73,14 @@ impl fmt::Display for XousArguments {
|
||||||
|
|
||||||
impl XousArguments {
|
impl XousArguments {
|
||||||
pub fn new(ram_start: XousSize, ram_length: XousSize, ram_name: u32) -> XousArguments {
|
pub fn new(ram_start: XousSize, ram_length: XousSize, ram_name: u32) -> XousArguments {
|
||||||
XousArguments { ram_start, ram_length, ram_name, arguments: vec![] }
|
XousArguments { ram_start, ram_length, ram_name, arguments: vec![], detached_offset: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_detached_offset(&mut self, offset: XousSize) { self.detached_offset = Some(offset); }
|
||||||
|
|
||||||
pub fn finalize(&mut self) {
|
pub fn finalize(&mut self) {
|
||||||
let mut running_offset = crate::tags::align_size_up(self.len() as usize, 0);
|
let mut running_offset =
|
||||||
|
crate::tags::align_size_up(self.len() as usize, 0) + self.detached_offset.unwrap_or(0) as usize;
|
||||||
// println!("offset: {:x}, alignment_offset: {:x}", running_offset, 0);
|
// println!("offset: {:x}, alignment_offset: {:x}", running_offset, 0);
|
||||||
for arg in &mut self.arguments {
|
for arg in &mut self.arguments {
|
||||||
running_offset = crate::tags::align_size_up(running_offset, arg.alignment_offset());
|
running_offset = crate::tags::align_size_up(running_offset, arg.alignment_offset());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue