First you need to specify the toolchain (gcc?) Command so that you don’t include anything more than your code. Something like -nostartfiles -nodefaultlibsto is needed gcc.
Linux, , os, _start. :
void _start() __attribute__ ((naked));
void _start() {
main();
asm volatile(
"mov r7, #1\n"
"svc #0\n"
);
}
main, , .
int main() {
linuxc('X');
return 42;
}
syscall...
void linuxc(int c) {
asm volatile(
"mov r0, #1\n"
"mov r1, %[buf]\n"
"mov r2, #1\n"
"mov r7, #4\n"
"svc #0\n"
: : [buf] "r" (&c) : "r0", "r1", "r2", "r7", "memory"
);
}
my github. teensy.