Hi,
I am using Linaro Toolchain on Sitara SDK, Ubuntu 12.04, 32 bit. I would like to write C code and the C calls some assembly function. For below simple code snippet, it generates strange behavor.
.align 4 //2 // Align the function code to a 4-byte (2^n) word boundary.
.arm // Use ARM instructions instead of Thumb.
// .globl _$0 // Make the function globally accessible.
// .no_dead_strip _$0 // Stop the optimizer from ignoring this function!
// .private_extern _$0
.globl _start
_start:
mov r0, #2 /* Put a 2 inside the register r0 */
bx lr /* Return from main */
extern int _start(void);
int main(void) {
printf("Hello World!\n");
_start();
printf("Hello Sitara World!\n");
return 0;
}
The above code prints "Hello World" continuously in the terminal. Even I comment out two asm lines: mov r0,#2 and bx lr
The only way to stop continuous "Hello World" is that I comment out _start in the main() function.
Could you tell me how to make C calls asm function?
Thanks,