FriendlyARM mini6410 - Pengutronix
FriendlyARM mini6410 - Pengutronix
FriendlyARM mini6410 - Pengutronix
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
OSELAS.Support<br />
OSELAS.Training<br />
OSELAS.Development<br />
OSELAS.Services<br />
Quickstart Manual<br />
OSELAS.BSP( )<br />
<strong>FriendlyARM</strong> <strong>mini6410</strong><br />
<strong>Pengutronix</strong> e. K.<br />
Peiner Straße 6–8<br />
31137 Hildesheim<br />
+49 (0)51 21 / 20 69 17 – 0 (Fon)<br />
+49 (0)51 21 / 20 69 17 – 55 55 (Fax)<br />
info@pengutronix.de<br />
© 2011 <strong>Pengutronix</strong>, Hildesheim – Rev. 1611/495
Contents<br />
I<br />
OSELAS Quickstart for<br />
<strong>FriendlyARM</strong> <strong>mini6410</strong> 5<br />
1 First steps with PTXdist 6<br />
2 Getting a working Environment 8<br />
2.1 Download Software Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
2.2 PTXdist Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
2.2.1 Main Parts of PTXdist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
2.2.2 Extracting the Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
2.2.3 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />
2.2.4 Configuring PTXdist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
2.3 Toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
2.3.1 Using Existing Toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
2.3.2 Building a Toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
2.3.3 Building the OSELAS.Toolchain for OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0 . . . . . 13<br />
2.3.4 Protecting the Toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
2.3.5 Building Additional Toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
3 Building a root filesystem for the <strong>mini6410</strong> 16<br />
3.1 Extracting the Board Support Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />
3.2 Selecting a Userland Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
3.3 Selecting a Hardware Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
3.4 Selecting a Toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
3.5 Building the Root Filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
3.6 Building an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />
4 How to Boot the Mini6410 19<br />
4.1 SD/MMC Card Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />
5 Special Notes 23<br />
5.1 Available Kernel Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
5.2 Available Userland Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
5.2.1 Some details about the configs/ptxconfig.qt . . . . . . . . . . . . . . . . . . . . . . . 23<br />
5.3 Framebuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
5.4 GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
5.4.1 GPIO Usage Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
5.5 I²C Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
5.5.1 I²C Device AT24c04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
5.6 LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
5.7 MMC/SD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
5.8 SDIO Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
3
Contents<br />
5.9 Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
5.10 Touchscreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
5.10.1 If the Touchscreen does not work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
5.10.2 If the Touchscreen does not work as expected . . . . . . . . . . . . . . . . . . . . . . . 28<br />
5.11 LCD Backlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
5.12 ADC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
5.13 Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
5.14 Get the latest BSP Release for the Mini6410 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />
5.15 Be Part of the Mini6410 BSP Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />
6 Document Revisions 31<br />
7 Getting help 32<br />
7.1 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
7.1.1 About PTXdist in Particular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
7.1.2 About Embedded Linux in General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
7.2 About Working on the Linux Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
7.3 Chat/IRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
7.4 <strong>FriendlyARM</strong> <strong>mini6410</strong> specific Mailing List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
7.5 Commercial Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
4
Part I<br />
OSELAS Quickstart for<br />
<strong>FriendlyARM</strong> <strong>mini6410</strong><br />
5
1 First steps with PTXdist<br />
In the next sections you will work with PTXdist to get everything you need to get your <strong>mini6410</strong> up and working.<br />
To give you a quick idea what PTXdist is, you should read this section.<br />
PTXdist works as a console command tool. Everything we want PTXdist to do, we have to enter as a command.<br />
But it’s always the same base command:<br />
$ ptxdist <br />
To run different functions, this command must be extended by parameters to define the function we want to run.<br />
If we are unsure what parameter must be given to obtain a special function, we run it with the parameter help.<br />
$ ptxdist help<br />
This will output all possible parameters and subcommands and their meaning.<br />
As the list we see is very long, let’s explain the major parameters usually needed for daily usage:<br />
menu This starts a dialog based frontend for those who do not like typing commands. It will gain us access to the<br />
most common parameters to configure and build a PTXdist project. Note: it needs ’dialog’ to be installed<br />
to make is work. It will fail if this tool is not installed on your host. menuconfig can be used instead in this<br />
case.<br />
menuconfig Starts the Kconfig based project configurator for the current selected userland configuration. This<br />
menu will give us access to various userland components the root filesystem of our target should consist<br />
of.<br />
platformconfig Starts the Kconfig based platform configurator. This menu lets us set up all target specific settings.<br />
Major parts are:<br />
• Toolchain (architecture and revision)<br />
• boot loader<br />
• root filesystem image type<br />
• Linux kernel (revision)<br />
Note: A PTXdist project can consist of more than one platform configuration at the same time.<br />
kernelconfig Runs the standard Linux kernel Kconfig to configure the kernel for the current selected platform.<br />
To run this feature, the kernel must be already set up for this platform.<br />
menuconfig barebox Runs the standard Barebox’s Kconfig to configure the bootloader. To run this feature,<br />
Barebox must be already set up for this platform.<br />
toolchain Sets up the path to the toolchain used to compile the current selected platform. Without an additional<br />
parameter, PTXdist tries to guess the toolchain from platform settings. To be successful, PTXdist depends<br />
on the OSELAS.Toolchains installed to the /opt directory.<br />
If PTXdist wasn’t able to autodetect the toolchain, an additional parameter can be given to provide the<br />
path to the compiler, assembler, linker and so on.<br />
6
1 First steps with PTXdist<br />
select Used to select the current userland configuration, which is only required if there is no selected_ptxconfig<br />
in the project’s main directory. This parameter needs the path to a valid ptxconfig. It will generate a soft<br />
link called selected_ptxconfig in the project’s main directory.<br />
platform Used to select the current platform configuration, which is only required if there is no selected_platformconfig<br />
in the project’s main directory. This parameter needs the path to a valid<br />
platformconfig. It will generate a soft link called selected_platformconfig in the project’s main directory.<br />
go The mostly used command. This will start to build everything to get all the project defined software parts.<br />
Also used to rebuild a part after its configuration was changed.<br />
images Used at the end of a build to create an image from all userland packages to deploy the target (its flash<br />
for example or its hard disk).<br />
setup Mostly run once per PTXdist revision to set up global paths and the PTXdist behavior.<br />
All these commands depending on various files a PTXdist based project provides. So, running the commands<br />
make only sense in directories that contain a PTXdist based project. Otherwise, PTXdist gets confused and then<br />
it tries to confuse the user with funny error messages.<br />
7
2 Getting a working Environment<br />
2.1 Download Software Components<br />
In order to follow this manual, some software archives are needed. There are several possibilities how to get<br />
these: either as part of an evaluation board package or by downloading them from the <strong>Pengutronix</strong> web site.<br />
The central place for OSELAS related documentation is http://www.oselas.com. This website provides all required<br />
packages and documentation (at least for software components which are available to the public).<br />
To build OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0, the following archives have to be available on the development<br />
host:<br />
• ptxdist-2011.10.1.tar.bz2<br />
• OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0.tar.gz<br />
• OSELAS.Toolchain-2011.03.1.tar.bz2<br />
If they are not available on the development system yet, it is necessary to get them.<br />
2.2 PTXdist Installation<br />
The PTXdist build system can be used to create a root filesystem for embedded Linux devices. In order to start<br />
development with PTXdist it is necessary to install the software on the development system.<br />
This chapter provides information about how to install and configure PTXdist on the development host.<br />
2.2.1 Main Parts of PTXdist<br />
The most important software component which is necessary to build an OSELAS.BSP( ) board support package<br />
is the ptxdist tool. So before starting any work we’ll have to install PTXdist on the development host.<br />
PTXdist consists of the following parts:<br />
The ptxdist Program: ptxdist is installed on the development host during the installation process. ptxdist is<br />
called to trigger any action, like building a software packet, cleaning up the tree etc. Usually the ptxdist<br />
program is used in a workspace directory, which contains all project relevant files.<br />
A Configuration System: The config system is used to customize a configuration, which contains information<br />
about which packages have to be built and which options are selected.<br />
Patches: Due to the fact that some upstream packages are not bug free – especially with regard to cross compilation<br />
– it is often necessary to patch the original software. PTXdist contains a mechanism to automatically<br />
apply patches to packages. The patches are bundled into a separate archive. Nevertheless, they are necessary<br />
to build a working system.<br />
8
2 Getting a working Environment<br />
Package Descriptions: For each software component there is a “recipe” file, specifying which actions have to be<br />
done to prepare and compile the software. Additionally, packages contain their configuration sniplet for<br />
the config system.<br />
Toolchains: PTXdist does not come with a pre-built binary toolchain. Nevertheless, PTXdist itself is able to<br />
build toolchains, which are provided by the OSELAS.Toolchain() project. More in-deep information about<br />
the OSELAS.Toolchain() project can be found here: http://www.pengutronix.de/oselas/toolchain/<br />
index_en.html<br />
Board Support Package This is an optional component, mostly shipped aside with a piece of hardware. There<br />
are various BSP available, some are generic, some are intended for a specific hardware.<br />
2.2.2 Extracting the Sources<br />
To install PTXdist, the archive <strong>Pengutronix</strong> provides has to be extracted:<br />
ptxdist-2011.10.1.tar.bz2 The PTXdist software itself<br />
The PTXdist packet has to be extracted into some temporary directory in order to be built before the installation,<br />
for example the local/ directory in the user’s home. If this directory does not exist, we have to create it and<br />
change into it:<br />
$ cd<br />
$ mkdir local<br />
$ cd local<br />
Next step is to extract the archive:<br />
$ tar -xjf ptxdist-2011.10.1.tar.bz2<br />
If everything goes well, we now have a PTXdist-2011.10.1 directory, so we can change into it:<br />
$ cd ptxdist-2011.10.1<br />
$ ls -lF<br />
total 508<br />
-rw-r--r-- 1 jb user 18361 Sep 2 12:40 COPYING<br />
-rw-r--r-- 1 jb user 3914 Sep 2 12:40 CREDITS<br />
-rw-r--r-- 1 jb user 115540 Sep 2 12:40 ChangeLog<br />
-rw-r--r-- 1 jb user 57 Sep 2 12:40 INSTALL<br />
-rw-r--r-- 1 jb user 2531 Sep 2 12:40 Makefile.in<br />
-rw-r--r-- 1 jb user 4252 Sep 2 12:40 README<br />
-rw-r--r-- 1 jb user 63516 Sep 2 12:40 TODO<br />
-rwxr-xr-x 1 jb user 28 Sep 2 12:40 autogen.sh<br />
drwxr-xr-x 2 jb user 72 Sep 2 12:40 bin<br />
drwxr-xr-x 10 jb user 296 Sep 2 12:40 config<br />
-rwxr-xr-x 1 jb user 212213 Sep 2 17:10 configure<br />
-rw-r--r-- 1 jb user 12515 Sep 2 12:40 configure.ac<br />
drwxr-xr-x 10 jb user 248 Sep 2 12:40 generic<br />
drwxr-xr-x 221 jb user 7440 Sep 2 12:40 patches<br />
drwxr-xr-x 2 jb user 1240 Sep 2 12:40 platforms<br />
drwxr-xr-x 4 jb user 112 Sep 2 12:40 plugins<br />
drwxr-xr-x 6 jb user 52248 Sep 2 12:40 rules<br />
drwxr-xr-x 8 jb user 912 Sep 2 12:40 scripts<br />
drwxr-xr-x 2 jb user 512 Sep 2 12:40 tests<br />
9
2 Getting a working Environment<br />
2.2.3 Prerequisites<br />
Before PTXdist can be installed it has to be checked if all necessary programs are installed on the development<br />
host. The configure script will stop if it discovers that something is missing.<br />
The PTXdist installation is based on GNU autotools, so the first thing to be done now is to configure the packet:<br />
$ ./configure<br />
This will check your system for required components PTXdist relies on. If all required components are found the<br />
output ends with:<br />
[...]<br />
checking whether /usr/bin/patch will work... yes<br />
configure: creating ./config.status<br />
config.status: creating Makefile<br />
config.status: creating scripts/ptxdist_version.sh<br />
config.status: creating rules/ptxdist-version.in<br />
ptxdist version 2011.10.1 configured.<br />
Using ’/usr/local’ for installation prefix.<br />
Report bugs to ptxdist@pengutronix.de<br />
Without further arguments PTXdist is configured to be installed into /usr/local, which is the standard location<br />
for user installed programs. To change the installation path to anything non-standard, we use the --prefix argument<br />
to the configure script. The --help option offers more information about what else can be changed for<br />
the installation process.<br />
The installation paths are configured in a way that several PTXdist versions can be installed in parallel. So if an<br />
old version of PTXdist is already installed there is no need to remove it.<br />
One of the most important tasks for the configure script is to find out if all the programs PTXdist depends on are<br />
already present on the development host. The script will stop with an error message in case something is missing.<br />
If this happens, the missing tools have to be installed from the distribution befor re-running the configure script.<br />
When the configure script is finished successfully, we can now run<br />
$ make<br />
All program parts are being compiled, and if there are no errors we can now install PTXdist into it’s final location.<br />
In order to write to /usr/local, this step has to be performed as user root:<br />
$ sudo make install<br />
[enter password]<br />
[...]<br />
If we don’t have root access to the machine it is also possible to install PTXdist into some other directory with<br />
the --prefix option. We need to take care that the bin/ directory below the new installation dir is added to our<br />
$PATH environment variable (for example by exporting it in ˜/.bashrc).<br />
The installation is now done, so the temporary folder may now be removed:<br />
$ cd ../../<br />
$ rm -fr local<br />
10
2 Getting a working Environment<br />
2.2.4 Configuring PTXdist<br />
When using PTXdist for the first time, some setup properties have to be configured. Two settings are the most<br />
important ones: Where to store the source archives and if a proxy must be used to gain access to the world wide<br />
web.<br />
Run PTXdist’s setup:<br />
$ ptxdist setup<br />
Due to PTXdist is working with sources only, it needs various source archives from the world wide web. If these<br />
archives are not present on our host, PTXdist starts the wget command to download them on demand.<br />
Proxy Setup<br />
To do so, an internet access is required. If this access is managed by a proxy wget command must be adviced to<br />
use it. PTXdist can be configured to advice the wget command automatically: Navigate to entry Proxies and enter<br />
the required addresses and ports to access the proxy in the form:<br />
://:<br />
Source Archive Location<br />
Whenever PTXdist downloads source archives it stores these archives in a project local manner. This is the default<br />
behaviour. If we are working with more than one PTXdist based project, every project would download its own<br />
required archives in this case. To share all source archives between all projects, PTXdist can be configured to<br />
share only one archive directory for all projects it handles: Navigate to menu entry Source Directory and enter the<br />
path to the directory where PTXdist should store archives to share between its projects.<br />
Generic Project Location<br />
If we already installed the generic projects we should also configure PTXdist to know this location. If we already<br />
did so, we can use the command ptxdist projects to get a list of available projects and ptxdist clone to get a<br />
local working copy of a shared generic project.<br />
Navigate to menu entry Project Searchpath and enter the path to projects that can be used in such a way. Here<br />
we can configure more than one path, each part can be delemited by a colon. For example for PTXdist’s generic<br />
projects and our own previous projects like this:<br />
/usr/local/lib/ptxdist-2011.10.1/projects:/office/my_projects/ptxdist<br />
Leave the menu and store the configuration. PTXdist is now ready for use.<br />
2.3 Toolchains<br />
Before we can start building our first userland we need a cross toolchain. On Linux, toolchains are no monolithic<br />
beasts. Most parts of what we need to cross compile code for the embedded target comes from the GNU Compiler<br />
Collection, gcc. The gcc packet includes the compiler frontend, gcc, plus several backend tools (cc1, g++, ld etc.)<br />
11
2 Getting a working Environment<br />
which actually perform the different stages of the compile process. gcc does not contain the assembler, so we<br />
also need the GNU Binutils package which provides lowlevel stuff.<br />
Cross compilers and tools are usually named like the corresponding host tool, but with a prefix – the GNU target.<br />
For example, the cross compilers for ARM and powerpc may look like<br />
• arm-softfloat-linux-gnu-gcc<br />
• powerpc-unknown-linux-gnu-gcc<br />
With these compiler frontends we can convert e.g. a C program into binary code for specific machines. So for<br />
example if a C program is to be compiled natively, it works like this:<br />
$ gcc test.c -o test<br />
To build the same binary for the ARM architecture we have to use the cross compiler instead of the native one:<br />
$ arm-softfloat-linux-gnu-gcc test.c -o test<br />
Also part of what we consider to be the ”toolchain” is the runtime library (libc, dynamic linker). All programs<br />
running on the embedded system are linked against the libc, which also offers the interface from user space<br />
functions to the kernel.<br />
The compiler and libc are very tightly coupled components: the second stage compiler, which is used to build<br />
normal user space code, is being built against the libc itself. For example, if the target does not contain a hardware<br />
floating point unit, but the toolchain generates floating point code, it will fail. This is also the case when the<br />
toolchain builds code for i686 CPUs, whereas the target is i586.<br />
So in order to make things working consistently it is necessary that the runtime libc is identical with the libc the<br />
compiler was built against.<br />
PTXdist doesn’t contain a pre-built binary toolchain. Remember that it’s not a distribution but a development<br />
tool. But it can be used to build a toolchain for our target. Building the toolchain usually has only to be done<br />
once. It may be a good idea to do that over night, because it may take several hours, depending on the target<br />
architecture and development host power.<br />
2.3.1 Using Existing Toolchains<br />
If a toolchain is already installed which is known to be working, the toolchain building step with PTXdist may be<br />
omitted.<br />
The OSELAS.BoardSupport() Packages shipped for PTXdist have been tested with the OSE-<br />
LAS.Toolchains() built with the same PTXdist version. So if an external toolchain is being used<br />
which isn’t known to be stable, a target may fail. Note that not all compiler versions and combinations<br />
work properly in a cross environment.<br />
Every OSELAS.BoardSupport() Package checks for its OSELAS.Toolchain it’s tested against, so using a different<br />
toolchain vendor requires an additional step:<br />
Open the OSELAS.BoardSupport() Package menu with:<br />
$ ptxdist platformconfig<br />
12
2 Getting a working Environment<br />
and navigate to architecture ---> toolchain and check for specific toolchain vendor. Clear this entry to<br />
disable the toolchain vendor check.<br />
Preconditions an external toolchain must meet:<br />
• it shall be built with the configure option --with-sysroot pointing to its own C libraries.<br />
• it should not support the multilib feature as this may confuse PTXdist which libraries are to select for the<br />
root filesystem<br />
If we want to check if our toolchain was built with the --with-sysroot option, we just run this simple command:<br />
$ mytoolchain-gcc -v 2>&1 grep with-sysroot<br />
If this command does not output anything, this toolchain was not built with the --with-sysroot option and<br />
cannot be used with PTXdist.<br />
2.3.2 Building a Toolchain<br />
PTXdist handles toolchain building as a simple project, like all other projects, too. So we can download the<br />
OSELAS.Toolchain bundle and build the required toolchain for the OSELAS.BoardSupport() Package.<br />
Building any toolchain of the OSELAS.Toolchain-2011.03.1 is tested with PTXdist-2011.03.0.<br />
<strong>Pengutronix</strong> recommends to use this specific PTXdist to build the toolchain. So, it might be<br />
essential to install more than one PTXdist revision to build the toolchain and later on the Board<br />
Support Package if the latter one is made for a different PTXdist revision.<br />
A PTXdist project generally allows to build into some project defined directory; all OSELAS.Toolchain projects<br />
that come with PTXdist are configured to use the standard installation paths mentioned below.<br />
All OSELAS.Toolchain projects install their result into /opt/OSELAS.Toolchain-2011.03.1/.<br />
Usually the /opt directory is not world writeable. So in order to build our OSELAS.Toolchain<br />
into that directory we need to use a root account to change the permissions. PTXdist detects<br />
this case and asks if we want to run sudo to do the job for us. Alternatively we can enter:<br />
mkdir /opt/OSELAS.Toolchain-2011.03.1<br />
chown /opt/OSELAS.Toolchain-2011.03.1<br />
chmod a+rwx /opt/OSELAS.Toolchain-2011.03.1.<br />
We recommend to keep this installation path as PTXdist expects the toolchains at /opt. Whenever we go to select<br />
a platform in a project, PTXdist tries to find the right toolchain from data read from the platform configuration<br />
settings and a toolchain at /opt that matches to these settings. But that’s for our convenience only. If we decide<br />
to install the toolchains at a different location, we still can use the toolchain parameter to define the toolchain to<br />
be used on a per project base.<br />
2.3.3 Building the OSELAS.Toolchain for OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0<br />
To compile and install an OSELAS.Toolchain we have to extract the OSELAS.Toolchain archive, change into the<br />
new folder, configure the compiler in question and start the build.<br />
The required compiler to build the OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0 board support package is<br />
13
2 Getting a working Environment<br />
arm-1136jfs-linux-gnueabi_gcc-4.5.2_glibc-2.13_binutils-2.21_kernel-2.6.36-sanitized<br />
So the steps to build this toolchain are:<br />
In order to build any of the OSELAS.Toolchains, the host must provide the tool fakeroot. Otherwise<br />
the message bash: fakeroot: command not found will occur and the build stops.<br />
$ tar xf OSELAS.Toolchain-2011.03.1.tar.bz2<br />
$ cd OSELAS.Toolchain-2011.03.1<br />
$ ptxdist select ptxconfigs/↵<br />
arm-1136jfs-linux-gnueabi_gcc-4.5.2_glibc-2.13_binutils-2.21_kernel-2.6.36-sanitized.ptxconfig<br />
$ ptxdist go<br />
At this stage we have to go to our boss and tell him that it’s probably time to go home for the day. Even on<br />
reasonably fast machines the time to build an OSELAS.Toolchain is something like around 30 minutes up to a<br />
few hours.<br />
Measured times on different machines:<br />
• Single Pentium 2.5 GHz, 2 GiB RAM: about 2 hours<br />
• Turion ML-34, 2 GiB RAM: about 1 hour 30 minutes<br />
• Dual Athlon 2.1 GHz, 2 GiB RAM: about 1 hour 20 minutes<br />
• Dual Quad-Core-Pentium 1.8 GHz, 8 GiB RAM: about 25 minutes<br />
• 24 Xeon cores 2.54 GHz, 96 GiB RAM: about 22 minutes<br />
Another possibility is to read the next chapters of this manual, to find out how to start a new project.<br />
When the OSELAS.Toolchain project build is finished, PTXdist is ready for prime time and we can continue with<br />
our first project.<br />
2.3.4 Protecting the Toolchain<br />
All toolchain components are built with regular user permissions. In order to avoid accidential changes in the<br />
toolchain, the files should be set to read-only permissions after the installation has finished successfully. It is also<br />
possible to set the file ownership to root. This is an important step for reliability, so it is highly recommended.<br />
2.3.5 Building Additional Toolchains<br />
The OSELAS.Toolchain-2011.03.1 bundle comes with various predefined toolchains. Refer the ptxconfigs/ folder<br />
for other definitions. To build additional toolchains we only have to clean our current toolchain project, removing<br />
the current selected_ptxconfig link and creating a new one.<br />
$ ptxdist clean<br />
$ rm selected_ptxconfig<br />
$ ptxdist select ptxconfigs/any_other_toolchain_def.ptxconfig<br />
$ ptxdist go<br />
All toolchains will be installed side by side architecture dependent into directory<br />
14
2 Getting a working Environment<br />
/opt/OSELAS.Toolchain-2011.03.1/architecture_part.<br />
Different toolchains for the same architecture will be installed side by side version dependent into directory<br />
/opt/OSELAS.Toolchain-2011.03.1/architecture_part/version_part.<br />
15
3 Building a root filesystem for the <strong>mini6410</strong><br />
3.1 Extracting the Board Support Package<br />
In order to work with a PTXdist based project we have to extract the archive first.<br />
$ tar -zxf OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0.tar.gz<br />
$ cd OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0<br />
PTXdist is project centric, so now after changing into the new directory we have access to all valid components.<br />
total 36<br />
-rw-r--r-- 1 jbe ptx 1393 Nov 1 14:25 Changelog<br />
-rw-r--r-- 1 jbe ptx 797 Nov 1 14:25 FAQ<br />
-rw-r--r-- 1 jbe ptx 177 Nov 1 14:25 README<br />
drwxr-xr-x 3 jbe ptx 4096 Nov 1 14:25 configs<br />
drwxr-xr-x 3 jbe ptx 4096 Nov 1 14:25 documentation<br />
drwxr-xr-x 3 jbe ptx 4096 Nov 1 14:25 local_src<br />
drwxr-xr-x 3 jbe ptx 4096 Nov 1 14:25 projectroot<br />
drwxr-xr-x 2 jbe ptx 4096 Nov 1 14:25 protocol<br />
drwxr-xr-x 2 jbe ptx 4096 Nov 1 14:25 rules<br />
Notes about some of the files and directories listed above:<br />
ChangeLog Here you can read what has changed in this release.<br />
FAQ Some questions and some answers<br />
documentation This directory contains the Quickstart you are currenly reading in.<br />
configs This directory contains the platform specific configuration files for the Mini6410.<br />
projectroot Contains files and configuration for the target’s runtime. A running GNU/Linux system uses many<br />
text files for runtime configuration. Most of the time the generic files from the PTXdist installation will fit<br />
the needs. But if not, customized files are located in this directory.<br />
local_src Application sources especially related to the Mini6410.<br />
rules If something special is required to build the BSP for the target it is intended for, then this directory contains<br />
these additional rules.<br />
patches If some special patches are required to build the BSP for this target, then this directory contains these<br />
patches on a per package basis.<br />
protocol Contains the test protocol made for the release. Also known open issues if any.<br />
16
3 Building a root filesystem for the <strong>mini6410</strong><br />
3.2 Selecting a Userland Configuration<br />
First of all we have to select a userland configuration. This step defines what kind of applications will be built for<br />
the hardware platform. The OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0 comes with a predefined configuration<br />
we select in the following step:<br />
$ ptxdist select configs/ptxconfig<br />
info: selected ptxconfig:<br />
’configs/ptxconfig’<br />
3.3 Selecting a Hardware Platform<br />
Before we can build this BSP, we need to select one of the possible platforms to build for. In this case we want to<br />
build for the <strong>mini6410</strong>:<br />
$ ptxdist platform configs/platform-friendlyarm-<strong>mini6410</strong>/platformconfig<br />
info: selected platformconfig:<br />
’configs/platform-friendlyarm-<strong>mini6410</strong>/platformconfig’<br />
Note: If you have installed the OSELAS.Toolchain() at its default location, PTXdist should already have detected<br />
the proper toolchain while selecting the platform. In this case it will output:<br />
found and using toolchain:<br />
’/opt/OSELAS.Toolchain-2011.03/arm-1136jfs-linux-gnueabi/↵<br />
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin’<br />
If it fails you can continue to select the toolchain manually as mentioned in the next section. If this autodetection<br />
was successful, you can omit the step of the next section and continue to build the BSP.<br />
3.4 Selecting a Toolchain<br />
If not automatically detected, the last step in selecting various configurations is to select the toolchain to be used<br />
to build everything for the target.<br />
$ ptxdist toolchain /opt/OSELAS.Toolchain-2011.03/arm-1136jfs-linux-gnueabi/↵<br />
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin<br />
3.5 Building the Root Filesystem<br />
Now everything is prepared for PTXdist to compile the BSP. Starting the engines is simply done with:<br />
$ ptxdist go<br />
PTXdist does now automatically find out from the selected_ptxconfig and selected_platformconfig files which<br />
packages belong to the project and starts compiling their targetinstall stages (that one that actually puts the compiled<br />
binaries into the root filesystem). While doing this, PTXdist finds out about all the dependencies between<br />
the packages and builds them in the correct order.<br />
17
3 Building a root filesystem for the <strong>mini6410</strong><br />
While the command ptxdist go is running we can watch it building all the different stages of a package. In the<br />
end the final root filesystem for the target board can be found in the platform-<strong>mini6410</strong>/root/ directory and a<br />
bunch of *.ipk packets in the platform-<strong>mini6410</strong>/packages/ directory, containing the single applications the root<br />
filesystem consists of.<br />
3.6 Building an Image<br />
After we have built a root filesystem, we can make an image, which can be flashed to the target device. To do this<br />
call<br />
$ ptxdist images<br />
PTXdist will then extract the content of priorly created *.ipk packages to a temporary directory and generate an<br />
image out of it. PTXdist supports following image types:<br />
• hd.img: contains grub bootloader, kernel and root files in a ext2 partition. Mostly used for x86 target<br />
systems.<br />
• root.jffs2: root files inside a jffs2 filesystem.<br />
• uRamdisk: a barebox/u-boot loadable Ramdisk<br />
• initrd.gz: a traditional initrd RAM disk to be used as initrdramfs by the kernel<br />
• root.ext2: root files inside a ext2 filesystem.<br />
• root.squashfs: root files inside a squashfs filesystem.<br />
• root.tgz: root files inside a plain gzip compressed tar ball.<br />
• root.ubi: root files inside a ubi volume.<br />
The to be generated image types and addtional options can be defined with<br />
$ ptxdist platformconfig<br />
Then select the submenu “image creation options”. The generated image will be placed into<br />
platform-<strong>mini6410</strong>/images/.<br />
Only the content of the *.ipk packages will be used to generate the image. This means that files<br />
which are put manually into the platform-<strong>mini6410</strong>/root/ will not be enclosed in the image. If<br />
custom files are needed for the target, install them with PTXdist.<br />
18
4 How to Boot the Mini6410<br />
Various methods are exist to bring up the Mini6410. The main difference is if the Mini6410 can boot in a standalone<br />
manner or if it depends on some services from another host via network.<br />
To start the Mini6410 in a standalone manner it provides some local memory types to store the relevant software<br />
parts.<br />
• SD/MMC card memory is a nice and easy way to deploy the run-time relevant software parts at the development<br />
host and simply booting the Mini6410 with it.<br />
4.1 SD/MMC Card Memory<br />
The Mini6410 can boot from an SD/MMC card only. To make it work, all components to boot a target must be<br />
present on this card:<br />
• the bootloader. In our case the U-Boot-1.1.6<br />
• the U-Boot environment<br />
• the Linux kernel<br />
• the root filesystem for the kernel<br />
To make all components on the card co-exist, we need some tricks to do so. Main problem here is, the Samsung<br />
S3C6410 CPU has no clue about filesystems. Also the used U-Boot does not support filesystems in a regular<br />
fashion. This means the bootloader, its environment and the kernel form a binary blob on the disk at specific<br />
sectors.<br />
To prevent any filesystem operation later on from clobbering the binary blob on the disk, the binary blob area on<br />
disk should not part of any partition on the disk.<br />
It sounds complicated, but it isn’t. All required tools are part of this board support package. And all information<br />
we need to do it in the right way, are coming from the tools.<br />
After building the images with PTXdist we have several files:<br />
• platform-<strong>mini6410</strong>/images/u-boot.bin<br />
• platform-<strong>mini6410</strong>/images/linuximage<br />
• platform-<strong>mini6410</strong>/images/root.tgz<br />
The first step is to write the binary blob to the disk.<br />
If you follow these steps, all data on your SD card is lost! Ensure to use an empty card or with<br />
worthless data.<br />
We also will format this card with a Linux specific filesystem. Do not expect to be able to read<br />
the filesystem data from a non Linux system!<br />
19
4 How to Boot the Mini6410<br />
All changes on the SD card must be done as user root. Best way is to use the sudo command to<br />
only do the special commands with root permissions. PTXdist itself rejects to work as root!<br />
My host has no SD card socket, so I’m using a USB based card reader. That’s why the devices nodes of the card<br />
in the following examples are using SCSI names. Later on on the target the device node name will differ.<br />
In my system the device node for the SD card in the card reader is /dev/sdd, while my system disk<br />
is /dev/sda. If you are using autocompletion for file names, take care to not, not!, not!!!11F1!!<br />
clobber your system disk! As the shown commands are running as user root no warnings will<br />
occur!<br />
Assumed here is, the SD card is already inserted into the USB card reader and occurs as /dev/sdd. Replace the<br />
/dev/sdd with the name in your setup.<br />
To write the binary blob run:<br />
$ sudo platform-<strong>mini6410</strong>/sysroot-host/bin/<strong>mini6410</strong>-flasher /dev/sdd -b platform-<strong>mini6410</strong>/images/u-boot. ↵<br />
bin -k platform-<strong>mini6410</strong>/images/linuximage<br />
Writing bootloader part BL1 and BL2... Done<br />
Writing kernelimage... Done<br />
Summary:<br />
------------------------------------------------------------------------------<br />
block dev:<br />
/dev/sdd<br />
full sector count: 990976<br />
sector size:<br />
512 bytes<br />
card type:<br />
SD<br />
BL1 ’platform-<strong>mini6410</strong>/images/u-boot.bin’ 16 sectors beginning at sector 990958<br />
BL2 ’platform-<strong>mini6410</strong>/images/u-boot.bin’ 512 sectors beginning at sector 990190<br />
Kernel ’platform-<strong>mini6410</strong>/images/linuximage’ 11520 sectors beginning at sector 978670<br />
Take care: Last partition must end in sector 978669!<br />
Ready<br />
Note: Samsung calls their ROM based bootloader in the S3C6410 CPU BL0. This BL0 code loads a BL1. As the<br />
BL1 can only be up to 8 kiB in size, the BL1 codes finally loads the BL2. And the BL2 is the full blown bootloader<br />
without any restriction in size.<br />
The <strong>mini6410</strong>-flasher write the binary blob in the specific layout to the disk. And it presents one important<br />
number: The sector number the last partition must end on the SD card. In the example shown here this sector<br />
number is 978669. It’s the result of using a 512 MiB SD card. We must ensure to note this number for our SD card,<br />
as it differs from card to card. We need it in the next step.<br />
The next step is to partion the SD card and to ensure the partitions/filesystems do not conflict with the binary<br />
blob area.<br />
In this example only one partition is created. It’s sufficient to boot the Mini6410 from the SD card. If you want to<br />
create more partitions keep always in mind, the last partition must end at the sector the <strong>mini6410</strong>-flasher tool<br />
gives you!<br />
We run now the tool to partion the SD card and it will ’greet’ us:<br />
$ sudo /sbin/fdisk /dev/sdd<br />
Command (m for help):<br />
20
4 How to Boot the Mini6410<br />
First we change to the unit ’sectors’ instead cylinders (the default).<br />
Command (m for help): u<br />
Changing display/entry units to sectors<br />
Using sectors as the unit simplifies partition generation. Now we create the first and only partition on this SD<br />
card.<br />
Command (m for help): n<br />
Command action<br />
e extended<br />
p primary partition (1-4)<br />
p<br />
Partition number (1-4): 1<br />
First sector (61-990975, default 61):<br />
Using default value 61<br />
We can use the default here. But the next number is important:<br />
Last sector, +sectors or +size{K,M,G} (61-990975, default 990975):<br />
Here we must enter the number the tool <strong>mini6410</strong>-flasher has given us (adapt it to the number of your SD card):<br />
Last sector, +sectors or +size{K,M,G} (61-990975, default 990975): 978669<br />
Command (m for help): p<br />
Disk /dev/sdd: 507 MB, 507379712 bytes<br />
16 heads, 61 sectors/track, 1015 cylinders, total 990976 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
Disk identifier: 0xf3dfa864<br />
Device Boot Start End Blocks Id System<br />
/dev/sdd1 61 978669 489304+ 83 Linux<br />
Partition 1 does not end on cylinder boundary.<br />
Command (m for help):<br />
We can ignore the warning, since everyone is using sector numbers to read or write from or to a disk like media,<br />
no-one is interested in cylinders anymore (beside the fact, an SD card has no cylinders, nor heads).<br />
Last step is to write this new partition table to the SD card:<br />
Command (m for help): w<br />
The partition table has been altered!<br />
Calling ioctl() to re-read partition table.<br />
Syncing disks.<br />
On my system I have now /dev/sdd and /dev/sdd1. The layout on this SD card is now from the beginning up to<br />
sector 978669 used by a filesystem and from sector 978670 to the end used by the binary blob. Both can now<br />
co-exist. Using the <strong>mini6410</strong>-flasher again on this SD card (to update the kernel for example) will not destroy<br />
the filesystem. And any operation on the filesystem will not destroy the kernel nor the bootloader.<br />
Lets bring in some life into the filesystem area. But first the filesystem itself:<br />
21
4 How to Boot the Mini6410<br />
$ sudo /sbin/mkfs.ext2 /dev/sdd1<br />
mke2fs 1.41.10 (10-Feb-2009)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=1024 (log=0)<br />
Fragment size=1024 (log=0)<br />
Stride=0 blocks, Stripe width=0 blocks<br />
122400 inodes, 489304 blocks<br />
24465 blocks (5.00%) reserved for the super user<br />
First data block=1<br />
Maximum filesystem blocks=67633152<br />
60 block groups<br />
8192 blocks per group, 8192 fragments per group<br />
2040 inodes per group<br />
Superblock backups stored on blocks:<br />
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409<br />
Writing inode tables: done<br />
Writing superblocks and filesystem accounting information: done<br />
This filesystem will be automatically checked every 37 mounts or<br />
180 days, whichever comes first. Use tune2fs -c or -i to override.<br />
And now its content.<br />
$ sudo mount /dev/sdd1 /mnt<br />
$ sudo tar --directory=/mnt -xzf platform-<strong>mini6410</strong>/images/root.tgz<br />
$ sudo umount /mnt<br />
This SD card is now ready to boot the Mini6410.<br />
First we must switch off the Mini6410, insert the prepared SD card and moving the S2 into the ”SDBOOT” position.<br />
Then its time to switch on the Mini6410 again and see it booting from the SD card.<br />
BTW: LED3 is configured to signal accesses to the SD card.<br />
22
5 Special Notes<br />
5.1 Available Kernel Releases<br />
The predifined Mini6410 platform configuration always uses the latest Linux kernel release. If users want to stay<br />
with an older Linux kernel release, they are also available. Here is a list of currently available Linux kernel releases<br />
in the OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410-2011.11.0:<br />
• 3.1, (experimental)<br />
• 3.0, stable patch level 8 (default)<br />
• 2.6.39, stable patch level 4<br />
If we want to build the BSP with a non-default kernel release, we just run ptxdist platformconfig and change<br />
the kernel setting prior to building. As PTXdist checks the MD5 sums of the archives, we also have to change the<br />
MD5 sum of the corresponding kernel archive.<br />
Note: The MD5 sums for the kernels are (used by PTXdist):<br />
• 3.1: 8d43453f8159b2332ad410b19d86a931<br />
• 3.0: 398e95866794def22b12dfbc15ce89c0<br />
• 2.6.39: 1aab7a741abe08d42e8eccf20de61e05<br />
5.2 Available Userland Configuration<br />
The Mini6410 BSP comes with two different predefined userland configurations:<br />
• configs/ptxconfig: it is the standard one to get a small running embedded system. It can be used as a<br />
base for your own development running the Mini6410 headless (without an LCD unit).<br />
• configs/ptxconfig.qt: this configuration is intended for graphical usage of the Mini6410. It has the Qt<br />
library enabled and brings in a small Qt based application. This application will be started automatically<br />
at system’s startup, to show how to get a graphical system up and running.<br />
It’s up to you and your needs which configuration you may choose in section 3.2.<br />
5.2.1 Some details about the configs/ptxconfig.qt<br />
The mentioned small Qt based application we can find in local_src/qt4-demo-2011.07.0/. It can act as a template<br />
for our own Qt development.<br />
The ”secrets” how to build and install this application we can find in rules/qt4-demo.make and the corresponding<br />
menu file in rules/qt4-demo.in.<br />
23
5 Special Notes<br />
The ”magic” behind the autostart of this small Qt based application at system startup can be found in<br />
projectroot/etc/init.d/startup.<br />
Note: The small Qt demo is prepared to run on a landsscape 480 x 272 screen. If your screen differs from this<br />
setup, don’t expect a correct image.<br />
5.3 Framebuffer<br />
This driver gains access to the display via device node /dev/fb0. For this BSP the LCDN43-1020 (N43) display<br />
with a resolution of 480x240 is supported.<br />
A simple test of this feature can be run with:<br />
# fbtest<br />
This will show various pictures on the display.<br />
You can check your framebuffer resolution with the command<br />
# fbset<br />
NOTE: fbset cannot be used to change display resolution or colour depth. Depending on the framebuffer device<br />
different kernel command line may be needed to do this. Please refer to your display driver manual for details.<br />
5.4 GPIO<br />
Like most modern System-on-Chip CPUs, the S3C6410 has numerous GPIO pins. Some of them are inaccessible<br />
for the userspace, as Linux drivers use them internally. Others are also used by drivers but are exposed to<br />
userspace via sysfs. Finally, the remaining GPIOs can be requested for custom use by userspace, also via sysfs.<br />
Refer to the in-kernel documentation Documentation/gpio.txt for complete details how to use the sysfs-interface<br />
for manually exporting GPIOs.<br />
5.4.1 GPIO Usage Example<br />
When generic architecture GPIO support is enabled in the kernel, some new entries appear in sysfs. Everything<br />
is controlled via read and writable files to generate events on the digital lines.<br />
We find all the control files in /sys/class/gpio. In that path, there are a number of gpiochipXXX entries, with XXX<br />
being a decimal number. Each of these folders provide information about a single GPIO controller registered on<br />
the Mini6410 board, for example with gpiochip32:<br />
# ls /sys/class/gpio/gpiochip32<br />
base label ngpio subsystem uevent<br />
The entry base contains information about the base GPIO number and ngpio contains all GPIOs provided by this<br />
GPIO controller.<br />
We use GPIO34 as an example to show the usage of a single GPIO pin.<br />
# echo 34 > /sys/class/gpio/export<br />
24
5 Special Notes<br />
This way we export gpio34 for userspace usage. If the export was successful, we will find a new directory named<br />
/sys/class/gpio/gpio34 afterwards. Within this directory we will be able to find the entries to access the functions<br />
of this GPIO. If we wish to set the direction and initial level of the GPIO, we can use the command:<br />
# echo high > /sys/class/gpio34/direction<br />
This way we export GPIO34for userspace usage and define our GPIO’s direction attribute to an output with initially<br />
high level. We can change the value or direction of this GPIO by using the entries direction or value.<br />
Note: This method is not very fast, so for quickly changing GPIOs it is still necessary to write a kernel driver. The<br />
method shown works well, for example to influence an LED directly from userspace.<br />
To unexport an already exported GPIO, write the corresponding gpio-number into /sys/class/gpio/export.<br />
# echo 34 > /sys/class/gpio/unexport<br />
Now the directory /sys/class/gpio/gpio34 will disappear.<br />
Note: The GPIO34 is available at connector 6, pin 4 for measurement.<br />
The current usage of most of the pins can be read from the entry in /sys/kernel/debug/gpio.<br />
5.5 I²C Master<br />
The S3C6410 processor based Mini6410 supports a dedicated I²C controller onchip. The kernel supports this<br />
controller as a master controller.<br />
Additional I²C device drivers can use the standard I²C device API to gain access to their devices through this<br />
master controller. For further information about the I²C framework see Documentation/i2c in the kernel source<br />
tree.<br />
5.5.1 I²C Device AT24c04<br />
This device is a 512 bytes non-volatile memory for general purpose usage.<br />
This type of memory is accessible through the sysfs filesystem. To read the EEPROM content simply open() the<br />
entry /sys/bus/i2c/devices/0-0050/eeprom and use fseek() and read() to get the values.<br />
5.6 LEDs<br />
The LEDs on the Mini6410 can be controlled via the LED-subsystem of the Linux kernel. It provides methods<br />
for switching them on and off as well as using so-called triggers. For example, you could trigger the LED using a<br />
timer. That enables us to make it blink with any frequency we want.<br />
All LEDs can be found in the directory /sys/class/leds. Each one has its own subdirectory. We will use led4 for<br />
the following examples.<br />
For each directory, you have a file named brightness which can be read and written with a decimal value between<br />
0 and 255. The first one means LED off, the latter maximum brightness. Inbetween values scale the brightness if<br />
the LED supports that. If not, non-zero means just LED on.<br />
25
5 Special Notes<br />
/sys/class/leds/led4# echo 255 > brightness; # LED on<br />
/sys/class/leds/led4# echo 128 > brightness; # LED at 50% (if supported)<br />
/sys/class/leds/led4# echo 0 > brightness; # LED off<br />
LEDs can be connected to triggers. A list of available triggers we can get from the trigger entry<br />
/sys/class/leds/led4# cat trigger<br />
[none] nand-disk mmc0 mmc1 timer heartbeat backlight gpio<br />
The embraced entry is the currectly connected trigger to this LED.<br />
To change the trigger source to the timer, just run a:<br />
/sys/class/leds/led4# echo timer > trigger<br />
If the timer-trigger is activated you should see two additional files in the current directory, namely delay_on and<br />
delay_off. You can read and write decimal values there, which will set the corresponding delay in milliseconds.<br />
As an example:<br />
/sys/class/leds/led4# echo 250 > delay_on<br />
/sys/class/leds/led4# echo 750 > delay_off<br />
will blink the LED being on for 250ms and off for 750 ms.<br />
Replace timer with none to disable the trigger again. Or select a different one from the list read from the trigger<br />
entry.<br />
Refer to Documentation/leds/leds-class.txt in-kernel documentation for further details about this subsystem.<br />
5.7 MMC/SD Card<br />
The Mini6410 supports Secure Digital Cards and Multi Media Cards to be used as general purpose blockdevices.<br />
These devices can be used in the same way as any other blockdevice.<br />
These kind of devices are hot pluggable, so you must pay attention not to unplug the device<br />
while its still mounted. This may result in data loss.<br />
After inserting an MMC/SD card, the kernel will generate new device nodes in dev/. The full device can be reached<br />
via its /dev/mmcblk0 device node, MMC/SD card partitions will occur in the following way:<br />
/dev/mmcblk0pY<br />
Y counts as the partition number starting from 1 to the max count of partitions on this device.<br />
Note: These partition device nodes will only occur if the card contains a valid partition table (”harddisk” like<br />
handling). If it does not contain one, the whole device can be used for a filesystem (”floppy” like handling). In<br />
this case /dev/mmcblk0 must be used for formatting and mounting.<br />
The partitions can be formatted with any kind of filesystem and also handled in a standard manner, e.g. the mount<br />
and umount command work as expected.<br />
26
5 Special Notes<br />
5.8 SDIO Card<br />
This interface is available at connector CON9. Its feature is untested yet.<br />
5.9 Network<br />
The Mini6410 module has a DM9000 ethernet chip onboard, which is being used to provide the eth0 network<br />
interface. The interface offers a standard Linux network port which can be programmed using the BSD socket<br />
interface.<br />
5.10 Touchscreen<br />
A simple test of this feature can be run with:<br />
# ts_calibrate<br />
to calibrate the touch and with:<br />
# ts_test<br />
to run a simple application using this feature.<br />
To see the exact events the touch generates, we can also use the evtest tool.<br />
# evtest /dev/input/event1<br />
Input driver version is 1.0.1<br />
Input device ID: bus 0x19 vendor 0xdead product 0xbeef version 0x102<br />
Input device name: ”S3C24XX TouchScreen”<br />
Supported events:<br />
Event type 0 (Sync)<br />
Event type 1 (Key)<br />
Event code 330 (Touch)<br />
Event type 3 (Absolute)<br />
Event code 0 (X)<br />
Value 0<br />
Min 0<br />
Max 1023<br />
Event code 1 (Y)<br />
Value 0<br />
Min 0<br />
Max 1023<br />
Testing ... (interrupt to exit)<br />
Whenever we touch the screen this tool lists the values the driver reports.<br />
5.10.1 If the Touchscreen does not work<br />
A functional touchscreen depends on some external configurations and parameters. Firstly, the touchscreen<br />
driver for the S3C6410CPU must be enabled in the kernel. If it is supported, it can be checked at run-time with<br />
the following command:<br />
27
5 Special Notes<br />
# ls /sys/bus/platform/drivers<br />
A samsung-ts must be listed in this directory. If not, the kernel must be re-configured to support this device.<br />
Secondly, a functional touchscreen depends on is the registered touchscreen device. If it is registered, this can<br />
be checked at run-time with this command:<br />
# ls /sys/bus/platform/devices<br />
A samsung-ts must be listed in this directory. If not, something is preventing the kernel from registering this<br />
device.<br />
5.10.2 If the Touchscreen does not work as expected<br />
It’s not easy to create a touchscreen driver that works with all kinds of touchscreens. They differ in their hardware<br />
parameters, so most of the time some adaptions must be done to get better results.<br />
Two locations exists where parameters can be changed:<br />
• in the kernel driver<br />
• in the tslib (touchscreen library)<br />
The tslib is a userland component and can be changed at any time. The kernel driver is a compiled in component,<br />
so the kernel must be re-built and re-started to make any change visible.<br />
Lets start with the kernel driver: It uses three parameters to support the physical behaviour of the touchscreen.<br />
• .delay a delay counted in clocks of 3.68 MHz between the measurement of the X and Y coordinate. If the<br />
touchscreen lines are filtered with a low-pass it could be useful to increase this value. Max value is 0xffff.<br />
• .presc clock prescaler for the AD converter. The larger the value is, the lower the AD converter works<br />
(FIXME: Seems not be used)<br />
• .oversampling_shift defines the samples to be measured and to be averaged before reporting a coordinate.<br />
’0’ means one sample per report, ’1’ means two samples per report, ’2’ means 4 samples and so<br />
on.<br />
To modify the setting, open the file platform-<strong>mini6410</strong>//build-target/linux-3.0/arch/arm/mach-s3c64xx/mach-<strong>mini6410</strong>.c<br />
and search for the s3c_ts_platform structure. It looks like this:<br />
static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {<br />
.delay = 10000,<br />
.presc = 49,<br />
.oversampling_shift = 2,<br />
};<br />
After modifying, the kernel must be re-built:<br />
$ ptxdist drop kernel compile<br />
$ ptxdist go<br />
These steps ensure the modified sources are re-compiled. Use this new kernel and do the tests with the touchscreen<br />
again.<br />
To change the userland tslib this can be done at run-time of the Mini6410. Just modify the /etc/ts.conf.<br />
28
5 Special Notes<br />
• module_raw input means the tslib uses the raw data from the Linux’s input system<br />
• module pthres pmin=1 means the minimal pressure must be ’1’ to count as a touchscreen event. Other<br />
values do not make sense yet, as the driver does not support pressure measurement<br />
• module variance delta=30 FIXME<br />
• module dejitter delta=10 FIXME<br />
• module linear FIXME<br />
After changing one of these entries a run of ts_test can show if the new settings are better than the previous<br />
ones.<br />
Some display units with touchscreen support for the Mini6410 are using a OneWire interface to<br />
control the touchscreen. These kind of display units are not supported by this board support<br />
package.<br />
5.11 LCD Backlight<br />
The backlight of the LCD can be controlled via the sysfs entry in:<br />
/sys/class/leds/backlight/<br />
To switch it off, just write a ’0’ into its brightness entry:<br />
# echo 0 > /sys/class/leds/backlight/brightness<br />
and a ’1’ to switch it on again:<br />
# echo 1 > /sys/class/leds/backlight/brightness<br />
5.12 ADC<br />
Getting the digital equivalent of one of the analogue input channels can be done by reading the corresponding<br />
entries in the sysfs.<br />
For example the analogue input channel 0 on the Mini6410 is connected to the potentiometer W1. By reading the<br />
entry /sys/devices/platform/s3c64xx-adc/s3c-hwmon/in0_input we can watch the different digital values while<br />
turning the potentiometer W1.<br />
Note: The analogue input channels 4 ... 7 are occupied by the touchscreen feature and can only be used as simple<br />
analogue inputs if the touchscreen feature is disabled.<br />
5.13 Keypad<br />
Using the up to 6 available key buttons on the Mini6410 in a reqular manner requires a working console in the<br />
kernel. Here the list of the current key codes they generate when pressed:<br />
29
5 Special Notes<br />
• K1, code ’F1’<br />
• K2, code ’F2’<br />
• K3, code ’F3’<br />
• K4, code ’F4’<br />
• K5, code ’F5’<br />
• K6, code ’F6’<br />
• K7, code ’F7’<br />
• K8, code ’F8’<br />
If one wants to change the generated codes, she/he can change it in the platform code found in<br />
arch/arm/mach-s3c64xx/mach-<strong>mini6410</strong>.c, specially in the array <strong>mini6410</strong>_buttons.<br />
If the key buttons are working as expected, can also be checked without a working console with the following<br />
command:<br />
# evtest /dev/input/event0<br />
Input driver version is 1.0.1<br />
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100<br />
Input device name: ”gpio-keys”<br />
Supported events:<br />
Event type 0 (Sync)<br />
Event type 1 (Key)<br />
Event code 59 (F1)<br />
Event code 60 (F2)<br />
Event code 61 (F3)<br />
Event code 62 (F4)<br />
Event code 63 (F5)<br />
Event code 64 (F6)<br />
Event code 65 (F7)<br />
Event code 66 (F8)<br />
Testing ... (interrupt to exit)<br />
5.14 Get the latest BSP Release for the Mini6410<br />
Information and the latest release of the Mini6410 BSP can be found on our website at:<br />
http://www.oselas.org/oselas/bsp/index_en.html<br />
5.15 Be Part of the Mini6410 BSP Development<br />
If you want to use the latest and greatest board support package for the Mini6410 you can use the git repository<br />
as your working source, instead of a release archive.<br />
The git repository can be found here:<br />
http://git-public.pengutronix.de/git-public/OSELAS.BSP-<strong>Pengutronix</strong>-Mini6410.git<br />
If you want to contribute to this project by sending patches, these patches should always be based on the master<br />
branch of this repository.<br />
30
6 Document Revisions<br />
2011/07/12 Initial Revision<br />
2011/10/30 Add the how to boot the Mini6410 from SD card<br />
2011/10/30 Add the special notes how to use some features of the Mini6410<br />
×<br />
31
7 Getting help<br />
Below is a list of locations where you can get help in case of trouble. For questions how to do something special<br />
with PTXdist or general questions about Linux in the embedded world, try these.<br />
7.1 Mailing Lists<br />
7.1.1 About PTXdist in Particular<br />
This is an English language public mailing list for questions about PTXdist. See<br />
http://www.pengutronix.de/mailinglists/index_en.html<br />
on how to subscribe to this list. If you want to search through the mailing list archive, visit<br />
http://www.mail-archive.com/<br />
and search for the list ptxdist. Please note again that this mailing list is just related to the PTXdist as a software.<br />
For questions regarding your specific BSP, see the following items.<br />
7.1.2 About Embedded Linux in General<br />
This is a German language public mailing list for general questions about Linux in embedded environments. See<br />
http://www.pengutronix.de/mailinglists/index_de.html<br />
on how to subscribe to this list. Note: You can also send mails in English.<br />
7.2 About Working on the Linux Kernel<br />
The book Linux Kernel in a Nutshell from Greg Kroah-Hartman. Its online version can be read here:<br />
http://www.kroah.com/lkn/<br />
7.3 Chat/IRC<br />
About PTXdist in particular<br />
irc.freenode.net:6667<br />
Create a connection to the irc.freenode.net:6667 server and enter the chatroom #ptxdist. This is an English<br />
room to answer questions about PTXdist. Best time to meet somebody there is at European daytime.<br />
32
7 Getting help<br />
7.4 <strong>FriendlyARM</strong> <strong>mini6410</strong> specific Mailing List<br />
oselas@community.pengutronix.de<br />
This is a community mailing list open for everyone for all <strong>mini6410</strong>’s board support package related questions.<br />
Refer our page at<br />
http://www.pengutronix.de/mailinglists/index_en.html<br />
to subscribe to this mailing list.<br />
Note: Please be aware that we cannot answer hardware only related questions on this list.<br />
7.5 Commercial Support<br />
You can order immediate support through customer specific mailing lists, by telephone or also on site. Ask our<br />
sales representative for a price quotation for your special requirements.<br />
Contact us at:<br />
<strong>Pengutronix</strong><br />
Peiner Str. 6-8<br />
31137 Hildesheim<br />
Germany<br />
Phone: +49 - 51 21 / 20 69 17 - 0<br />
Fax: +49 - 51 21 / 20 69 17 - 55 55<br />
or by electronic mail:<br />
sales@pengutronix.de<br />
33
This is a <strong>Pengutronix</strong> Quickstart Manual<br />
Copyright <strong>Pengutronix</strong> e.K.<br />
All rights reserved.<br />
<strong>Pengutronix</strong> e.K.<br />
Peiner Str. 6-8<br />
31137 Hildesheim<br />
Germany<br />
Phone: +49 - 51 21 / 20 69 17 - 0<br />
Fax: +49 - 51 21 / 20 69 17 - 55 55