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

Commit

Permalink
Merge #295
Browse files Browse the repository at this point in the history
295: [backport] add CFI and size info to external assembly r=therealprof a=japaric

backport of #294

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
  • Loading branch information
bors[bot] and japaric authored Sep 7, 2020
2 parents 2907763 + b785bce commit 9e6ee34
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- (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`)

## [v0.6.12] - 2020-01-26

### Fixed
Expand Down
8 changes: 8 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,6 +20,8 @@ HardFaultTrampoline:
0:
mrs r0, PSP
b HardFault
.cfi_endproc
.size HardFaultTrampoline, . - HardFaultTrampoline

# 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 @@ -26,8 +31,11 @@ HardFaultTrampoline:
# 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
Binary file modified bin/thumbv6m-none-eabi.a
Binary file not shown.
Binary file modified bin/thumbv7em-none-eabi.a
Binary file not shown.
Binary file modified bin/thumbv7em-none-eabihf.a
Binary file not shown.
Binary file modified bin/thumbv7m-none-eabi.a
Binary file not shown.
Binary file modified bin/thumbv8m.base-none-eabi.a
Binary file not shown.
Binary file modified bin/thumbv8m.main-none-eabi.a
Binary file not shown.
Binary file modified bin/thumbv8m.main-none-eabihf.a
Binary file not shown.

0 comments on commit 9e6ee34

Please sign in to comment.