This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM-Q1: Complilation Error for asm Code after Switching to Thumb-2 Intruction Set

Part Number: TDA4VM-Q1

Hi,

I tried to optimize our project by setting compilation mode from ARM to THUMB-2. I updated the compilation option -- code_state from 32 to 16 and specified __ARM_ARCH_ISA_THUMB=2 to enable THUMB-2 mode.

And I noted that there are some .asm codes which is provided by Vector are actually causing compilation error shown as the below:

"../../output/build/obj/third-party/vector-microsar/Components/Os/Implementation/Os_Trap.asm", ERROR! at line 3435:
[E0004]
Specifying R15 as an operand is illegal
add r1, pc, #0x4 ; [KEEP 32-BIT INS]


Errors in Source - Assembler Aborted
make[1]: *** [../../../tools/application-build/MakeSupport/Global.Makefile.target.4.mk:1135: ../../output/build/obj/third-party/vector-microsar/Components/Os/Implementation/Os_Trap.o] Error 1
make: *** [../../../tools/application-build/MakeSupport/Global.Makefile.target.4.mk:435: rebuild] Error 2

And the corresponding source code is shown as below:

/* ECO_IGNORE_BLOCK_BEGIN */
__attribute__((noinline))
static void Os_Hal_SysCallTwoLevel(volatile uint32 TrapPacket, volatile uint32 RegBlock)
{
  asm("  add r1, pc, #0x4 \n"
      "  svc #0 \n"
      "  nop \n"
      "  nop  \n");
}
/* ECO_IGNORE_BLOCK_END */

It is working with ARM mode but failing with THUMB-2. I have asked Vector support and got the reply "The asm code should be compatible with Thumb-2 instruction set and the compilation error might be caused by the TI compiler". And I found another question Assembly Code Porting but still have no idea.

Is the above asm code not applied on THUMB-2 mode? Any idea about this?

By the way, the compiler base is ti-cgt-arm_20.2.4.LTS.

Thanks a lot.