following is the snippet of linker script.
.data :
{
*(.data*)
}
> ram
. = ALIGN(4);
/* Set Stack after code & data */
_stack_start = .;
How can I access the _stack_start (start address for stack) in my rust (without std library) ?
#![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 {}
}