RPi4: Make chainloader more robust.

Sometimes, the RPi4 would not send a correct "OK" sequence of characters when
using `print!()`. Two separate `write_char()` calls seem to improve this
situation.

Not yet sure what the exact reason is, though.
pull/41/head
Andre Richter 5 years ago
parent c64dd1197a
commit d410529fa7
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -298,7 +298,7 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs
mod runtime_init;
// Conditionally includes the selected `BSP` code.
@@ -65,25 +69,48 @@
@@ -65,25 +69,49 @@
fn kernel_main() -> ! {
use interface::console::All;
@ -338,7 +338,8 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs
+ size |= u32::from(bsp::console().read_char() as u8) << 24;
+
+ // Trust it's not too big.
+ print!("OK");
+ bsp::console().write_char('O');
+ bsp::console().write_char('K');
+
+ let kernel_addr: *mut u8 = bsp::BOARD_DEFAULT_LOAD_ADDRESS as *mut u8;
+ unsafe {

Binary file not shown.

Binary file not shown.

@ -95,7 +95,8 @@ fn kernel_main() -> ! {
size |= u32::from(bsp::console().read_char() as u8) << 24;
// Trust it's not too big.
print!("OK");
bsp::console().write_char('O');
bsp::console().write_char('K');
let kernel_addr: *mut u8 = bsp::BOARD_DEFAULT_LOAD_ADDRESS as *mut u8;
unsafe {

@ -348,7 +348,7 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
mod runtime_init;
// Conditionally includes the selected `BSP` code.
@@ -67,50 +63,25 @@
@@ -67,51 +63,25 @@
/// The main function running after the early init.
fn kernel_main() -> ! {
@ -382,7 +382,8 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
- size |= u32::from(bsp::console().read_char() as u8) << 24;
-
- // Trust it's not too big.
- print!("OK");
- bsp::console().write_char('O');
- bsp::console().write_char('K');
-
- let kernel_addr: *mut u8 = bsp::BOARD_DEFAULT_LOAD_ADDRESS as *mut u8;
- unsafe {

Loading…
Cancel
Save