1 | The 'qemuprep'/'qemuprep-altivec' BSPs are variants of |
---|
2 | 'motorola_powerpc' that can run under QEMU. They are *not* |
---|
3 | binary compatible with other variants of 'motorola_powerpc' |
---|
4 | (nor with each other). |
---|
5 | |
---|
6 | Most significant differences to real hardware: |
---|
7 | - no OpenPIC, just a 8259 PIC (even though qemu implements an openpic |
---|
8 | at least to some extent it is not configured into the prep platform |
---|
9 | as of qemu-0.14.1). |
---|
10 | - no VME (absense of the VME controller is detected by the BSP) |
---|
11 | - the only network chip supported by both, qemu and vanilla RTEMS |
---|
12 | is the ISA NE2000 controller. Note that the default interrupt line |
---|
13 | settings used by RTEMS and QEMU differ: RTEMS uses 5 and QEMU 9. |
---|
14 | This can be addressed by passing a RTEMS commandline option |
---|
15 | --ne2k-irq=9. |
---|
16 | Other controllers (i8559, e1000, pcnet) implemented by qemu can |
---|
17 | also be used but require unbundled RTEMS drivers (libbsdport). |
---|
18 | Note that the bundled 'if_fxp' has not been ported to PPC and works |
---|
19 | on x86 only. |
---|
20 | - unlike a real motorola board you can run qemu emulating a 7400 CPU |
---|
21 | which features altivec. I.e., you can use this BSP (altivec-enabled |
---|
22 | variant) to test altivec-enabled code. |
---|
23 | |
---|
24 | Compatibility: qemu had quite a few bugs related to the PREP platform. |
---|
25 | Version 0.12.4, for example, required patches. 0.14.1 seems to have |
---|
26 | fixed the show-stoppers. Hence, you *need* at least qemu-0.14.1 for |
---|
27 | this BSP; it should work without the need for patching QEMU. |
---|
28 | |
---|
29 | BIOS: qemu requires you to use a BIOS. The one that came with qemu |
---|
30 | 0.12.4 didn't work for me so I created a minimal dummy that provides |
---|
31 | enough functionality for the RTEMS bootloader to work. |
---|
32 | |
---|
33 | BSP Variants: |
---|
34 | You can compile the BSP for either a 604 CPU or a 7400 (altivec-enabled). |
---|
35 | Note that you cannot run the altivec-enabled BSP variant on a CPU w/o |
---|
36 | altivec/SIMD hardware. The non-altivec variant is called 'qemuprep' |
---|
37 | and the altivec-enabled one 'qemuprep-altivec'. Hence, you can |
---|
38 | configure RTEMS: |
---|
39 | |
---|
40 | 604/non-altivec variant only: |
---|
41 | configure --target=powerpc-rtems --enable-rtemsbsp=qemuprep |
---|
42 | 7400/altivec variant only: |
---|
43 | configure --target=powerpc-rtems --enable-rtemsbsp=qemuprep-altivec |
---|
44 | both variants: |
---|
45 | configure --target=powerpc-rtems --enable-rtemsbsp='qemuprep qemuprep-altivec' |
---|
46 | |
---|
47 | Building QEMU: |
---|
48 | In case you have no pre-built qemu-0.14.1 you can |
---|
49 | compile it yourself: |
---|
50 | |
---|
51 | cd qemu-0.14.1 |
---|
52 | configure --target-list=ppc-softmmu |
---|
53 | make |
---|
54 | |
---|
55 | Running QEMU: |
---|
56 | A number of command-line options are important (BTW: make sure |
---|
57 | you run the PPC/PREP emulator and not a natively installed i386/PC |
---|
58 | emulating 'qemu') |
---|
59 | |
---|
60 | -M prep --- select machine type: prep |
---|
61 | -cpu 604 --- select 604 CPU for non-altivec variant |
---|
62 | -cpu 7400 --- select 7400 CPU for altivec variant |
---|
63 | |
---|
64 | NOTE: the 7455 and 7457 emulations are buggy as of |
---|
65 | qemu-0.14.1 and they won't work. |
---|
66 | |
---|
67 | -bios <rtems-install-prefix>/powerpc-rtems/qemuprep/qemu_fakerom.bin |
---|
68 | -bios <rtems-install-prefix>/powerpc-rtems/qemuprep-altivec/qemu_fakerom.bin |
---|
69 | --- select proprietary dummy 'BIOS' |
---|
70 | |
---|
71 | -nographic --- redirect serial/IO to console where qemu is run |
---|
72 | |
---|
73 | -kernel <path> --- path to your RTEMS executable (.ralf file, e.g., 'hello.ralf') |
---|
74 | -no-reboot --- terminate after one run |
---|
75 | -append <arg> --- RTEMS kernel comand line (use e.g., to modify |
---|
76 | ne2000 driver interrupt line) |
---|
77 | |
---|
78 | Networking: |
---|
79 | (We assume your RTEMS application is correctly configured and |
---|
80 | built for networking using the ne2k adapter [other adapters |
---|
81 | can be used with unbundled/libbsdport drivers]) |
---|
82 | |
---|
83 | I use networking with a 'tap' interface on the host machine |
---|
84 | and can then communicate with the emulated target in any |
---|
85 | desired way. The Ethernet address specified in the RTEMS network interface |
---|
86 | configuration and the Qemu command line must match, otherwise uni-cast frames |
---|
87 | are not received. It is best to use a NULL pointer in the RTEMS network |
---|
88 | interface configuration for the Ethernet address, so that the default from Qemu |
---|
89 | is used. Make sure that your firewall settings allow communication between |
---|
90 | different Qemu instances and your host. |
---|
91 | |
---|
92 | On (linux) host: |
---|
93 | |
---|
94 | # create a 'permanent' tap device that can be used by myself |
---|
95 | # (as non-root user). |
---|
96 | sudo tunctl -u `id -u` |
---|
97 | # configure tap0 interface |
---|
98 | sudo ifconfig tap0 10.1.1.1 netmask 255.255.255.0 up |
---|
99 | # provide a suitable dhcpd config file (for the emulated |
---|
100 | # platform to boot: IP address etc. |
---|
101 | # |
---|
102 | # execute dhcp on host |
---|
103 | sudo dhcpd -d tap0 |
---|
104 | |
---|
105 | Start emulated prep platform: |
---|
106 | |
---|
107 | ppc-softmmu/qemu-system-ppc \ |
---|
108 | -M prep \ |
---|
109 | -cpu 7400 \ |
---|
110 | -bios <rtems-prefix>/powerpc-rtems/qemuprep-altivec/lib/qemu_fakerom.bin \ |
---|
111 | -kernel <my_path>/my_app.ralf \ |
---|
112 | -append --ne2k-irq=9 \ |
---|
113 | -nographic \ |
---|
114 | -no-reboot \ |
---|
115 | -net nic,model=ne2k_isa \ |
---|
116 | -net tap,vlan=0,ifname=tap0,script=no,downscript=no |
---|
117 | |
---|
118 | Again: if you use the non-altivec BSP variant, use -cpu 604 |
---|
119 | and if you use the altivec-enabled variant then you MUST use |
---|
120 | -cpu 7400. |
---|
121 | |
---|
122 | Have fun. |
---|
123 | |
---|
124 | Till Straumann, 2011/07/18 |
---|