I have chosen Debian for the operating system of choice to load on the embedded hardware because of my prior experience with it and because it is a free distribution that continues to be actively maintained and supported.
Linux is a powerful operating system and is valuable on an embedded hardware platform for real-time applications.
An example is real-time digital signal processing. Alternatives to Debian include Montavista and Wind River, which are both commercial Linux distributions.
1. Description of the hardware
The hardware is a custom digital signal processing printed circuit board which includes a PPC440EPx embedded processor and five Xilinx Virtex 5 Field Programmable Gate Arrays (FPGAs).
The PPC440EPx was designed with an RS-232 interface, a JTAG debug and flash programming interface, 2 Gigabit Ethernet interfaces, and one status LED.
Initially, the system is completely bare of software and contains no operating system. The goal is to bring up Debian Linux on this embedded hardware platform, and the same process applies to most embedded platforms.
2. Compiling the custom bootloader (uboot) and Linux kernel
The bootloader is a small program that is used to load the operating system. Popular bootloaders include the IBM PowerPC Initialization and Boot Software (PIBS) and the U-Boot Universal Bootloader from DENX.
In this example, U-boot was used. The board was designed with a JTAG interface to the PPC440EPx. An Abatron BDI debugger can be used to load U-boot and associated environmental variables onto the Flash using the JTAG interface.
In this system, the Flash is a Mirrorbit. The U-boot source is available from DENX. In the include/configs directory is sequoia.h, which includes detailed configuration information about the system clock, Flash, base addresses, serial ports, ethernet ports, and usb ports.
This file is specific to the Sequoia reference board and will require modification based on the actual system. Recompilation of u-boot was necessary.
A standard Debian Linux filesystem was used along with a custom version of the Linux DENX kernel (linux-2.6.25-svn1995-dirtyxx).
The latest version of DENX Linux can be obtained from git.denx.de. Please note that DENX support for sequoia was started during development of the 2.6.19 kernel.
Most of the relevant configuration is handled by arch/ppc/configs/sequoia_defconfig. This file was modified for the current system and the Linux kernel was recompiled using DENX’s Embedded Linux Development Kit (ELDK).
3. Programming Flash memory with the bootloader (uboot)export ARCH=ppc
export CROSS_COMPILE=ppc_4xxFP-
PATH=$PATH:/opt/eldk/usr/bin:/opt/eldk/bin
make sequoia_defconfig
make menuconfig
make uImage
The Abatron must be configured for the intended processor (in this case, PPC440EPx) using a configuration file.
This file includes information about the translation lookaside buffer (TLB), the caches, the peripheral bus configuration registers, the type of Flash, the target CPU type, and the Abatron’s host.
In this example, the bdi configuration file for the AMCC 440EPx “Sequoia” reference board (evkit440epx.cfg) was used as a starting point and modified based on differences between the “Sequoia” reference and the actual system.
The most common modifications will likely be to the host section. If this section is correct, you should be able to power up the Abatron, telnet to it from your host, and get a prompt back.
Connect the Abatron JTAG to the system’s JTAG and at the Abatron prompt, erase the flash and program U-Boot and its associated environmental variables.
If you are connected to the system’s serial console, you will now see U-Boot come up. Interrupt the autoboot to gain access to the U-Boot command line.440EPX>reset
440EPX>erase440EPX>prog 0xfff60000 env.bin
Programming env.bin , please wait ....
Programming flash passed
440EPX>prog 0xfffa0000 u-boot.bin
Programming u-boot.bin , please wait ....
Programming flash passed
440EPX>md 0xfffa0000
fffa0000 : 27051956 552d426f 6f742032 3030392e '..VU-Boot 2009.
fffa0010 : 30382028 53657020 31372032 30303920 08 (Sep 17 2009
fffa0020 : 2d203137 3a30373a 31332900 00000000 - 17:07:13).....
fffa0030 : 00000000 00000000 00000000 00000000 ................
fffa0040 : 00000000 00000000 00000000 00000000 ................
fffa0050 : 00000000 00000000 00000000 00000000 ................
fffa0060 : 00000000 00000000 00000000 00000000 ................
fffa0070 : 00000000 00000000 00000000 00000000 ................
fffa0080 : 00000000 00000000 00000000 00000000 ................
fffa0090 : 00000000 00000000 00000000 00000000 ................
fffa00a0 : 00000000 00000000 00000000 00000000 ................
fffa00b0 : 00000000 00000000 00000000 00000000 ................
fffa00c0 : 00000000 00000000 00000000 00000000 ................
fffa00d0 : 00000000 00000000 00000000 00000000 ................
fffa00e0 : 00000000 00000000 00000000 00000000 ................
fffa00f0 : 00000000 00000000 00000000 00000000 ................440EPX>reset
440EPX>go
4. Booting into LinuxU-Boot 2009.08 (Nov 16 2009 - 15:54:12)
CPU: AMCC PowerPC 440EPx Rev. A at 533.333 MHz (PLB=133, OPB=66, EBC=66 MHz)
No Security/Kasumi support
Bootstrap Option C - Boot ROM Location EBC (16 bits)
Internal PCI arbiter enabled, PCI async ext clock used
32 kB I-Cache 32 kB D-Cache
Board: Sequoia - AMCC PPC440EPx Evaluation Board, Rev. FF, PCI=66 MHz
I2C: ready
256 MB
FLASH: 64 MB
NAND: No NAND device found!!!
0 MiB
USB: Host(int phy) Device(ext phy)
DTT: 1 FAILED INIT
Net: ppc_4xx_eth0
Type run flash_nfs to mount root filesystem over NFS
Hit any key to stop autoboot: 0
=>
U-Boot can now be used to boot into Linux. U-Boot has many configuration variables which must be set correctly.
In particular, the ethaddr, ipaddr, and serverip U-Boot environmental variables must be set in order to tftp the Linux kernel image.
It is a good idea to make a memory map of the system’s flash. In this example, the Linux kernel image will be booted using the network using tftp protocol to a load address of 400000.
Any arbitrary addresses in the FLASH may be used as long as the load address does not overlap with the location of U-Boot and its associated environmental variables.
The file system is accessed using Network File System (NFS) and is mounted on the host.
The saveenv command saves the environmental variables to persistent storage. You can now reboot the system.=> setenv ethaddr 00:10:EC:01:05:E6
=> setenv ipaddr 192.168.100.51
=> setenv serverip 192.168.100.206
=> setenv hostname myproject
=> saveenv
=> setenv bootargs ip=${ipaddr}:${serverip}:${gateway}:${netmask}:${hostname}:${netdev}:off panic=1 console=ttyS0,115200
=> setenv bootcmd 'tftp 400000 uImage.mine; bootm 400000'
This time do not interrupt the autoboot and watch Linux come up.
Linux configures the Ethernet physical device interface. You can now login to myproject and use Debian Linux on the embedded system.U-Boot 2009.08 (Nov 17 2009 - 09:05:32)
CPU: AMCC PowerPC 440EPx Rev. A at 533.333 MHz (PLB=133, OPB=66, EBC=66 MHz)
No Security/Kasumi support
Bootstrap Option C - Boot ROM Location EBC (16 bits)
Internal PCI arbiter enabled, PCI async ext clock used
32 kB I-Cache 32 kB D-Cache
Board: Sequoia - AMCC PPC440EPx Evaluation Board, Rev. FF, PCI=66 MHz
I2C: ready
256 MB
FLASH: 64 MB
NAND: No NAND device found!!!
0 MiB
USB: Host(int phy) Device(ext phy)
DTT: 1 FAILED INIT
Net: ppc_4xx_eth0
Type run flash_nfs to mount root file system over NFS
Hit any key to stop autoboot: 0
miiphy_reset
PHY ADDR 0x0 1040
MII devices: 'ppc_4xx_eth0'
Current device: 'ppc_4xx_eth0'
PHY OUI = 0x01C1, Model = 0x02, Rev = 0x01
0
in 4xx_enet.c
Waiting for PHY auto negotiation to complete.... done
ENET Speed is 1000 Mbps - FULL duplex connection (EMAC0)
Using ppc_4xx_eth0 device
TFTP from server 192.168.100.206; our IP address is 192.168.100.51
Filename 'uImage.mine'.
Load address: 0x400000
Loading: #################################################################
######################################
done
Bytes transferred = 1502956 (16eeec hex)
## Booting kernel from Legacy Image at 00400000 ...
Image Name: Linux-2.6.25-svn1995-dirty2
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1502892 Bytes = 1.4 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Linux version 2.6.25-svn1995-dirty2 (soriano@host) (gcc version 4.2.2) #18 Thu Nov 19 09:50:36 PST 2009
AMCC PowerPC 440EPx Sequoia Platform
This is a basic overview of how a developer can load Debian Linux onto an embedded system.soriano@host:~$ telnet 192.168.100.51
Trying 192.168.100.51...
Connected to myproject.lab.
Escape character is '^]'.
Debian GNU/Linux 5.0
myproject login: ops
Last login: Thu Nov 19 17:52:22 UTC 2009 on ttyS0
Linux myproject 2.6.25-svn1995-dirty2 #18 Thu Nov 19 09:50:36 PST 2009 ppc
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
ops@myproject:~$
Debian Linux is a free open-source operating system that can be used in conjunction with embedded systems for real-time applications.
More Resources
u-boot: http://www.denx.de/wiki/U-Boot
Abatron: http://www.abatron.ch/
Debian Linux http://www.debian.org/
No comments:
Post a Comment