Skip to content

Commit ed2c6f0

Browse files
committed
Align usage example with other examples
1 parent da689e8 commit ed2c6f0

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

riscv-rt/src/lib.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -612,29 +612,14 @@
612612
//! ```rust,no_run
613613
//! core::arch::global_asm!(
614614
//! r#"
615-
//! .section .trap.start, "ax"
616-
//! .extern _pre_default_start_trap_ret
617-
//! .global _pre_default_start_trap
615+
//! .section .trap.start, "ax"
616+
//! .extern _pre_default_start_trap_ret
617+
//! .global _pre_default_start_trap
618618
//!
619-
//! // with the pre-default-start-trap feature enabled this code is executed before
620-
//! // the code in _default_start_trap
621619
//! _pre_default_start_trap:
622-
//! // move SP to some save place if it's pointing below the RAM
623-
//! // otherwise we won't be able to do anything reasonable
624-
//! // (since we don't have a useable stack otherwise)
625-
//! //
626-
//! // most probably we will just print something and halt in this case
627-
//! // we actually can't do anything else
628-
//! csrw mscratch, t0
629-
//! la t0, _dram_origin
630-
//! bge sp, t0, 1f
631-
//!
632-
//! // set SP to the start of the stack
633-
//! la sp, _stack_start
634-
//!
635-
//! 1:
636-
//! // remember to not clobber any registers, restore t0 from mscratch
637-
//! csrr t0, mscratch
620+
//!
621+
//! // your code goes here remember to not clobber any registers,
622+
//! // use mscratch to retain a single register if needed
638623
//!
639624
//! // jump back to continue with _default_start_trap
640625
//! j _pre_default_start_trap_ret

0 commit comments

Comments
 (0)