diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/baremetal/mod.rs | 6 | ||||
| -rw-r--r-- | src/main.rs | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/baremetal/mod.rs b/src/baremetal/mod.rs new file mode 100644 index 000000000..c03b9538b --- /dev/null +++ b/src/baremetal/mod.rs | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | use core::panic::PanicInfo; | ||
| 2 | |||
| 3 | #[panic_handler] | ||
| 4 | fn panic(_info: &PanicInfo) -> ! { | ||
| 5 | loop {} | ||
| 6 | } | ||
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 000000000..7111536ff --- /dev/null +++ b/src/main.rs | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #![cfg_attr(target_os = "none", no_std)] | ||
| 2 | #![cfg_attr(target_os = "none", no_main)] | ||
| 3 | |||
| 4 | #[cfg(target_os = "none")] | ||
| 5 | mod baremetal; | ||
| 6 | |||
| 7 | #[cfg(not(target_os = "none"))] | ||
| 8 | fn main() { | ||
| 9 | println!("Hello, world!"); | ||
| 10 | } | ||
| 11 | |||
| 12 | #[cfg(test)] | ||
| 13 | mod tests { | ||
| 14 | #[test] | ||
| 15 | fn it_works() { | ||
| 16 | assert_eq!(2 + 2, 4); | ||
| 17 | } | ||
| 18 | } | ||
