35 | | = Board Setup = |
36 | | |
37 | | |
38 | | None |
39 | | = Downloading and Executing = |
40 | | |
41 | | |
42 | | = 1. Clone and build qemu-maemo: = |
43 | | |
44 | | |
45 | | $ git clone git://gitorious.org/qemu-maemo/qemu.git |
46 | | $ cd qemu |
47 | | $ ./configure --target-list="arm-softmmu" |
48 | | $ make |
49 | | |
50 | | [http://meego.gitorious.org/qemu-maemo] |
51 | | = 2. Clone and build rtems from my fork: = |
52 | | |
53 | | |
54 | | $ git clone git://github.com/claas/rtems.git |
55 | | |
56 | | (ben's fork contains a branch that is uptodate w.r.t rtems mainline, has working clock and timers, and has beaglebone support, but is in flux - https://github.com/bengras/rtems.git , beaglebone-wip branch) |
57 | | |
58 | | $ mkdir rtems-b |
59 | | $ cd rtems |
60 | | $ ./bootstrap |
61 | | $ cd ../rtems-b |
62 | | $ ../rtems/configure --target=arm-rtems4.11 --enable-rtemsbsp=beagle |
63 | | $ make |
64 | | $ make install |
65 | | |
66 | | (these instructions previously mentioned the now-obsolete arm-rtemseabi4.11 target: --target=arm-rtemseabi4.11. |
67 | | |
68 | | these instructions also previously mentioned to disable posix, networking, cxx, and enable rtems debug, and specify a prefix, but the default also builds.) |
69 | | = 3. Clone my tools repository: = |
70 | | |
71 | | |
72 | | $ git clone git://github.com/claas/tools.git |
73 | | |
74 | | find the test.c file in the cloned repository and copy it to the examples hello/hello_world_c folder |
75 | | = 5. Download the x-loader and uboot images = |
76 | | |
77 | | |
78 | | $ wget http://qemu-omap3.googlecode.com/files/image-v0.01.tar.bz2 |
79 | | = 6. Build the nand flash image = |
80 | | |
81 | | |
82 | | The original beagleboard has 256MB builtin flash NAND. We make a full image for that flash and feed it to the emulator to boot from. |
83 | | |
84 | | The script to do that is in the tools repo, the name is: build-nand.sh |
85 | | |
86 | | For this, you will also need: |
87 | | |
88 | | * bb_nandflash.sh and bb_nandflash_ecc from e.g. http://beagleboard.lohray.com/vm-larix/setting-up-an-emulator/qemu-emulation |
89 | | * uboot mkimage, from e.g. uboot-mkimage package (apt-get install uboot-mkimage on ubuntu) |
90 | | * some minor modifications to the build-nand.sh script, like setting the path to the tools and files properly |
91 | | |
92 | | Invocation: |
93 | | |
94 | | $ build-nand.sh <program> <nand flash output file> |
95 | | |
96 | | e.g. with my layout: |
97 | | |
98 | | $ sh tools/build-nand.sh rtems-b/arm-rtems4.11/c/beagle/testsuites/samples/hello/hello nand |
99 | | |
100 | | Then to invoke qemu: |
101 | | |
102 | | $ qemu-system-arm -M beagle -mtdblock nand -serial stdio |
103 | | |
104 | | Once you are in the boot prompt, load and run the program: |
105 | | |
106 | | OMAP3 beagleboard.org # nand read 0x80800000 0x280000 0x400000 |
107 | | |
108 | | NAND read: device 0 offset 0x280000, size 0x400000 |
109 | | 4194304 bytes read: OK |
110 | | OMAP3 beagleboard.org # bootm 0x80800000 |
111 | | ## Booting kernel from Legacy Image at 80800000 ... |
112 | | Image Name: RTEMS |
113 | | Image Type: ARM RTEMS Kernel Image (gzip compressed) |
114 | | Data Size: 56484 Bytes = 55.2 kB |
115 | | Load Address: 80000000 |
116 | | Entry Point: 80000000 |
117 | | Verifying Checksum ... OK |
118 | | Uncompressing Kernel Image ... OK |
119 | | ## Transferring control to RTEMS (at address 80000000) ... |
120 | | bsp_interrupt_facility_initializebeagle_set_exception_handler |
121 | | |
122 | | *** BEGIN OF TEST HELLO WORLD *** |
123 | | Hello World |
124 | | *** END OF TEST HELLO WORLD *** |
125 | | = Debugging = |
126 | | |
127 | | |
128 | | How do you debug code on this board? What gdb setup? BDM, stub, etc? |
129 | | = Beagleboard XM, Linaro qemu = |
130 | | |
131 | | |
132 | | Using a different emulator (fork), and running a different u-boot, emulating a beagleboard xm, this hello world also works on the bbxm. The bbxm has no internal NAND so booting is a bit different, the mmc card is needed. the image referenced contains a FAT partition that contains hello.img: |
133 | | |
134 | | $ qemu-system-arm -M beaglexm -drive if=sd,cache=writeback,file=rtems_arm_sd.img -clock unix -serial stdio |
135 | | |
136 | | booting then looks like: |
137 | | |
138 | | OMAP3 beagleboard.org # fatload mmc 0:1 0x80800000 hello.img |
139 | | reading hello.img |
140 | | 56548 bytes read in 12 ms (4.5 MiB/s) |
141 | | OMAP3 beagleboard.org # bootm 0x80800000 |
142 | | ## Booting kernel from Legacy Image at 80800000 ... |
143 | | Image Name: RTEMS |
144 | | Image Type: ARM RTEMS Kernel Image (gzip compressed) |
145 | | Data Size: 56484 Bytes = 55.2 KiB |
146 | | Load Address: 80000000 |
147 | | Entry Point: 80000000 |
148 | | Verifying Checksum ... OK |
149 | | Uncompressing Kernel Image ... OK |
150 | | ## Transferring control to RTEMS (at address 80000000) ... |
151 | | bsp_interrupt_facility_initializebeagle_set_exception_handler |
152 | | |
153 | | *** BEGIN OF TEST HELLO WORLD *** |
154 | | Hello World |
155 | | *** END OF TEST HELLO WORLD *** |
156 | | |
157 | | This means that bbxm support should not be too far off. |
158 | | |
159 | | = References = |
160 | | |
161 | | |
162 | | * TBD |
| 35 | |
| 36 | A blog post with full details of how to reproduce everything from this BSP on scratch and a few more things like a script for writing an SD card: |
| 37 | http://www.shrike-systems.com/beagleboard-xm-beaglebone-black-and-everything-else-rtems-on-the-beagles.html |