From Ronetix's Wiki
Revision as of 08:52, 8 October 2021 by Ilko (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PM9261 User's Manual and Schematics

The User's Manual and the schematics of PM9261 can be found here:

Before you start

The instructions in this document are meant to be done under GNU/Linux environment.

Connecting to the board

A serial terminal connection through RS-232 null modem cable is needed to control U-Boot and GNU/Linux.

To set up U-Boot run time a serial terminal connection must be used, this is the only way you can get access to the U-Boot command line. The Linux boot messages are transmitted to the same serial connection.

The Serial Debug interface is set to 115200 bps with 8 data bits, one stop bit and no parity. Use the screen command like this

"screen /dev/ttyS0 115200 cs8,-cstopb,-parenb"




As tftp or ftp servers are needed call your system/network administrator to give you the settings. The IP address can be obtained using DHCP service or set static IP.

After the IP address is set and know, a link to the board running GNU/Linux can be made with telnet.



The GNU Toolchain, is a combination of multiple projects:

GCC stands for "GNU Compiler Collection". GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Java, Fortran, and Ada.
GNU Binutils are a collection of binary tools. The main ones are: the GNU linker (ld) and the GNU assembler (as).
GNU debugger, allows you to see what is going on `inside’ another program while it executes -- or what another program was doing at the moment it rashed.

GNU toolchain notes

The pre-built GNU toolchains can be found

The Linux kernel reqires a minimal GCC version in order to compile. To check that minimal version take a look at the README file in the Linux source directory.
U-Boot can not be compiled with some toolchains because of (E)ABI conformation. The USE_PRIVATE_LIBGCC parameter allows the usage of different run-time support library(libgcc.a). More on using this parameter see README in U-Boot source

Download and install the GNU toolchain

Installation of "KaeilOS v2010.1 SDK"

This is SDK produced by OpenEmbedded recipes. It includes and package management system opkg. It includes development sources form the packages in KaeilOS. Download the two files and extract them in the "/" directory. They could be extracted in any directory, and then the file "<work directory>/usr/local/kaeilos/arm/environment-setup" have to be edited and prefix the "SDK_PATH" value with the "work directory". And also remove the line which sets the CPATH environment.

Before compiling execute:

$ . <work directory>/usr/local/kaeilos/arm/environment-setup

The toolchain prefix is "arm-oe-linux-gnueabi-".

$ wget
$ wget
$ su -
$ tar -C / -xjf kaeilos-2010.1-20110221-i686-linux-armv5te-linux-gnueabi-toolchain-extras.tar.bz2 
$ tar -C / -xjf kaeilos-2010.1-20110221-i686-linux-armv5te-linux-gnueabi-toolchain.tar.bz2
$ exit
$ . /usr/local/kaeilos/arm/environment-setup
$ echo '#include <stdio.h>
int main(int argc, char** argv) {
   printf("Hello World!\n");
   return 0;
 ' > hello.c
$ arm-oe-linux-gnueabi-gcc hello.c -o hello

The rest of the toolchains

The toolchains will be installed in the /usr/cross directory.

$ wget
$ su -
$ cd /
$ tar xvfj ronetix-arm-linux-4.3.3.tar.bz2
$ exit

Setup the path:

$ export PATH=/usr/cross/arm-linux-4.3.3/bin:$PATH


Short introduction

U-BOOT is used for basic initialization of the PM9261 boards and for loading and starting an Operating system or an user application. The loading can be done via the various FLASH devices or the Ethernet.

U-BOOT supports the following devices on the PM9261 board:

  • NOR Flash
  • Dataflash
  • NAND flash
  • Ethernet
  • LCD
  • USB

Download and install the U-BOOT

PM9261 is supported by the mainline U-BOOT.

Alternatively, u-boot-2010.09 + patches can be used.

Get U-Boot as tar.bz2

$ wget
$ tar xjf u-boot-2010.09.tar.bz2
$ mv u-boot-2010.09 u-boot
$ cd u-boot
$ git init
$ git add *
$ git add .gitignore
$ git commit -m "U-Boot v2010.09"
$ git checkout -b v2010.09-pm9261
$ cd ..

Get U-Boot with git clone

For easy code management(trace and history of changes, patch submit and so) it is good to use revision control(in this case GIT). To get U-Boot using git, if you prefer tar.bz2 skip getting U-Boot using git.

$ git clone git:// u-boot
$ cd u-boot
$ git checkout -b v2010.09-pm9261 v2010.09
$ cd ..

Apply the provided patches

$ wget
$ tar xjvf u-boot-patches-bb9g45-v2010.09.tar.bz2
$ cd u-boot
$ for N in ../u-boot-patches-bb9g45-v2010.09/*.patch ;do git am $N ; done


The U-Boot configuration files named as the respective Ronetix CPU modules are:

  • include/configs/pm9g45.h
  • include/configs/pm9263.h
  • include/configs/pm9261.h

The definitions in these header files are explained in the README file in the U-Boot source.

If needed set the lines for the network interface as show. In the config files only the ETHADDR is set, the rest parameters can be obtained runtime in the U-Boot prompt by invoking the command "dhcp".

#define CONFIG_ETHADDR		02:00:00:FE:ED:01
#define CONFIG_OVERWRITE_ETHADDR_ONCE /* Read Using it! */

These parameters can be modified later and set to a environment variables, except "ethaddr".

If you do not want LCD support, comment as shown:

/* No need of LCD
* #define	CONFIG_LCD			1

You may leave the configs as they are, test and then change as needed.

Configure and build

$ make pm9261_config

The common part for all boards:

$ export CROSS_COMPILE=arm-oe-linux-gnueabi-
$ export ARCH=arm
$ make

The binary file for programming is u-boot.bin, and the u-boot is the elf file.

When building U-Boot, the mkimage is also build. This utility is needed to wrap zImage(Linux kernel) for booting by U-Boot, so put it in a place mentioned by PATH environment.

Programming U-Boot for PM9261

The file u-boot.bin must be programmed in the FLASH at address 0x10000000. The environment of U-Boot is at address 0x10040000.


peedi> flash set 0	; select the first flash profile
peedi> flash program u-boot.bin bin 0x10000000 erase

Using U-Boot

u-boot> tftp 0x20020000 u-boot.bin
u-boot> erase 0x10000000 +${filesize}
u-boot> cp.b 0x20020000 0x10000000 ${filesize}

Linux kernel

Getting and unpacking the Linux kernel for PM9261

For Linux kernel

$ wget
$ wget
$ wget
$ wget
$ tar xjvf linux-
$ cd linux-
$ patch -p1 < ../2.6.25-at91.patch
$ patch -p1 < ../linux-
$ patch -p1 < ../socketcan-driver-at91.patch

Kernel config

$ make pm9261_defconfig		# SPI support for MMC/SD


$ make pm9261_mci_defconfig	# MCI support for MMC/SD

If you want to change something in the kernel do the following:

$ make menuconfig

If you have a 16-bit NAND Flash, select:

System type -> Atmel AT91 System-on-Chip -> Enable 16-bit data bus interface to NAND flash

To determine what kind of NAND Flash chip do you have, look at the bottom side of the CPU board:

  • U5 - MT29F2G16 - 16-bit NAND Flash
  • U9 - MT29F2G08 - 8-bit NAND Flash

On exit save the changes.

Kernel build

uImage is the Linux kernel packed(U-Boot wrapped zImage) in format for loading by U-Boot. The "mkimage" utility which is part of U-Boot is required to be in the executable search path(environment variable PATH).

The "mkimage" can be taken from or obtained after building U-Boot for an ARM board.

$ echo Make sure "mkimage" is in the executable search path!
$ export CROSS_COMPILE=arm-oe-linux-gnueabi-
$ make uImage

The binary file for programming is arch/arm/boot/uImage.

Programming of the Kernel for PM9261


peedi> flash set 1	; select the second flash profile
peedi> flash program

Using U-BOOT

u-boot> tftp 20020000 vmImage.bin
u-boot> cp.b 20020000 10050000 $(filesize)



First you need to prepare your host Linux distribution in order to be able to get and build KaeilOS. A list of required packages for variety of host distributions is described in:

Lets prepare directory structure. Login on your host as ordinary user not as root(root privileges are not needed and a good practice is to avoid being root if not needed). You can login as a user you like. Starting point is being in the home directory. You may choose working directory at your decision, but be aware of the paths.

Make directory for doing things and go to it:

$ cd
$ mkdir -p usr/src/oe
$ cd usr/src/oe

Now it is time to get bitbake - the building tool. All thing here are done with bitbake version 1.10.2. And don't install bitbake globally, install it as a sibling directory of openembedded/ and build/.

$ git clone git://
$ cd bitbake
$ git pull
$ git checkout -b _tag_1.10.2 1.10.2

Getting openembedded - meta data, packages, relations and more

Get it, go to directory openembedded/ and update.

$ git clone git://
$ cd openembedded
$ git pull

Now you have the development branch of openembedded master. The branch is depreciated. Check that you are in development branch.

$ git branch
* master

As the OE is developing continuously sometimes the OE can not be build successfully so you can keep updating OE untill it builds or use a build verified state(commit).

Keep updating

After git-clone create a branch and try to build images with it. If the building is successful keep the branch, but if building is unsuccessful keep pulling until you get a working OE commit, or you can try to fix the problem.

$ git checkout -b dev_snapshoot  # Switched to a new branch "dev_snapshoot"
$ git pull origin master:dev_snapshoot

Use a verified state That state can be found here It is good to to make a branch after cloning.

$ git checkout -b state_070cbda
$ git reset --hard 070cbda8e9c073c8fd3b89d2a4c49acbc7fb7918 FIX:

This is last verified commit.

Commit date: FIX: Build date: FIX:

Warning: even the tested OpenEmbedded/Bitbake metadata state after "some" time can not produce the desired images, due to URL sources are not available, most probably a new version, and the old one is removed. Example of this is missing live.2010.10.15.tar.gz from recipe Also there is recipes referring to a source in a svn, git or other repositories, which at the build time could be with broken sources like mplayer.

Get KaeilOS settings and configuration files

$ wget
$ tar xzvf kaeilos-4.05-config-files.tgz

Get recipe file and save it in $OEBASE/openembedded/recipes/images:

$ wget -O openembedded/recipes/images/

Edit the files listed below so that they contains the correct paths. Use the absolute path: in file correct BB_DIR to point to $OEBASE/btibake/ and OE_DIR to point to $OEBASE/openembedded/ Also in the same file( make it looks like:

--- part of lines 16:29 ---
echo "Preparing KaeilOS build environment ver." $SETUP_KAEILOS_VER
cd $BB_DIR 
# Bitbake not anymore in svn repository, not it is git one.
echo "Checking bitbake"
##svn cleanup
##svn update
git branch
cd $OE_DIR
# Do not pull, use the present state and if needed chnage manualy.
echo "Checking OpenEmbedded"
##git pull
git branch
cd $HERE
cd $1
--- part of lines 16:29 ---
  • in build/kaeilos/conf/auto.conf you can select the machine to

build KaeilOS for. The default machine is "ronetix-pm9263", to build for pm9g45 change the name "ronetix-pm9263" to "ronetix-pm9g45", and if the case is pm9261 use "ronetix-pm9261"

  • in build/kaeilos/conf/local.conf change DEPLOY_DIR_PSTAGE to

point to "$OEBASE/build/kaeilos/tmp/pstage/", and if you work in a screen session leave the three lines below "# Enable devshell with screen and bash", in the other case comment these three lines. And please don't comment sending automatic reports.

--- part of build/kaeilos/conf/local.conf lines 23:33 ---
# Enable devshell with screen and bash
#SCREEN_TERMCMD = 'screen -D -m -t "$TERMWINDOWTITLE" -s /bin/bash'

# Enable this to send automatic success and failure reports
INHERIT += "oestats-client"
OESTATS_BUILDER = "kaeilos-user"
--- part of build/kaeilos/conf/local.conf lines 23:33 ---
  • in the above file change the DISTRO parameter form "kaeilos" to "kaeilos-2010"
  • also remove "ext2" parameter in IMAGE_FSTYPES
  • in build/kaeilos/conf/site.conf correct DL_DIR to become "$OEBASE/sources/" and correct BBFILES = "$OEBASE/openembedded/recipes/*/*.bb"

Initial building of the system

You should be in $OEBASE directory. Running this command for the first time will take a some hours to finish:

$ source /home/ivan/usr/src/oe/build/kaeilos
$ bitbake custom-extra-image

Warning: is recipe example, it is useful to to demonstrate how to add stuff you like/want. It is build-able with the OpenEmbedded/Bitbake latest metadata state mentioned at "2. Getting openembedded - meta data, packages, relations and more". Doe to continuous change/improvement of OE there could be a time when some packages included in the are not build-able, and the items in the have to be adopted. The "x11-image", "console-image" and "console-base-image" are general for OE.

Warning: even the tested OpenEmbedded/Bitbake metadata state after "some" time can not produce the desired images, due to URL sources are not available, most probably a new version, and the old one is removed. Example of this is missing live.2010.10.15.tar.gz from recipe Also there is recipes referring to a source in a svn, git or other repositories, which at the build time could be with broken sources like mplayer.

This initial system building is to let the OpenEmbedded build the system as it is by default, and later you can customize it.

Note that toolchains installation is not required as the OE makes it. There is an option to tell OE to use external toolchains.

Kernel configuring

Go to $OEBASE/build/kaeilos to configure and build your linux kernel:

$ cd $OEBASE/build/kaeilos
$ bitbake virtual/kernel -c menuconfig

Kernel building

Next comes to compile, populate stage directory, install the kernel. Executing these task will compile kernel and modules, make head files to be in the stage directory and finally copy kernel and modules to $DEPLOY directory.

$ bitbake virtual/kernel -c compile -f
$ bitbake virtual/kernel

RootFS building

To create RootFS go to $OEBASE/build/kaeilos:

$ cd $OEBASE/build/kaeilos
$ bitbake custom-extra-image

The RootFS image is in the $DEPLOY directory. This is the image you should program into the NAND Flash of PM9261:


Export SDK

Creating a toolchain(SDK) is the same as creating a rootfs image. From the $OEBASE directory:

$ source /home/ivan/usr/src/oe/build/kaeilos
$ bitbake meta-toolchain

and the resulted SDK is in $DEPLOY directory.

For reference:

ROOTFS programming into the NAND flash for PM9261

Note:The Linux kernel scans the whole RootFs partition, to create the JFFS2 file system summary, and if on that partition there are blocks from the older root file system, the new one could not be mounted properly and most probably will fail. So erase the whole Linux RootFs partition on NAND (MTD partition). PEEDI is not aware of MTD partitions, so erase the that partition size from the start of it. This applies for U-Boot, too.


peedi> flash set 2
peedi> flash erase
peedi> flash program

Using U-BOOT

Caution: the RootFS image larger than 62MiB can't be programmed by U-BOOT, because it doesn't fit in the SDRAM.

u-boot> nand erase clean
u-boot> tftp 0x20020000 rootfs.jffs2	; the image should less than 62MiB
u-boot> nand write.jffs2 0x20020000 0 ${filesize}

Tips and tricks

In /etc/defaul/psplash add "--angle 90" in psplash arguments variable, so that splash screen is rotated properly.

Enable/Disable mouse pointer in X

In /etc/matchbox/session find the line starting with "exec matchbox-window-manager" and change to "-use_cursor no" or to "-use_cursor yes" to hide or show mouse pointer.

To rotate X display properly you can execute this from the command line

A. KDrive (now obsolete)

$ sed -i '/case `module_id` in/ a\
"Ronetix PM9261" | "Ronetix PM9261/BB9261" | "Ronetix PM9263" | \\\
"Ronetix PM9263/BB9261" | "Ronetix PM9263/BB9263") \
ARGS="$ARGS -rgba bgr -screen 240/54x320/81@90x16" ;;
' /etc/X11/Xserver

B. Xorg Take a look at /etc/X11/xorg.conf in Section "Device", and add or change the Option "Roatate", like this:

Option          "Rotate" "CCW"

Adjusting touchscreen axes, in 'Section "InputDevice"' modify or add:

Option          "SwapAxes" "True"
Option          "InvertX" "True"
Option          "InvertY" "True"

Getting eth0 gateway parameter from dhcp

In /etc/network/interface add "iface eth0 inet dhcp" before "iface eth0 inet static" line.

Form the command line call "udhcpc" or "dhclient eth0" to set network through DHCP server.

Calibrating the touchscren

In Kdrive the "xtscal" is used, but in Xorg "ts_calibrate" is used.

A. In the first running of Linux, GPE login screen is preceded by touch screen calibration. B. To calibrate the screen in the login prompt touch randomly on the screen, from 30 second to 1 minute and the calibration screen will appear again. C. From a terminal using keyboard on USB port, run "xtscal" D. Form Settings/Screen Setting press the "start" button in the calibration section.


Compiling a simple GNU/Linux application

Create a text file example.c with contents:

--- example.c ---
#include <stdio.h>
int main(int argc, char** argv){
  printf("Hello world\n");
  return 0;
--- example.c ---

Compiling: Substitute "arm-oe-linux-gnueabi-gcc" with the toolchain used to build kernel and root file system utilities.

$ arm-oe-linux-gnueabi-gcc -o example example.c

The result is the ELF file called "example".

Transferring the executable file from the PC to the target

Using USB stick

The simples way is to use a USB stick - just copy the file example to a USB stick inserted into your PC. Unmount the stick and put it into the target board. After few seconds the USB stick will be discovered(most probably). You should have support of the file system on the USB stick, most probably it will be VFAT(FAT32). Take a look at the kernel messages to see the device node of your USB stick.

Depending auto-mounter is enabled and installed on the rootfs, the USB stick could be automatically mounted. To see if it is automatically mounted:

On target machine mount /dev/sda1 on /media/sda1

In case it is not mounted automatically:

On target machine:

$ mkdir /mnt/sda1
$ mount /dev/sda1 /mnt/sda1 -t vfat
$ cp /mnt/sda1/main .
$ chmod +x main
Hello world

Tftp over network

A tftp server should work on a host(or any development) computer.

On host:

$ cp hello tftp_boot_dir/

On target machine:

$ udhcpc
$ tftp -g -r tftp_boot_dir/hello -l hello
$ chmod u+x hello
$ ./hello
Hello world

Alternatively to the "udhcpc" you can use "dhclient eth0".

Kernel debugging

The board should be programmed with the u-boot and the binary version of the kernel.

Start gdb/insight:

$ arm-oe-linux-gnueabi-gdb vmlinux

In the console window:

(gdb) target remote peedi_ip:2000
(gdb) set $pc = 0x10000040	; the u-boot is flashed at 0x10000000 (after remap)
(gdb) c

The board is running: first starts the u-boot, then the Linux kernel. If you have a serial console you can see that the Linux is working. Now you can halt the kernel and set breakpoints where you want.

If you want to have a breakpoint before the kernel is running you have to do the following:

(gdb) target remote peedi_ip:2000
(gdb) set $pc = 0x10000040	; assuming the u-boot is flashed at 0x10000000
(gdb) hbreak start_kernel	; hardware breakpoint is used because the MMU is still not active
(gdb) c

The board is running (u-boot, then the kernel) and will stop at the start_kernel function.

(gdb) delete	; delete the hardware breakpoint.

Now you can use the software breakpoints.

PM9261 pre-built images

Linux Kernel