Moved rust panic handler into it's own crate.

This commit is contained in:
Filipe Rodrigues 2024-09-27 19:47:23 +01:00
parent 761b4a3a6a
commit 88bbdca460
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU
20 changed files with 51 additions and 17 deletions

13
rust/Cargo.lock generated
View File

@ -9,6 +9,7 @@ dependencies = [
"dw2003_exe_data",
"dw2003_exe_digimon_profiles",
"dw2003_exe_lba",
"panic_handler",
"util",
]
@ -16,6 +17,7 @@ dependencies = [
name = "dw2003_exe_data"
version = "0.1.0"
dependencies = [
"panic_handler",
"util",
]
@ -23,6 +25,7 @@ dependencies = [
name = "dw2003_exe_digimon_profiles"
version = "0.1.0"
dependencies = [
"panic_handler",
"util",
]
@ -30,6 +33,7 @@ dependencies = [
name = "dw2003_exe_lba"
version = "0.1.0"
dependencies = [
"panic_handler",
"util",
]
@ -37,6 +41,7 @@ dependencies = [
name = "dw2003_pro_fieldstg"
version = "0.1.0"
dependencies = [
"panic_handler",
"types",
"util",
]
@ -45,6 +50,7 @@ dependencies = [
name = "dw2003_pro_sdigiedt"
version = "0.1.0"
dependencies = [
"panic_handler",
"types",
"util",
]
@ -53,6 +59,7 @@ dependencies = [
name = "dw2003_pro_stfgtrep"
version = "0.1.0"
dependencies = [
"panic_handler",
"types",
"util",
]
@ -61,6 +68,7 @@ dependencies = [
name = "dw2003_pro_stgtrain"
version = "0.1.0"
dependencies = [
"panic_handler",
"util",
]
@ -68,10 +76,15 @@ dependencies = [
name = "dw2003_pro_stitshop"
version = "0.1.0"
dependencies = [
"panic_handler",
"types",
"util",
]
[[package]]
name = "panic_handler"
version = "0.1.0"
[[package]]
name = "types"
version = "0.1.0"

View File

@ -19,6 +19,7 @@ members = [
# Utilities
"types",
"util",
"panic_handler",
]
[workspace.dependencies]
@ -35,3 +36,4 @@ dw2003_pro_fieldstg = { path = "dw2003_pro_fieldstg" }
dw2003_pro_stitshop = { path = "dw2003_pro_stitshop" }
types = { path = "types" }
util = { path = "util" }
panic_handler = { path = "panic_handler" }

View File

@ -11,4 +11,5 @@ crate-type = ["staticlib"]
dw2003_exe_data = { workspace = true }
dw2003_exe_digimon_profiles = { workspace = true }
dw2003_exe_lba = { workspace = true }
panic_handler = { workspace = true }
util = { workspace = true }

View File

@ -4,4 +4,4 @@
#![no_std]
// Export
pub use {dw2003_exe_data, dw2003_exe_digimon_profiles, dw2003_exe_lba, util::panic_handler};
pub use {dw2003_exe_data, dw2003_exe_digimon_profiles, dw2003_exe_lba, panic_handler};

View File

@ -5,4 +5,5 @@ version = "0.1.0"
[dependencies]
panic_handler = { workspace = true }
util = { workspace = true }

View File

@ -6,3 +6,4 @@ version = "0.1.0"
[dependencies]
util = { workspace = true }
panic_handler = { workspace = true }

View File

@ -5,4 +5,5 @@ version = "0.1.0"
[dependencies]
panic_handler = { workspace = true }
util = { workspace = true }

View File

@ -8,5 +8,6 @@ crate-type = ["staticlib"]
[dependencies]
panic_handler = { workspace = true }
types = { workspace = true }
util = { workspace = true }

View File

@ -10,4 +10,4 @@
pub mod data;
// Export
pub use util::panic_handler;
pub use panic_handler;

View File

@ -8,5 +8,6 @@ crate-type = ["staticlib"]
[dependencies]
panic_handler = { workspace = true }
types = { workspace = true }
util = { workspace = true }

View File

@ -10,4 +10,4 @@
pub mod data;
// Export
pub use util::panic_handler;
pub use panic_handler;

View File

@ -8,5 +8,6 @@ crate-type = ["staticlib"]
[dependencies]
panic_handler = { workspace = true }
types = { workspace = true }
util = { workspace = true }

View File

@ -10,4 +10,4 @@
pub mod data;
// Export
pub use util::panic_handler;
pub use panic_handler;

View File

@ -8,4 +8,5 @@ crate-type = ["staticlib"]
[dependencies]
panic_handler = { workspace = true }
util = { workspace = true }

View File

@ -10,4 +10,4 @@
pub mod data;
// Export
pub use util::panic_handler;
pub use panic_handler;

View File

@ -8,5 +8,6 @@ crate-type = ["staticlib"]
[dependencies]
panic_handler = { workspace = true }
types = { workspace = true }
util = { workspace = true }

View File

@ -10,4 +10,4 @@
pub mod data;
// Export
pub use util::panic_handler;
pub use panic_handler;

View File

@ -0,0 +1,6 @@
[package]
edition = "2021"
name = "panic_handler"
version = "0.1.0"
[dependencies]

View File

@ -0,0 +1,15 @@
//! Panic handler
// Features
#![no_std]
/// Dummy panic handler
// Note: This function will not make it to the final binary
// due to our linker script discarding it and being
// annotated with `inline(never)`
#[no_mangle]
#[panic_handler]
#[inline(never)]
pub fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
loop {}
}

View File

@ -17,14 +17,3 @@ pub macro decl_static($section:literal,
$vis static mut $NAME: $T = $value;
)*
}
// Dummy panic handler
// Note: This function will not make it to the final binary
// due to our linker script discarding it and being
// annotated with `inline(never)`
#[no_mangle]
#[panic_handler]
#[inline(never)]
pub fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
loop {}
}