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.

CCS/TM4C123GH6PM: Assembly Language Programming

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL,

Tool/software: Code Composer Studio

I am new to ARM Cortex M4 processor core and Code Composer Studio (CCS). I am following a book (ARM Microprocessor Systems: Cortex-M Architecture, Programming, and Interfacing, 1e by M. Tahir) for learning assembling language and have Tiva C Series LaunchPad Evaluation Kit (EK-TM4C123GXL). 

I have successfully installed and setup CCS using SPMU-352 document (Tiva C Series Development and Evaluation Kits for Code Composer Studio) available at TI online resources. The problem arises when I try to code myself in assembly language.

I am trying to following book's Example 4.1: (The first assembly program.). The complete assembly program for summing first five even integers is given below, which can be compiled and executed. This assembly program does not require ‘startup.s’ file. Code for this book example is given below.

   THUMB               ; Marks the THUMB mode of operation
StackSize  EQU  0x00000100 ; Define stack size of 256 byes

   AREA STACK, NOINIT, READWRITE, ALIGN=3
MyStackMem  SPACE StackSize

   AREA    RESET, READONLY
   EXPORT  __Vectors
__Vectors
   DCD MyStackMem + StackSize ; stack pointer for empty stack  
DCD Reset_Handler ; reset vector AREA MYCODE, CODE, READONLY ENTRY EXPORT Reset_Handler Reset_Handler MOV R0, #0 ; Initial value of sum MOV R1, #2 ; First even number MOV R2, #5 ; Counter for the loop iterations lbegin CBZ R2, lend ; Terminate loop if counter is zero
ADD R0, R1 ; Build the sum ADD R1, #2 ; Generate next even number SUB R2, #1 ; Decrement the counter B lbegin lend END

I created a new source file (.asm) in CCS and copy paste the above code. On Building the source file i get the following info. in Build Console:


**** Build of configuration Debug for project Example_4_1 ****

"C:\\ti\\ccs1010\\ccs\\utils\\bin\\gmake" -k -j 4 Example_4_1_TIF.obj -O

Building file: "../Example_4_1_TIF.asm"
Invoking: ARM Compiler
"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/Users/Shujat Ali/workspace_v10/Example_4_1" --include_path="C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/include" --define=ccs="ccs" --define=PART_TM4C123GH6PM -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="Example_4_1_TIF.d_raw" "../Example_4_1_TIF.asm"
12 Assembly Errors, No Assembly Warnings

>> Compilation failure
subdir_rules.mk:9: recipe for target 'Example_4_1_TIF.obj' failed
"../Example_4_1_TIF.asm", ERROR! at line 1: [E0002] Illegal mnemonic specified
THUMB ; Marks the THUMB mode of operation

"../Example_4_1_TIF.asm", ERROR! at line 2: [E0002] Illegal mnemonic specified
StackSize EQU 0x00000100 ; Define stack size of 256 byes

"../Example_4_1_TIF.asm", ERROR! at line 4: [E0002] Illegal mnemonic specified
AREA STACK, NOINIT, READWRITE, ALIGN=3

"../Example_4_1_TIF.asm", ERROR! at line 5: [E0002] Illegal mnemonic specified
MyStackMem SPACE StackSize

"../Example_4_1_TIF.asm", ERROR! at line 7: [E0002] Illegal mnemonic specified
AREA RESET, READONLY

"../Example_4_1_TIF.asm", ERROR! at line 8: [E0002] Illegal mnemonic specified
EXPORT __Vectors

"../Example_4_1_TIF.asm", ERROR! at line 10: [E0002] Illegal mnemonic specified
DCD MyStackMem + StackSize ; stack pointer for empty stack

"../Example_4_1_TIF.asm", ERROR! at line 11: [E0002] Illegal mnemonic specified
DCD Reset_Handler ; reset vector

"../Example_4_1_TIF.asm", ERROR! at line 12: [E0002] Illegal mnemonic specified
AREA MYCODE, CODE, READONLY

"../Example_4_1_TIF.asm", ERROR! at line 13: [E0002] Illegal mnemonic specified
ENTRY

"../Example_4_1_TIF.asm", ERROR! at line 14: [E0002] Illegal mnemonic specified
EXPORT Reset_Handler

"../Example_4_1_TIF.asm", ERROR! at line 27: [E0002] Illegal mnemonic specified
END


Errors in Source - Assembler Aborted
gmake: *** [Example_4_1_TIF.obj] Error 1

**** Build Finished ****

As you can see, I am getting "[E0002] Illegal mnemonic specified" error multiple times. Also some of the Assembly Language Mnemonics (DCD, AREA, ENTRY, EXPORT, SPACE, THUMB etc.) are not being highlighted (different typeface, color, style) as MOV, ADD, SUB, B did. 

Please help me to resolve the above issues. Thank you.

  • Hello,

    Regarding:

    Shujat Ali said:
    Also some of the Assembly Language Mnemonics (DCD, AREA, ENTRY, EXPORT, SPACE, THUMB etc.) are not being highlighted (different typeface, color, style) as MOV, ADD, SUB, B did. 

    Yes this is a known issue. There has been previous requests for this. It is in the queue to address but I can't offer any concrete timetable yet.

    Shujat Ali said:
    As you can see, I am getting "[E0002] Illegal mnemonic specified" error multiple times.

    I will bring this thread to the attention of the compiler experts.

    Thanks

    ki

  • I am not familiar with the book ...

    Shujat Ali said:
    ARM Microprocessor Systems: Cortex-M Architecture, Programming, and Interfacing, 1e by M. Tahir

    But I can tell it was not developed using the TI ARM toolchain that comes with CCS.  It was developed using some other toolchain.  I presume the book states which toolchain was used.  The easiest way forward would be to obtain that toolchain and build with it.  

    I suppose you could consider changing the code to work with the TI ARM toolchain.  But that is not something I recommend to a beginner.  

    If you think it is best to continue using the TI ARM toolchain, then please consider starting with TivaWare.  Among other things, it is developed to work with the TI ARM toolchain.

    Please let me know if these suggestions resolve the problem.

    Thanks and regards,

    -George