macros and improvements

This commit is contained in:
2025-11-04 14:49:47 -07:00
parent dd26e3528b
commit 97639138a1
11 changed files with 87 additions and 70 deletions

View File

@@ -4,8 +4,9 @@ version = "0.1.0"
edition = "2024"
[dependencies]
embedded-sdmmc = { version = "0.9.0", default-features = false }
embedded-graphics = "0.8.1"
abi_sys = { path = "../abi_sys" }
main_proc_macro = { path = "../main_proc_macro" }
embedded-sdmmc = { version = "0.9", default-features = false }
embedded-graphics = "0.8.1"
once_cell = { version = "1", default-features = false }
rand_core = "0.9.3"

View File

@@ -5,10 +5,20 @@ extern crate alloc;
pub use abi_sys::{self, keyboard};
use abi_sys::{RngRequest, alloc, dealloc, keyboard::KeyEvent};
pub use alloc::format;
use core::alloc::{GlobalAlloc, Layout};
use alloc::format;
use core::{
alloc::{GlobalAlloc, Layout},
panic::PanicInfo,
};
pub use main_proc_macro::main;
use rand_core::RngCore;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location(),);
loop {}
}
#[global_allocator]
static ALLOC: Alloc = Alloc;
@@ -27,7 +37,7 @@ unsafe impl GlobalAlloc for Alloc {
#[macro_export]
macro_rules! print {
($($arg:tt)*) => {{
let s = $crate::format!($($arg)*);
let s = format!($($arg)*);
$crate::abi_sys::print(s.as_ptr(), s.len());
}};
}