diff --git a/CHANGELOG.md b/CHANGELOG.md index e04c9c97..c39a9ae7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/asm.s b/asm.s index 37dedbd6..58ed2741 100644 --- a/asm.s +++ b/asm.s @@ -1,3 +1,5 @@ + .cfi_sections .debug_frame + # LLD requires that the section flags are explicitly set here .section .HardFaultTrampoline, "ax" .global HardFaultTrampoline @@ -5,6 +7,7 @@ # 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 @@ -17,6 +20,8 @@ HardFaultTrampoline: 0: mrs r0, PSP b HardFault + .cfi_endproc + .size HardFaultTrampoline, . - HardFaultTrampoline .section .text.FpuTrampoline, "ax" .global FpuTrampoline @@ -24,6 +29,7 @@ HardFaultTrampoline: # 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. @@ -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 @@ -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