This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Linker issues on ARMv6-M

Hello team,

I am working on NXP's S32K116 micro (Core - M0+). CPU for this is ARMv6-M. Also I am using IAR compiler. 
I am having linker issues when I try to call functions from interrupt handlers defined in the Startup_S32K116.s file

Below are some of the handlers where I am calling functions:

EXTERN vPortSVCHandler
EXTERN xPortPendSVHandler
EXTERN xPortSysTickHandler
EXTERN UnusedIntVctrIRQHandler

PUBWEAK SVC_Handler
SECTION .text:CODE:REORDER:NOROOT(1)
SVC_Handler
B vPortSVCHandler

PUBWEAK PendSV_Handler
SECTION .text:CODE:REORDER:NOROOT(1)
PendSV_Handler
B xPortPendSVHandler

PUBWEAK SysTick_Handler
SECTION .text:CODE:REORDER:NOROOT(1)
SysTick_Handler
B xPortSysTickHandler

PUBWEAK DefaultISR
SECTION .text:CODE:REORDER:NOROOT(1)
DefaultISR
B UnusedIntVctrIRQHandler


But I am getting following linker error when I compile the software. Actually it is reporting same issues with all the functions above with different values.

Error[Lp002]: relocation failed: value out of range or illegal: 0x707e
Kind : R_ARM_THM_JUMP11[0x66]
Location: 0x2e12
Module: C:\Workspace\GM\PWS\Git_Sandboxes\T6906-86_Smart_FET_Dr
iver\40_implementation\10_Software_Dev\20_ProductionCode\Build\Startu
p\startup_S32K116.o
Section: 15 (.text)
Offset: 0x0
Target : 0x9e95
"UnusedIntVctrIRQHandler"
Module: C:\Workspace\GM\PWS\Git_Sandboxes\T6906-86_Smart_FET_Dr
iver\40_implementation\10_Software_Dev\20_ProductionCode\Build\Servic
es\MCUFaultHandler\UnusedIntVectorHandler.o
Section: 9 (.text)
Offset: 0x1

NOTE: The same function calls I have made from the startup file Interrupt handlers of Core M4 project startup file. CPU for this is ARMv7-M. There I did not see any Linker issues. Please suggest.

  • This is a Keil forum, IAR questions are not addressed here. Please go to IAR for support

  • ARMv6-M is the architecture, not the CPU. Your CPU is a Cortex-M0+, which uses the Thumb/Thumb2 instruction set. The Thumb instruction set uses fewer bits to encode instructions, which limits how far away the target of a branch can be. The error is telling you that the value needed for the branch doesn't fit into the instruction and your linker is unable to solve the problem on its own. One way to solve this is to put the address into register r0, then branch to the address in the register, like this:

       IMPORT  UnusedIntVctrIRQHandler
       LDR     r0, =UnusedIntVctrIRQHandler
       BX      r0