Skip to content

Commit 109a832

Browse files
bors[bot]japaric
andauthored
Merge #294
294: add CFI and size info r=jonas-schievink a=japaric like it was done in #216 and #212 Co-authored-by: Jorge Aparicio <[email protected]>
2 parents 43fdade + 3ee7dd9 commit 109a832

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cortex-m-rt/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Various fixes to the linker script ([#265], [#286]).
1313
- Use the correct ABI for the `main` symbol ([#278]).
1414
- Add barriers after FPU enabling ([#279]).
15+
- (ARMv6-M) Set LR value to a known value on reset (as the ARM spec requires)
16+
- Added CFI and size info to external assembly subroutines (`HardFaultTrampoline` and `FpuTrampoline`)
1517

1618
[#265]: https://github.com/rust-embedded/cortex-m-rt/pull/265
1719
[#278]: https://github.com/rust-embedded/cortex-m-rt/pull/278

cortex-m-rt/asm.s

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
.cfi_sections .debug_frame
2+
13
# LLD requires that the section flags are explicitly set here
24
.section .HardFaultTrampoline, "ax"
35
.global HardFaultTrampoline
46
# .type and .thumb_func are both required; otherwise its Thumb bit does not
57
# get set and an invalid vector table is generated
68
.type HardFaultTrampoline,%function
79
.thumb_func
10+
.cfi_startproc
811
HardFaultTrampoline:
912
# depending on the stack mode in EXC_RETURN, fetch stack pointer from
1013
# PSP or MSP
@@ -17,13 +20,16 @@ HardFaultTrampoline:
1720
0:
1821
mrs r0, PSP
1922
b HardFault
23+
.cfi_endproc
24+
.size HardFaultTrampoline, . - HardFaultTrampoline
2025

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

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

0 commit comments

Comments
 (0)