Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11071

TI proprietary assembler incorrectly rejects add instruction that refers to the PC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • Code Generation Tools
    • CODEGEN-10933
    • ARM_20.2.7.LTS
    • ARM_20.2.8.LTS*
    • default
    • Hide
      1.) Use "addw" instruction rather than "add"
      e.g. __asm(" addw r1, pc, #0x4");

      or 2.) Use PC-relative instruction "adr.w" instead of "add"
      e.g.: __asm(" adr.w r1, #0x4");
      Show
      1.) Use "addw" instruction rather than "add" e.g. __asm(" addw r1, pc, #0x4"); or 2.) Use PC-relative instruction "adr.w" instead of "add" e.g.: __asm(" adr.w r1, #0x4");

      The attached source file has these lines ...

      void test()
      {
          __asm("  add r1, pc, #0x4");
      }
      

      Build it ...

      % armcl -mv7r5 --code_state=16 file.c
      "C:\Users\name\AppData\Local\Temp\{949B409A-19B8-45F4-B34A-0521581E1A71}", ERROR!   at line 47:
       [E0004]
               Specifying R15 as an operand is illegal
                add r1, pc, #0x4
      
      1 Assembly Error, No Assembly Warnings
      
      Errors in Source - Assembler Aborted
      
      >> Compilation failure
      

      Use of --code_state=16 (Thumb mode) is required for the problem to occur.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: