Open joekerrXie opened 1 year ago
Assuming it runs bare metal:
You have to declare your function "foo" in a c file and then compile the assembly file and the c file separately. You need your own linker script as well
Here is a good explanation (you just need to follow the upper part of the answer not all)
i want to build a asm code can call C function . but return some error , how can i assemble the C code in asm code ?
`.text .global _start .global foo
_start: la sp, stack_end li a0 ,1 li a1 ,2 call foo
stop: j stop nop
stack_start: .rept 10 .word 0 .endr stack_end: .end` ERROR: column 9: "foo" declared global label but not defined.