2 uClinux/ColdFire -- HOWTO
3 -------------------------
5 This file contains notes on specific details of uClinux/ColdFire.
6 It is written in an FAQ style. The section headers are:
15 8. Using SMB mounted file-systems?
16 9. Using hard disks with uClinux/ColdFire?
17 10. Creating new RAM disk images?
18 11. Customizing files on the root file-system?
19 12. Generating system images?
20 13. What about the web server?
21 14. Hooking up to Linux serial ports?
22 15. Porting apps to uClinux/ColdFire?
23 16. Kernel debugging with gdb/BDM?
24 17. Debugging applications?
25 18. Kernel boot arguments?
29 22. uClinux/ColdFire online resource centre?
38 Currently the supported platforms are:
40 . Arcturus uC5272 board (http://www.arcturusnetworks.com)
41 . Arnewsh 5206 eval board
42 . Arnewsh 5307 eval board
43 . ESPD CF5272 EVB eval board
44 . Motorola m5206eLITE eval board
45 . Motorola M5206eC3 eval board
46 . Motorola M5249C3 eval board
47 . Motorola M5272C3 eval board
48 . Motorola M5282EVB eval board
49 . Motorola M5307C3 eval board
50 . Motorola M5407C3 eval board
51 . Netburner 5206e board (http://www.netburner.com)
52 . SnapGear NETtel/SecureEdge routers (http://www.snapgear.com)
53 . Telos Omnia ToolVox (5206e)
55 There is probably others I am forgetting here, there is quite a
56 large number of supported boards now. It would be fairly easy to
62 The application set is generated and placed into the ROM file-system when
63 compiling. It is dependant on the target platform you select during the
66 It is easy to modify what is added to the ROMfs during compilation. Simply
67 use "make config" and choose to modify the application set.
72 On most boards that have ethernet hardware it is supported. This includes the
73 NE2000 ethernet of the Arnewsh and Motorola eval boards, the SMC9196 of the
74 NETtel, SecureEdge and eLIA platforms and the FEC built-in ethernet on the
75 5272 based boards. On startup a DHCP client is started to try and fetch the
76 IP address of the unit. If you don't have DHCP or bootp setup on your network
77 then you will need to configure the units IP address manually.
79 To manually configure the IP address use the usual ifconfig and route
80 commands. Something like the following will be required:
82 ifconfig eth0 192.168.0.232
83 route add -net 192.168.0.0 netmask 255.255.255.0
85 Where the units IP address is set to 192.168.0.232 on a network address of
86 192.168.0.0, and setting the netmask to be 255.255.255.0. You may also
87 want to setup a default gateway if you have a local router:
89 route add default gw 192.168.0.1
91 This will set up the default route as IP address 192.168.0.1.
92 Issue these commonds from the console command line.
94 You can also setup the /etc/resolv.conf file to point to a local name server
95 if you have DNS running on your network. You will need to re-compile your
96 image to do this, since /etc is in a ROM file-system. If you are using the
97 NETtel/SecureEdge/SnapGear platform then you can create the resolv.conf file
98 in the /etc/config directory as well - which is a non-volatile storage area.
100 Once the IP address is set the ethernet should be going. Use ping to verify.
101 By default you will also have telnetd and httpd listening. You can telnet
102 into uClinux/ColdFire, or get web pages from it.
107 The mcfserial.c driver supports both internal UARTs of the ColdFire
108 processors. Baud rates up to at least 115200 can be generated. You should
109 also be able to use any parity, data bit and stop bit combinations.
111 Note that on the Arnewsh 5206 board the baud rate of 115200 is un-usable -
112 since its 25MHz system clock cannot be nicely divided to make an accurate
113 115200 baud rate. I suggest a maximum of 57600 baud, which seems to work
114 quite well. Other platforms should be able to do 115200 ok.
116 There is a simple callout program for manual serial port use, called "tip".
117 It is similar to cu or the usual tip, only cut down a little. You can talk
118 directly to attached modems with something like:
120 tip -s 57600 /dev/cua1
123 5. Console baud rate?
125 The default baud rate of the serial console depends on the board type you
126 are using. Generally the dBUG based boards (Arnewsh, Cadre3 and Motorola)
127 default to 19200 baud. NETtel/SecureEdge/SnapGear default to 9600.
129 If you want some other baud rate as the console default then modify the
130 CONSOLE_BAUD_RATE define in the vendors/<Vendor>/<Product>/config.arch
131 script, or after configuration, in the config.arch in the top directory
137 PPP works, and chat scripting is supported. At the moment I start PPP by
138 hand from a shell command line, with something like:
140 pppd /dev/cua1 57600 file /etc/config/cua1
142 I have a modem connected to the second serial port. You may need to edit
143 the setup files for this: /etc/config/cua1 and /etc/config/chat.cua1 for
144 your configuration. Currently this setup expects the system you are
145 dialing to assign uClinux/ColdFire an IP address.
147 Be warned there is no DTR/DCD signals on the ColdFire UART's, so pppd
148 probably won't be able to tell when the modem has hung up...
150 The dialer daemon diald also works with PPP. The setup is a little
151 more complex, consult the diald documentation for how to do this.
156 It is really nice being able to mount your development systems files,
157 and run new binaries directly after compiling!
159 NFS is configured into the kernel by default on most true eval boards.
160 To mount NFS filesystems from the network, just do something like:
162 mount X.X.X.X:/YYYY /mnt
164 You will need an NFS aware mount to do this, the sash shell builtin
165 mount program can not mount NFS volumes. You can use the stand-alone
166 mount program if using a uClinux 2.0.x kernel.
168 If using a 2.4.x based kernel there is a couple of additional things
169 to keep in mind. You will need to start the "portmap" daemon before
170 trying to mount an NFS filesystem:
174 And you will also have to use the busybox builtin mount/umount.
175 The stand-alone mount application does not work (or even compile)
176 when using a 2.4.x uClinux kernel.
178 Also there seems to be some problem with fragmented packets and NFS.
179 You will need to limit the buffer size to around 1k when mounting:
181 mount -orsize=1024,wsize=1024 X.X.X.X:/YYYY /mnt
183 That should be good on 2.4.x uClinux systems.
186 8. Using SMB mounted file-systems?
188 The SMB file-system is configured into the kernel by default on most
189 true eval boards. To mount a file share then you would use something
192 /bin/smbmount //MACHINE/SHARENAME /mnt -n -c MACHINE -I X.X.X.X
193 -U username -P passwd
195 where MACHINE is the system that you want to mount from, SHARENAME is
196 the name of an exported share from the machine, X.X.X.X is the IP
197 address of the MACHINE system, and username/passwd is an authorized
200 This is what I use, it may or may not work on your windows network...
201 There seems to be a lot of black magic involved in getting this
205 9. Using hard disks with uClinux/ColdFire?
207 With the right hardware you can use hard drives with uClinux/ColdFire.
208 There are at least 3 platforms that have IDE interfaces, the Lineo eLIA,
209 SnapGear MP3 player and the Motorola M5249C3 board. You can always build
210 your own, if you feel up to it :-)
212 The tools used are the same as for standard PC Linux. The uClinux/ColdFire
213 user sources contain a port of the e2fsprogs tools for creating and fixing
214 ext2 file-systems. The usefull ones are:
216 mke2fs -- make an empty ext2 file-system on a device
217 e2fsck -- repair a (possibly) damaged ext2 file-system
219 You will also need the usual device nodes to exists in the /dev directory
220 of your ROM file-system. For example you will most likely want:
222 /dev/hda -- block device major=3 minor=0
223 /dev/hdb -- block device major=4 minor=64
225 In theory it would be possible to actually boot uClinux/ColdFire from a
226 hard disk. You would need to write a boot loader for your ROM/FLASH that
227 was smart enough to load an image from the hard drive though.
230 10. Creating new RAM disk images?
232 You can create your RAM disks, of any size (given RAM limits). Follow
233 the directions for creating a RAM disk from the kernel documentation,
234 should be /usr/src/linux/Documentation/ramdisk.txt on your host Linux
235 system. Once you have a raw image you need to run a simple compressor
236 over it... Do the following:
239 gcc -O -o holes holes.c
240 ./holes ramdisk-image > ../../romfs/etc/ramfs.img
242 Where "ramdisk-image" is the image file that you generated above.
244 I would suggest also doing a tune2fs on the file-system, and setting
245 the "interval-between-checks" to 0, so that you don't get any annoying
246 "should fsck this file-system" messages when it is mounted.
248 You may also want to think carefully about how many files you think
249 you may want to create in that file-system. Adjust the number of inodes
252 There are some samples of size 64k, 128k, 256k, 512k, 1024k and 2048k
253 in the user/ramimage directory...
256 11. Customizing files on the root file-system?
258 The romfs directory is the tree that is made into the root ROM file-system.
259 So if you want to put files onto / then just put them under romfs, and they
260 will be built into the root file system.
262 You can configure what applications are built into the ROM file-system using
263 the "make config" step.
266 12. Generating system images?
268 By default the build process generates a raw binary image that contains the
269 uClinux kernel and a ROM file-system. This is suitable for loading on many
272 However some targets may only be able to take "packaged" images. Typically
273 they require either an ELF format binary, or an S-RECORD format image.
275 The "make" process generates an ELF image file, image.elf, that contains
276 the kernel and ROM file-system and places it into the "images" directory.
278 This build process uses objcopy to add a new segment and patch its
279 load address appropriately.
281 You can also create S-RECORD images quite easily by running:
283 m68k-elf-objcopy --input-target=binary --output-target=srec \
284 images/image.bin images/image.srec
287 13. What about the web server?
289 There are currently 3 different web servers ported to uClinux/ColdFire.
291 The simplest is the uClinux web server, httpd. It can only deliver static
294 The Boa web server is a light weight nearly full featured web server.
295 It has cgi-bin and authentication support. It is also single tasking -
296 not spawning of multiple processes to handle similtaneous requests.
297 Boa's memory footprint is extremely small (about 85k when running).
298 I highly recommend using this one.
300 The thttpd web server has also been ported to uClinux/ColdFire. It also
301 has cgi-bin and authentication support. It does however spawn off multiple
302 processes to support multiple connections, and it has a much larger memory
303 foot print (about 150k when running).
306 14. Hooking up to Linux serial ports?
308 The easiest way to set up a ColdFire evaluation board is to cable its serial
309 port (or ports) back to the PC COM port(s). Under Linux the "cu" command is
310 the most convenient to use for talking with the serial ports.
312 From the command line do something like:
316 to connect to the serial port. The "-s 19200" sets the port up at 19200 baud.
318 Note that the primary baud rate on many eval boards is 19200. But check what
319 baud rate you will need to use to connect to your board. The default baud rate
320 of uClinux/ColdFire serial console depends on your board.
323 15. Porting apps to uClinux/ColdFire?
325 There are a few issues that you will come across when porting existing
326 Linux applications to uClinux/ColdFire. In no particular order some of
329 no fork() -- use vfork(), check semantics still OK.
330 limited libc -- either add more to libc, or remove some functionality.
331 stack usage -- currently apps are setup to have a fixed 4k stack.
332 You can increase this using the "-s" option of elf2flt.
334 Most source I have tried so far, hasn't been too bad to port. True services
335 (eg apache, samba) can be a problem due to the way they use fork.
338 16. Kernel debugging with gdb/BDM?
340 You can use the Background Debugger Module (BDM) of the ColdFire with
341 gdb on a local system for debugging. You get the full gdb feature set
342 over the BDM cable, so this is a powerfull debugging tool. You will
343 need the following to do this:
345 . Linux driver for BDM
346 . Patched gdb with BDM support
349 You can find the most recent Linux BDM driver at:
351 ftp://www.cybertec.com.au/pub/bdm/src/gdb-bdm-20020210.tar.gz
353 A modified gdb is included in the binary tools package of the uClinux/ColdFire
354 distribution, m68k-elf-gdb. It is ready for use with the BDM driver.
356 Lastly you really need an appropriate .gdbinit script to use with gdb.
357 You can find many sample ones in the uClinux/ColdFire binary tools package,
358 under tools/misc. There is some introductory documentation on using gdb with
359 the BDM driver in the file tools/misc/gdb.txt.
361 To get full source level debugging with gdb you should turn on
362 "Full Symbolic/Source level debugging" under "Kernel Hacking" in the config.
363 This enables the "-g" flag and removes the "-fomit-frame-pointer" flag from
364 all kernel compiles. This gives source level debugging and improves stack
368 17. Debugging applications?
370 A gdbserver port exists now for debugging user applications over the network.
371 You will need a cross gdb for debugging with this setup. The one included
372 in the tools directory is suitable for this. If you wish to configure your
373 own gdb, you need to configure it with a target of "m68k-elf" on your host
374 Linux PC system (ie. ./configure --target=m68k-elf).
376 To debug an application remotely:
378 1. On uClinux/ColdFire "gdbserver :3000 app"
379 2. On host system "gdb app.gdb"
380 3. At gdb command prompt enter "target remote <IP>:3000"
382 This procedure uses port TCP port 3000, you can use any un-used port you like.
383 <IP> is the IP address of the uClinux/ColdFire hardware.
385 Providing the application was compiled with debugging enabled (gcc -g option)
386 you will get full symbolic and source level debugging. This is enabled
387 automatically if the kernel "Full Symbolic/Source level debugging" flag
388 is enabled in the "Kernel Hacking" section of the config.
391 18. Kernel boot arguments?
393 The uClinux kernel can accept boot time arguments in the same way that the
394 standard Linux kernel can. How these can be setup varies depending on the
395 exact hardware platform.
397 The Lineo ColdFire platforms supply boot arguments that are stored in
398 FLASH memory. These are typically stored in the /dev/rom2 device (this is
399 on the NETtel and eLIA platforms). You can see what is currently set using
404 It should give you a dump that looks something like:
406 0: 43 4F 4E 53 4F 4C 45 3D-2F 64 65 76 2F 74 74 79 CONSOLE=/dev/tty
407 10: 53 30 20 00 FF FF FF FF-FF FF FF FF FF FF FF FF S0 .............
408 20: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
409 30: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
410 40: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
411 50: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
412 60: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
413 70: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
415 You can set arguments in this region using the "flashw" command. For example
416 if you wanted to add a profiling argument you would do something like:
418 flashw CONSOLE=/dev/ttyS0 profile=2 /dev/rom2
420 Not all uClinux platforms support mechanisms for setting up boot arguments
423 19. Kernel profiling?
425 It is possible, and quite simple, to use kernel profiling support. There are
426 two things that you will need. Firstly you need to have the Profiling
427 configuration option enabled in the kernel build. Secondly you need to use
428 the "readprofile" application (a port exists in the "user" directory).
430 When running with kernel profiling enabled then you simply run the readprofile
431 command, and it will report profiling information. Example output would look
435 7% 9 try_to_free_buffer 0.0147
437 7% 9 generic_file_read 0.0061
441 ---------------------------------------------------------------------------
444 If you want to clear the profiling buffer (reset it to 0) then use the "-r"
445 switch of readprofile.
447 If you just want a report on current (or average) CPU utilization then you
448 need only look at the information in /proc/stat. You can use the "cpu" program
449 to report this in a nice way.
454 Some ColdFire boards have PCI buses on them. The two I have worked with are
455 the Lineo eLIA and the Motorola M5407C3 eval boards. uClinux/ColdFire supports
456 the PCI buses on both these boards, simply enable the "PCI bus support"
457 option when configuring your kernel build.
459 The kernel PCI support will scan the PCI bus at system startup, and will
460 find any PCI devices present. The kernel will also assign memory and
461 interrupt resources to the found devices.
463 To find out what the system has found and assigned on the PCI bus use the
464 /proc/pci device. Simply do "cat /proc/pci", you should get output something
468 Bus 0, device 14, function 0:
469 Serial controller: Unknown vendor Unknown device (rev 1).
470 Vendor id=15aa. Device id=2000.
471 Medium devsel. Fast back-to-back capable. IRQ 25.
472 Non-prefetchable 32 bit memory at 0x10000.
477 For any PCI device then you will need a driver that actually knows how to
478 deal with the device hardware. So far I have used the following boards
479 successfully on the PCI bus:
481 1. RAStel multi-modem board (serial.c driver)
482 2. NE2000 compatible PCI 10Mb ethernet board (ne2k-pci.c driver)
483 3. Macronix 10/100 Mb ethernet board (tulip.c driver)
485 Note that PC drivers don't work "as is". You will have to do some changes to the
486 code to get them to work. For simple boards with simple programmed IO and
487 interrupts the changes are generally quite simple. For devices that are PCI
488 bus masters the changes are quite involved and complicated.
493 No cryptographic code is shipped with uClinux/ColdFire. This is simply to
494 avoid any problems with differing country regulations on export.
496 The source tree (and makefiles) are setup to work with libdes, libssl and RC4.
497 But you will have to get this source code and put it in the tree yourself.
500 22. uClinux/ColdFire online resource centre?
502 For the most upto date information on uClinux goto http://www.uclinux.org.
504 For the latest uClinux/ColdFire information visit our online web pages at
505 http://www.uclinux.org/ports/coldfire
507 There is a portal site for uClinux at http://www.ucdot.org, too.