forked from rsta2/circle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qemu.txt
86 lines (59 loc) · 2.99 KB
/
qemu.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
QEMU
Circle applications can run inside the QEMU processor emulator in 32- and 64-bit
mode. Not all Raspberry Pi hardware devices are supported by QEMU, so there may
be restrictions, but a number of Circle samples will run. In the past there was
no USB and networking support for the Raspberry Pi in the official QEMU, but the
current v6.0.0 provides USB and TCP/IP networking support now. For running
Circle applications with USB in QEMU, there is still a patch needed, which is
provided in this repository:
https://github.com/smuehlst/qemu
To get and build the QEMU source code for Circle enter the following commands:
git clone https://github.com/smuehlst/qemu.git
cd qemu
git submodule update --init --recursive
mkdir build
cd build
../configure --target-list=arm-softmmu,aarch64-softmmu
make
There is an option --qemu supported by the Circle configure tool, which should
be applied, when building Circle programs to run in QEMU.
When you have build a Circle sample (e.g. sample/17-fractal) for the Raspberry
Pi 3 (AArch64), you can run it in QEMU as follows:
./qemu-system-aarch64 -M raspi3b -kernel /path_to_circle/sample/17-fractal/kernel8.img
Please note, that in 32-bit mode the option -bios is used instead of -kernel to
specify the kernel image! This has been successfully tested with the Raspberry
Pi Zero emulation only:
./qemu-system-arm -M raspi0 -bios kernel.img
These options enable specific features of QEMU:
-global bcm2835-fb.xres=1024 -global bcm2835-fb.yres=768 (set screen resolution)
-serial stdio (write serial output to stdout)
-d guest_errors,unimp (write unimplemented feature calls to stdout)
-drive file=filename,if=sd,format=raw
(enable SD card access to the disk image filename)
-device usb-kbd (enable USB keyboard support)
-device usb-mouse (enable USB mouse support, but mouse cursor not working)
-semihosting (enable semihosting support)
With the last option the possibility to automatically exit QEMU, requested by a
Circle program, is enabled. This requires the system option LEAVE_QEMU_ON_HALT to
be defined in include/circle/sysconfig.h. Furthermore with this option a Circle
program can access files in the file system of the host system. This may cause
security issues, so be careful!
NETWORKING
Setting up QEMU for networking may be not that easy. The following configuration
has been tested:
With sample/21-webserver:
qemu-system-aarch64 -M raspi3b -kernel kernel8.img \
-netdev user,id=net0,hostfwd=tcp::8080-:80 -device usb-net,netdev=net0
Open http://localhost:8080 in your web browser on your host system! Port 8080 on
the host will be forwarded to port 80 on the guest system.
DEBUG
Circle applications running in QEMU can be debugged using the GNU debugger (GDB)
with ARM support. You have to add the options -s (enable GDB support) and -S
(wait for GDB connect) to the QEMU command line to do this. Inside GDB use the
following commands:
file kernel8.elf
target remote :1234
cont
LINKS
Have a look at these URLs for further information:
* https://www.qemu.org/