Buddies,
I have a file like this: /*don't have main()
function*/
/* embedded system boot file */
void start(void)
{
asm ("ldr sp, =0x5000");
while (1)
{
foo();
/* do whatever I want */
}
}
foo(void)
{
....
}
I use these command lines to compile
arm-linux-gcc -Wall -O3 -nostdlib -e start -o boot.out
boot.c
arm-linux-objdump -d boot.out > boot.asm
The ASM output file is:
mov ip, sp
stmdb sp!, {fp, ip, lr, pc}
sub fp, ip, #4
mov sp, #20480 ; 0x5000
...
because I use -e start to tell compiler that the
function start() is the first function run after power
on, the compiler should not generate the first 3
instruction ahead of my inlined assembler code.
When boot up, the stack pointer may points to an
unavaliable area, if push some data to that area, it
will cause exception. So my inlined asm code should be
the first code, I don't need compiler to save
registers at this time. And the other functions should
save registers in the entry point.
I checked the gcc online manual from
www.gnu.org/manual, but I can't find how to get rid of
the first 3 instructions.
Anyone who has this experience, please give me help! I
have tried to work it out for 3 days without
succeeded!
Thanks,
Gavin
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.