add a feature to force board type

this is useful in the limited case that the board type is incorrect
in alt-boot mode. saves a step having to type in a command to fix
it.
This commit is contained in:
bunnie 2025-10-29 00:50:24 +08:00
parent 395791b70b
commit d9cc765419
2 changed files with 11 additions and 0 deletions

View file

@ -45,6 +45,7 @@ print-ifr = []
test-boot0-keys = []
alt-boot1 = []
force-dabao = []
verilator-only = []
default = []

View file

@ -82,6 +82,16 @@ pub unsafe extern "C" fn rust_entry() -> ! {
crate::println!("Configured board type: {:?}", board_type);
if board_type == BoardTypeCoding::Baosec {
IS_BAOSEC.store(true, Ordering::SeqCst);
#[cfg(all(feature = "force-dabao", feature = "alt-boot1"))]
{
while one_way.get_decoded::<bao1x_api::BoardTypeCoding>().expect("owc coding error")
!= bao1x_api::BoardTypeCoding::Dabao
{
one_way.inc_coded::<bao1x_api::BoardTypeCoding>().expect("increment error");
}
board_type = one_way.get_decoded::<bao1x_api::BoardTypeCoding>().expect("owc coding error");
crate::println!("Re-configured board type: {:?}", board_type);
}
}
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);