以下是链接器脚本的片段.
.data :
{
*(.data*)
}
> ram
. = ALIGN(4);
/* Set Stack after code & data */
_stack_start = .;
我如何访问rust(没有std库)中的_stack_start(堆栈的起始地址)?
#![no_std]
#![no_main]
#![allow(dead_code)]
#[no_mangle]
pub fn _start() {
// let sp: i32 = _stack_start; -> **This causes compilation error**
type FnPtr = fn() -> ();
let th: FnPtr = trap_handler;
unsafe {
asm!("csrw mtvec, {}" ,
in(reg) th);
}
loop {}
}