Skip to content

Commit 4cde2e7

Browse files
committed
add Armv5te default start routine
1 parent d7ae927 commit 4cde2e7

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository provides support for:
66
* Armv8-R AArch32 Processors, like the Arm Cortex-R52
77
* Armv7-A Processors, like the Arm Cortex-A5
88
* Armv8-A AArch32 Processors, like the Arm Cortex-A53 running in 32-bit mode
9+
* Partial support for Legacy Armv5TE Processors
910

1011
These libraries were originally written by Ferrous Systems, and are based on the
1112
[`cortex-m` libraries] from the [Rust Embedded Devices Working Group].

cortex-r-rt/src/lib.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,46 @@ core::arch::global_asm!(
935935
}
936936
);
937937

938+
// Start-up code for Armv5TE.
939+
//
940+
// Go straight to our default routine. No special floating-point handling is supported for now,
941+
// which is theoretically allowed by supporting a VFP co-processor.
942+
//
943+
// If this is required, the user has to define a custom _start method.
944+
#[cfg(arm_architecture = "v5te")]
945+
core::arch::global_asm!(
946+
r#"
947+
.section .text.default_start
948+
.global _default_start
949+
.type _default_start, %function
950+
_default_start:
951+
// Set up stacks.
952+
ldr r0, =_stack_top
953+
bl _stack_setup
954+
// Init .data and .bss
955+
bl _init_segments
956+
// Zero all registers before calling kmain
957+
mov r0, 0
958+
mov r1, 0
959+
mov r2, 0
960+
mov r3, 0
961+
mov r4, 0
962+
mov r5, 0
963+
mov r6, 0
964+
mov r7, 0
965+
mov r8, 0
966+
mov r9, 0
967+
mov r10, 0
968+
mov r11, 0
969+
mov r12, 0
970+
// Jump to application
971+
bl kmain
972+
// In case the application returns, loop forever
973+
b .
974+
.size _default_start, . - _default_start
975+
"#
976+
);
977+
938978
// Start-up code for Armv7-R.
939979
//
940980
// Go straight to our default routine

0 commit comments

Comments
 (0)