mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
some final tweaks for cross-platform integration
This commit is contained in:
parent
032bd864db
commit
e34d740bc6
3 changed files with 16 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ debug-print = []
|
||||||
earlyprintk = []
|
earlyprintk = []
|
||||||
renode-bypass = []
|
renode-bypass = []
|
||||||
secboot = []
|
secboot = []
|
||||||
|
simulation-only = []
|
||||||
#default = ["debug-print"]
|
#default = ["debug-print"]
|
||||||
resume = [] # suspend/resume pathway code
|
resume = [] # suspend/resume pathway code
|
||||||
default = []
|
default = []
|
||||||
|
|
@ -538,7 +538,11 @@ pub struct ProgramDescription {
|
||||||
// Note: inline constants are not yet stable in Rust: https://github.com/rust-lang/rust/pull/104087
|
// Note: inline constants are not yet stable in Rust: https://github.com/rust-lang/rust/pull/104087
|
||||||
#[link_section = ".text.init"]
|
#[link_section = ".text.init"]
|
||||||
#[export_name = "_start"]
|
#[export_name = "_start"]
|
||||||
pub extern "C" fn _start(kernel_args: usize, loader_sig: usize) {
|
pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
|
||||||
|
#[cfg(feature="precursor")]
|
||||||
|
let _kernel_args = _kernel_args;
|
||||||
|
#[cfg(feature="cramium")]
|
||||||
|
let _kernel_args = _start as *const usize as usize + platform::KERNEL_OFFSET;
|
||||||
unsafe {
|
unsafe {
|
||||||
asm! (
|
asm! (
|
||||||
"li t0, 0xffffffff",
|
"li t0, 0xffffffff",
|
||||||
|
|
@ -567,7 +571,7 @@ pub extern "C" fn _start(kernel_args: usize, loader_sig: usize) {
|
||||||
// Start Rust
|
// Start Rust
|
||||||
"j rust_entry",
|
"j rust_entry",
|
||||||
|
|
||||||
kernel_args = in(reg) kernel_args,
|
kernel_args = in(reg) _kernel_args,
|
||||||
loader_sig = in(reg) loader_sig,
|
loader_sig = in(reg) loader_sig,
|
||||||
ram_top = in(reg) (platform::RAM_BASE + platform::RAM_SIZE),
|
ram_top = in(reg) (platform::RAM_BASE + platform::RAM_SIZE),
|
||||||
// On Precursor - 0x40FFE01C: currently allowed stack extent - 8k - (7 words). 7 words are for kernel backup args - see bootloader in betrusted-soc
|
// On Precursor - 0x40FFE01C: currently allowed stack extent - 8k - (7 words). 7 words are for kernel backup args - see bootloader in betrusted-soc
|
||||||
|
|
@ -1539,7 +1543,10 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
|
||||||
#[cfg(not(feature="resume"))]
|
#[cfg(not(feature="resume"))]
|
||||||
let clean = {
|
let clean = {
|
||||||
// cold boot path
|
// cold boot path
|
||||||
println!("no suspend marker found, doing a cold boot!");
|
println!("No suspend marker found, doing a cold boot!");
|
||||||
|
#[cfg(feature="simulation-only")]
|
||||||
|
println!("Configured for simulation. Skipping RAM clear!");
|
||||||
|
#[cfg(not(feature="simulation-only"))]
|
||||||
clear_ram(&mut cfg);
|
clear_ram(&mut cfg);
|
||||||
phase_1(&mut cfg);
|
phase_1(&mut cfg);
|
||||||
phase_2(&mut cfg);
|
phase_2(&mut cfg);
|
||||||
|
|
@ -1551,7 +1558,7 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
|
||||||
#[cfg(feature="resume")]
|
#[cfg(feature="resume")]
|
||||||
if !clean {
|
if !clean {
|
||||||
// cold boot path
|
// cold boot path
|
||||||
println!("no suspend marker found, doing a cold boot!");
|
println!("No suspend marker found, doing a cold boot!");
|
||||||
clear_ram(&mut cfg);
|
clear_ram(&mut cfg);
|
||||||
phase_1(&mut cfg);
|
phase_1(&mut cfg);
|
||||||
phase_2(&mut cfg);
|
phase_2(&mut cfg);
|
||||||
|
|
@ -1738,7 +1745,7 @@ fn check_resume(cfg: &mut BootConfig) -> (bool, bool, u32) {
|
||||||
|
|
||||||
fn clear_ram(cfg: &mut BootConfig) {
|
fn clear_ram(cfg: &mut BootConfig) {
|
||||||
// clear RAM on a cold boot.
|
// clear RAM on a cold boot.
|
||||||
// RAM is persistent and battery-backed. This means secret material could potentiall
|
// RAM is persistent and battery-backed. This means secret material could potentially
|
||||||
// stay there forever, if not explicitly cleared. This clear adds a couple seconds
|
// stay there forever, if not explicitly cleared. This clear adds a couple seconds
|
||||||
// to a cold boot, but it's probably worth it. Note that it doesn't happen on a suspend/resume.
|
// to a cold boot, but it's probably worth it. Note that it doesn't happen on a suspend/resume.
|
||||||
let ram: *mut u32 = cfg.sram_start as *mut u32;
|
let ram: *mut u32 = cfg.sram_start as *mut u32;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
pub const RAM_SIZE: usize = utralib::generated::HW_SRAM_MEM_LEN;
|
pub const RAM_SIZE: usize = utralib::generated::HW_SRAM_MEM_LEN;
|
||||||
pub const RAM_BASE: usize = utralib::generated::HW_SRAM_MEM;
|
pub const RAM_BASE: usize = utralib::generated::HW_SRAM_MEM;
|
||||||
|
|
||||||
|
// location of kernel, as offset from the base of ReRAM. This needs to match up with what is in link.x.
|
||||||
|
pub const KERNEL_OFFSET: usize = 0x9000;
|
||||||
|
|
||||||
#[cfg(feature="platform-tests")]
|
#[cfg(feature="platform-tests")]
|
||||||
pub mod duart {
|
pub mod duart {
|
||||||
pub const UART_DOUT: utralib::Register = utralib::Register::new(0, 0xff);
|
pub const UART_DOUT: utralib::Register = utralib::Register::new(0, 0xff);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue