Skip to content

Instantly share code, notes, and snippets.

@pftbest
Created January 8, 2020 00:13
Show Gist options
  • Save pftbest/b95c4caca72faebb55594a8b4e6f3f2b to your computer and use it in GitHub Desktop.
Save pftbest/b95c4caca72faebb55594a8b4e6f3f2b to your computer and use it in GitHub Desktop.

Revisions

  1. pftbest created this gist Jan 8, 2020.
    34 changes: 34 additions & 0 deletions ldscript.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    diff --git a/asm.s b/asm.s
    index 50a3fa5..fd7e500 100644
    --- a/asm.s
    +++ b/asm.s
    @@ -1,11 +1,11 @@
    # LLD requires that the section flags are explicitly set here
    - .section .HardFaultTrampoline, "ax"
    - .global HardFaultTrampoline
    + .section .HardFaultTrampolineAsm, "ax"
    + .global HardFaultTrampolineAsm
    # .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
    + .type HardFaultTrampolineAsm,%function
    .thumb_func
    -HardFaultTrampoline:
    +HardFaultTrampolineAsm:
    # depending on the stack mode in EXC_RETURN, fetch stack pointer from
    # PSP or MSP
    mov r0, lr
    diff --git a/link.x.in b/link.x.in
    index 30d4af1..9c649f7 100644
    --- a/link.x.in
    +++ b/link.x.in
    @@ -35,7 +35,8 @@ EXTERN(__EXCEPTIONS); /* depends on all the these PROVIDED symbols */
    EXTERN(DefaultHandler);

    PROVIDE(NonMaskableInt = DefaultHandler);
    -EXTERN(HardFaultTrampoline);
    +EXTERN(HardFaultTrampolineAsm);
    +PROVIDE(HardFaultTrampoline = HardFaultTrampolineAsm);
    PROVIDE(MemoryManagement = DefaultHandler);
    PROVIDE(BusFault = DefaultHandler);
    PROVIDE(UsageFault = DefaultHandler);