Page 2
Embedded Artists AB
Sdra Promenaden 51
SE-211 38 Malm
Sweden
info@EmbeddedArtists.com
http://www.EmbeddedArtists.com
Copyright 2009 Embedded Artists AB. All rights reserved.
No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval
system, or translated into any language or computer language, in any form or by any means,
electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without the prior
written permission of Embedded Artists AB.
Disclaimer
Embedded Artists AB makes no representation or warranties with respect to the contents
hereof and specifically disclaims any implied warranties or merchantability or fitness for any
particular purpose. Information in this publication is subject to change without notice and
does not represent a commitment on the part of Embedded Artists AB.
Feedback
We appreciate any feedback you may have for improvements on this document. Please send
your comments to support@EmbeddedArtists.com.
Trademarks
All brand and product names mentioned herein are trademarks, services marks, registered
trademarks, or registered service marks of their respective owners and should be treated as
such.
Page 3
Page 4
Table of Contents
1 Introduction ......................................................... 10
1.1
1.2
1.3
1.4
1.5
Introduction .................................................................................. 15
2.2
Linux .............................................................................................. 15
2.2.1
2.2.2
2.3
2.3.1
Swapping..................................................................................... 18
2.3.2
2.4
Clinux .......................................................................................... 18
2.4.1
Limitations ................................................................................... 19
2.4.2
Benefits ....................................................................................... 20
2.4.3
Modifications ............................................................................... 20
2.5
2.5.1
2.5.2
RTLinux ....................................................................................... 21
2.5.3
RTAI ............................................................................................ 21
2.5.4
Xenomai ...................................................................................... 21
Introduction .................................................................................. 23
3.2
3.2.1
3.3
3.3.1
3.3.2
3.4
3.4.1
Makefile ....................................................................................... 30
3.4.2
3.4.3
4.2
4.3
4.3.1
Introduction .................................................................................. 33
Page 5
4.3.2
4.3.3
4.4
4.4.1
Commands .................................................................................. 37
4.4.2
Variables ..................................................................................... 38
4.4.3
4.5
4.5.1
4.5.2
Boot Arguments........................................................................... 39
4.5.3
4.5.4
TFTP ........................................................................................... 40
4.5.5
4.5.6
4.5.7
4.5.8
NOR Flash................................................................................... 44
4.5.9
Introduction .................................................................................. 47
5.2
5.3
Porting ........................................................................................... 48
5.4
5.4.1
Configuration ............................................................................... 48
5.4.2
5.4.3
Usage .......................................................................................... 49
5.5
Configuration ............................................................................... 49
5.5.2
5.5.3
Usage .......................................................................................... 50
5.6
Ethernet ......................................................................................... 51
5.6.1
Configuration ............................................................................... 51
5.6.2
5.6.3
Usage .......................................................................................... 51
5.7
MMC / SD ....................................................................................... 52
5.7.1
Configuration ............................................................................... 52
5.7.2
5.7.3
Usage .......................................................................................... 52
5.8
5.8.1
Configuration ............................................................................... 53
5.8.2
5.8.3
Usage .......................................................................................... 54
5.9
Touch Screen................................................................................ 49
5.5.1
5.9.1
Configuration ............................................................................... 54
5.9.2
5.9.3
Usage .......................................................................................... 55
5.10
UART ........................................................................................... 55
Page 6
5.10.1
Configuration ............................................................................. 55
5.10.2
5.10.3
Usage ........................................................................................ 56
2
5.11
I C ................................................................................................ 56
5.11.1
Configuration ............................................................................. 56
5.11.2
5.11.3
Usage ........................................................................................ 59
5.12
SPI ............................................................................................... 60
5.12.1
Configuration ............................................................................. 60
5.12.2
5.12.3
Usage ........................................................................................ 61
5.13
RTC .............................................................................................. 62
5.13.1
Configuration ............................................................................. 62
5.13.2
5.13.3
Usage ........................................................................................ 63
5.14
MTD.............................................................................................. 63
5.14.1
Configuration ............................................................................. 64
5.14.2
5.14.3
5.14.4
Usage ........................................................................................ 66
5.15
SFR .............................................................................................. 66
5.15.1
5.15.2
Usage ........................................................................................ 66
5.16
ADC ............................................................................................. 67
5.16.1
5.16.2
Usage ........................................................................................ 68
5.17
Joystick ....................................................................................... 68
5.17.1
5.17.2
Usage ........................................................................................ 68
5.18
5.18.1
Configuration ............................................................................. 70
5.18.2
Usage ........................................................................................ 70
6.1
Introduction .................................................................................. 71
6.2
6.3
6.4
6.5
6.6
Threads Example.......................................................................... 74
6.7
6.8
6.9
6.9.1
NFS ............................................................................................. 80
6.9.2
6.9.3
ROMFS ....................................................................................... 80
Page 7
7 Development Environment................................. 82
7.1
Introduction .................................................................................. 82
7.2
Virtualization ................................................................................. 82
7.2.1
7.2.2
7.3
7.3.1
7.3.2
7.3.3
7.3.4
7.3.5
8.2
8.3
8.4
8.4.1
8.4.2
8.4.3
Additional Ways........................................................................... 94
8.5
8.5.1
9.2
9.2.1
Introduction.................................................................................. 98
9.2.2
9.2.3
9.2.4
9.2.5
9.3
9.3.1
9.3.2
9.3.3
9.4
9.4.1
9.4.2
9.4.3
9.4.4
9.4.5
9.5
9.5.1
9.5.2
9.5.3
9.5.4
Page 8
9.5.5
Groups....................................................................................... 114
9.5.6
9.5.7
9.5.8
9.6
9.6.1
9.6.2
9.6.3
Synaptic..................................................................................... 118
9.7
9.8
9.9
9.10
9.10.1
9.10.2
Indentation............................................................................... 125
9.10.3
9.10.4
Plugins..................................................................................... 126
9.10.5
9.10.6
10.2
10.2.1
10.2.2
10.3
10.3.1
10.3.2
10.3.3
Using tftpboot to Boot Clinux with Root File System ........ 133
10.3.4
10.4
10.4.1
10.4.2
10.5
10.5.1
10.5.2
10.5.3
10.5.4
10.5.5
10.6
10.6.1
10.6.2
10.6.3
10.6.4
Boot from NAND Flash Using a JFFS2 File System ................ 142
10.7
Page 9
11.1
11.2
11.2.1
11.2.2
11.3
11.3.1
11.4
11.4.1
11.4.2
11.5
11.5.1
11.5.2
11.5.3
11.5.4
11.5.5
11.5.6
11.6
11.6.1
11.7
11.7.1
11.7.2
11.8
I C .............................................................................................. 160
11.8.1
11.8.2
11.9
11.10
11.11
11.12
12.2
12.3
12.4
13 Resources........................................................ 168
Page 10
1 Introduction
This book is designed to help you get acquainted with Clinux, the Linux distribution for
processors without a Memory Management Unit (MMU). The book has a practical approach
with lots of step-by-step guides. The guides have been designed around the Embedded
Artists LPC2468 OEM Board and LPC2478 OEM Board with appropriate Base Board and
for the Embedded Artists Clinux port for the LPC24xx microcontroller.
The development environment used for the exercises is based on a Debian Etch Linux
distribution which is distributed as a VMware image that can be run in, for example, the
VMware Player available for Windows PCs as well as Linux PCs, i.e., a virtualization
approach has been chosen for the Debian Etch distribution.
It is not necessary to have expert knowledge about using Linux in order to understand the
content of this book or to do the exercises since one part of the book will cover the basics of
using Linux.
Besides describing Clinux the Universal boot loader (U-boot) will also be covered in this
book since without a boot loader it will be difficult to get Clinux up-and-running. There
should be enough information in this book to get you working with Clinux on an
Embedded System.
Page 11