Tool/software: TI C/C++ Compiler
I would like to understand the instructions of ARM Cortex M4 processor core. Hence, I decided to write assembly language program in CCS and execute it instruction by instruction. The code is copy pasted below.
.global main, var1
.ref arr
.thumb ; use thumb, UAL syntax
.text
; set memory location to flash
main:
b Ldr_ex
Mov_ex:
mov R0, #23h
movs R1, R0 ; APSR (Z flag) affected due to s suffix
mov R0, #0
mrs R1, apsr ; read apsr
movs R2, #0
;mov r4, #1234
movw R6, #1234h ;way to load 32 bit value in a register
movt R6, #8765h
mvn R2, R1
vmov S0, r7 ; Floating point instructions Project propoerties
; Compiler optons->processor option-> FP support
;ldr r0, var1 ; Observe the encoding of this instruction
movw R0, #0
movt R0, #2000h
ldr R1, [R0]
movt R1, #00 ; Enable FPU: 0f0h, Disable FPU: 00h
str R1, [R0]
vmov S0, R1
vmov.f32 S1, #1.0
here_m:
b here_m
Ldr_ex:
;ldr r0, var1 ; Load address of label cpacr in R0
movw r0, #0
movt r0, #2000h
ldr R1,[R0, #04h] ; Immediate offset
ldr R2,[R0, #08h]! ; Immediate offset with writeback
;adr r0, var1 ; Restore R0
movw r0, #0
movt r0, #2000h
vldr.32 s3, [r0, #0ch] ; Loading floating point register
mov r2, #01
ldr r3, [r0, r2] ; register Offset
str r0, [r0, r2, LSL #3] ;scaled register offset
ldr r4, [r0], #04 ;post-index addressing mode
movw r0, #0 ; load and store multiple
movt r0, #2000h
ldmia r0, {r1-r4}
movw r0, #20h
movt r0, #2000h
stmdb r0!, {r1-r4}
vldmia.64 r0, {D0-D1}
movw r1, 8000h
movt r1, 2000h
msr msp, r1
here_l:
b here_l
.data
Var1:
.word 0E000ED88h, 01h, 02h, 03h, 04h, 05h, 06h, 07h
;put your variables here
.end
I am facing problems as given below:
1) I am unable to access labels defined in data section from code section. Compiler gives error as label not defined in current section
2) As the assembly code length got increased, compiler is giving following error message, highlighted in boldface letters. The statement at line no. 72 is '.end'
**** Build of configuration Debug for project inst ****
/home/coe/ti/ccs910/ccs/utils/bin/gmake -k -j 4 all -O
Building file: "../main.asm"
Invoking: ARM Compiler
"/home/coe/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.3.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="/home/coe/workspace_v8/inst" --include_path="/home/coe/ti/ccs910/ccs/tools/compiler/ti-cgt-arm_18.12.3.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="main.d_raw" "../main.asm"
>> Compilation failure
subdir_rules.mk:7: recipe for target 'main.obj' failed
"../main.asm", INTERNAL ERROR! at line 72: failed to locate symbol for relocation entry at offset 0x00000080 in section ".text"
(null)
This may be a serious problem. Please contact customer support with a
description of the problem and a sample of the sourcefile that caused this
message to appear.
gmake: *** [main.obj] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****
Reuested to look into the above mentioned list of problems and resolve.