I am trying to do some bare-metal programming in ARM with GCC and testing on QEMU. Whenever I call into an ARM label from C, my program hangs. I have a simple example of code
In order to call an ARM mode function defined in assembly from a THUMB mode function defined in C, you need to define a symbol in assembly as a function, and the tools (Linaro gcc) will produce a blx
instruction instead of bl
.
Example:
@ Here, we suppose that this part of code is inside of .code 32
.type fn, %function
fn:
mov pc, lr