https://github.com/dwelch67/qemu_arm_samples
准备工作:
sudo apt install qemu-system-arm gcc-arm-linux-gnueabi -y
进入目录执行make, 生成 notmain.bin
用qemu虚拟机运行:
qemu-system-arm -M versatilepb -m 128M -nographic -kernel notmain.bin
ctrl + a 然后按 x 退出虚拟机。
离线
thumb 与 arm 状态切换 demo:
https://github.com/dwelch67/qemu_arm_samples/tree/master/thumb01
https://github.com/dwelch67/qemu_arm_samples/blob/master/thumb01/notmain.c
https://github.com/dwelch67/qemu_arm_samples/blob/master/thumb01/strap.s
https://github.com/dwelch67/qemu_arm_samples/blob/master/thumb01/memmap
https://github.com/dwelch67/qemu_arm_samples/blob/master/thumb01/Makefile
离线
写了一个最简单的串口程序, 照uart01改的, 就三五行汇编代码 strap.s
_reset:
ldr r0, =0x101f1000 //UART0发送寄存器地址
ldr r1, =0x31 //输出1
str r1, [r0]
_loop:
b _loop
notmain.c 是空文件,
用 make 命令编译, 运行:
$ qemu-system-arm -M versatilepb -m 128M -nographic -kernel notmain.bin
1
完全 OK
离线