Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

add CFI and size info #294

Merged
merged 2 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Various fixes to the linker script ([#265], [#286]).
- Use the correct ABI for the `main` symbol ([#278]).
- Add barriers after FPU enabling ([#279]).
- (ARMv6-M) Set LR value to a known value on reset (as the ARM spec requires)
- Added CFI and size info to external assembly subroutines (`HardFaultTrampoline` and `FpuTrampoline`)

[#265]: https://github.com/rust-embedded/cortex-m-rt/pull/265
[#278]: https://github.com/rust-embedded/cortex-m-rt/pull/278
Expand Down
11 changes: 11 additions & 0 deletions asm.s
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.cfi_sections .debug_frame

# LLD requires that the section flags are explicitly set here
.section .HardFaultTrampoline, "ax"
.global HardFaultTrampoline
# .type and .thumb_func are both required; otherwise its Thumb bit does not
# get set and an invalid vector table is generated
.type HardFaultTrampoline,%function
.thumb_func
.cfi_startproc
HardFaultTrampoline:
# depending on the stack mode in EXC_RETURN, fetch stack pointer from
# PSP or MSP
Expand All @@ -17,13 +20,16 @@ HardFaultTrampoline:
0:
mrs r0, PSP
b HardFault
.cfi_endproc
.size HardFaultTrampoline, . - HardFaultTrampoline

.section .text.FpuTrampoline, "ax"
.global FpuTrampoline
# .type and .thumb_func are both required; otherwise its Thumb bit does not
# get set and an invalid vector table is generated
.type FpuTrampoline,%function
.thumb_func
.cfi_startproc
# This enables the FPU and jumps to the main function.
FpuTrampoline:
# Address of SCB.CPACR.
Expand All @@ -40,6 +46,8 @@ FpuTrampoline:
# Hand execution over to `main`.
bl main
# Note: `main` must not return. `bl` is used only because it has a wider range than `b`.
.cfi_endproc
.size FpuTrampoline, . - FpuTrampoline

# ARMv6-M leaves LR in an unknown state on Reset
# this trampoline sets LR before it's pushed onto the stack by Reset
Expand All @@ -49,8 +57,11 @@ FpuTrampoline:
# get set and an invalid vector table is generated
.type PreResetTrampoline,%function
.thumb_func
.cfi_startproc
PreResetTrampoline:
# set LR to the initial value used by the ARMv7-M (0xFFFF_FFFF)
ldr r0,=0xffffffff
mov lr,r0
b Reset
.cfi_endproc
.size PreResetTrampoline, . - PreResetTrampoline