01_wait_forever: support riscv64
parent
62e1ce7bd4
commit
dfcabbaf2a
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
//
|
||||
// Copyright (c) 2020 Ken Kawamoto <kentaro.kawamoto@gmail.com>
|
||||
|
||||
.section ".text._start"
|
||||
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
1: wfi // Wait for interrupt
|
||||
j 1b // In case an event happened, jump back to 1
|
@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
//
|
||||
// Copyright (c) 2020 Ken Kawamoto <kentaro.kawamoto@gmail.com>
|
||||
|
||||
//! Architectural processor code.
|
||||
|
||||
// Assembly counterpart to this file.
|
||||
global_asm!(include_str!("cpu.S"));
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Public Code
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
/// Pause execution on the core.
|
||||
#[inline(always)]
|
||||
pub fn wait_forever() -> ! {
|
||||
unsafe {
|
||||
loop {
|
||||
llvm_asm!("wfi"
|
||||
: // outputs
|
||||
: // inputs
|
||||
: // clobbers
|
||||
: "volatile") // options
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
//
|
||||
// Copyright (c) 2020 Ken Kawamoto <kentaro.kawamoto@gmail.com>
|
||||
|
||||
//! Top-level BSP file for the HiFive1.
|
||||
|
||||
// Coming soon.
|
@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2020 Ken Kawamoto <kentaro.kawamoto@gmail.com>
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH("riscv")
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Set current address to the value from which the HiFive1 starts execution */
|
||||
. = 0x80000000;
|
||||
|
||||
.text :
|
||||
{
|
||||
*(.text._start) *(.text*)
|
||||
}
|
||||
|
||||
/DISCARD/ : { *(.comment*) }
|
||||
}
|
Loading…
Reference in New Issue