I am reading the book for learning ARM and ARM assembly.. examples in book is based on armcc compiler but I am using arm-none-eabi-gcc. so how can change this peace of code to gnu assembler??
IMPORT |Lib$$Request$$armlib|,WEAK.
whole example is :
AREA |.text|, CODE , READONLY
EXPORT main
IMPORT |Lib$$Request$$armlib|,WEAK
IMPORT __main ;C library entry
IMPORT printf ; prints to stdout
i RN 4
;int main(void)
main
STMFD sp!,{i,lr}
MOV i,#0
loop
ADR r0, print_string
MOV r1,i
MUL r2,i,i
BL printf
ADD i,i,#1
CMP i,#10
BLT loop
LDMFD sp!,{i,pc}
print_string
DCB "Square of %d is %d\n",0
END
so I converted it to
.section .text
.weak Lib$$Request$$armlib
.global main
i .req r4
main:
STMFD sp!,{i,lr}
MOV i,#0
loop:
ADR r0,print_string
MOV r1,i
MUL r2,i,i
BL printf
ADD i,i,#1
CMP i,#10
BLT loop
LDMFD sp!,{i,pc}
print_string:
.ascii "Square of %d is %d\n"
.end
I am using ARMSim for simulating ... but I get some error:
Undefined symbol printf address is not in text section so how can include "stdio.h" for using printf or what is wrong generally??