aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-08-03 19:05:54 -0400
committerBrian Cully <bjc@kublai.com>2022-08-03 19:05:54 -0400
commitd04d8f629ccd1d80b1dae4f3588b397dcebd1bd4 (patch)
tree918b537b77af457c6d808ec7c2e1f6e0189d38dc /src/main.rs
parent5062ac0818f07bfe07714039c46018172a79ee76 (diff)
downloadluchie-d04d8f629ccd1d80b1dae4f3588b397dcebd1bd4.tar.gz
luchie-d04d8f629ccd1d80b1dae4f3588b397dcebd1bd4.zip
Get rid of nightly features by using ‘global_asm’.
Now compiles and runs on stable.
Diffstat (limited to 'src/main.rs')
-rwxr-xr-xsrc/main.rs28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/main.rs b/src/main.rs
index c0d41d3..8d95d00 100755
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,11 @@
-#![feature(naked_functions)]
-
#![no_std]
#![no_main]
-use core::arch::asm;
+use core::arch::global_asm;
use gd32vf103_pac::Peripherals;
+global_asm!(include_str!("boot.S"));
+
#[no_mangle]
fn main(_hartid: usize) -> ! {
// let peripherals = Peripherals::take().unwrap();
@@ -49,28 +49,6 @@ fn main(_hartid: usize) -> ! {
}
}
-#[naked]
-#[link_section = ".text.init"]
-#[export_name = "_start"]
-unsafe extern "C" fn _start() -> ! {
- // At boot, the hart is in privilege mode M, mstatus fields MIE
- // and MPRV are 0, the pc is set to a reset vector, the mcause
- // register specifies why the reset occurred.
- // c.f.: [^super::rism2] § 3.4 (Reset)
- asm!(
- ".option push",
- ".option norelax",
- "la gp, __global_pointer$",
- ".option pop",
-
- "csrr a0, mhartid",
- "la sp, _stack_top",
-
- "tail main",
- options(noreturn)
- )
-}
-
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
if let Some(loc) = info.location() {