[fpc-pascal] inline asm in fpc progran
Nataraj S Narayan
natarajsn at gmail.com
Fri Aug 20 09:41:38 CEST 2010
Hi
May I have some help in this code ? I am on arm-linux-uclibc. Compiling
using :-
# ppcrossarm -MObjFPC -TLinux -Parmv5 -gl -Xd -Xs -l -darm
-XParm-unknown-linux-uclibcgnueabi- -CfSOFT -CaEABI -darm -gl -O- -CpARMV5
-uUSE_LOCALIZE -Fu/usr/local/lib/fpc/2.5.1/units/arm-linux/*
-Fl$/usr/staging/usr/arm-unknown-linux-uclibcgnueabi/lib
-FL/usr/staging/lib/ld-uClibc.so.0 -XR/usr/staging -Fl/usr/staging/lib
-Fl/usr/staging/usr/lib -k"--sysroot=/usr/staging"
-k"-rpath-link=/usr/staging/usr/arm-unknown-linux-uclibcgnueabi/lib/"
main1.pas
Program main;
function fact(x : integer):integer;assembler;
label
loop;
asm
.text
.align 2
mov r1,r0
mov r2,#1
loop:
mul r3,r2,r1
mov r2,r3
subs r1,r1,#1
cmp r1,#0
bgt loop
MOV r0,r2
MOV pc,lr
end;
var
i:integer;
begin
for i:=1 to 10 do
writeln('factorial',i,fact(i));
end.
This compiles and links. But wont execute on Arm target (at91sam9263ek).
Just waits endless. The equivalent C code linked to the external assembled
code works well.
regards
Nataraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100820/17dbf63c/attachment.html>
More information about the fpc-pascal
mailing list