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 vPortSVCHandlerEXTERN xPortPendSVHandlerEXTERN xPortSysTickHandlerEXTERN UnusedIntVctrIRQHandler
PUBWEAK SVC_HandlerSECTION .text:CODE:REORDER:NOROOT(1)SVC_HandlerB vPortSVCHandler
PUBWEAK PendSV_HandlerSECTION .text:CODE:REORDER:NOROOT(1)PendSV_HandlerB xPortPendSVHandler
PUBWEAK SysTick_HandlerSECTION .text:CODE:REORDER:NOROOT(1)SysTick_HandlerB xPortSysTickHandler
PUBWEAK DefaultISRSECTION .text:CODE:REORDER:NOROOT(1)DefaultISRB 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: 0x707eKind : R_ARM_THM_JUMP11[0x66]Location: 0x2e12Module: C:\Workspace\GM\PWS\Git_Sandboxes\T6906-86_Smart_FET_Driver\40_implementation\10_Software_Dev\20_ProductionCode\Build\Startup\startup_S32K116.oSection: 15 (.text)Offset: 0x0Target : 0x9e95"UnusedIntVctrIRQHandler"Module: C:\Workspace\GM\PWS\Git_Sandboxes\T6906-86_Smart_FET_Driver\40_implementation\10_Software_Dev\20_ProductionCode\Build\Services\MCUFaultHandler\UnusedIntVectorHandler.oSection: 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.
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