+ All Categories
Home > Documents > Introduction to Embedded Microcomputer System

Introduction to Embedded Microcomputer System

Date post: 10-Apr-2015
Category:
Upload: huntu2
View: 650 times
Download: 3 times
Share this document with a friend
Description:
Embedded linux using LTIB for Zoom ColdFire M5474LiteKit Development Board
43
Introduction to Embedded System using Zoom ColdFire M5474LiteKit Development Board Embedded System Workshop LIPI, November 2009 By: Gunawan, ST.
Transcript
Page 1: Introduction to Embedded Microcomputer System

Introduction to Embedded

System

using Zoom ColdFire

M5474LiteKit Development

Board

Embedded System Workshop

LIPI, November 2009

By: Gunawan, ST.

Page 2: Introduction to Embedded Microcomputer System

Computer Evolution

Source: Evolution Of Computer and Computing, Ruth M. Davis (EvoutionofComputers.pdf)

Page 3: Introduction to Embedded Microcomputer System

Embedded Microcomputer System

Architecture

Embedded means: specific function of hardware placed on a single

microcomputer chip (SoC)

Source: http://www.engr.colostate.edu/.../MicroC_overview.pdf

Usefull info: STES-Lecture 1. What is Embedded System.ppt

Page 4: Introduction to Embedded Microcomputer System

Embedded Operating System

Operating System on Embedded Microcomputer were needed to perform multitasking and scheduling process on a complex function system.

Usefull info: EmbeddedLinuxTalkUniForum.ppt

Page 5: Introduction to Embedded Microcomputer System

Embedded Linux

• Open Source

• POSIX: Portable Operating System Interface for UNIX

• GPL: GNU Public License (free licensed)

• GNU Linux: Gnu Not Unix

• Realtime OS Availability

• Limitation Scope– 32Bit Processor

– Processor with MMU (Memory Management Unit)

– Few Mbyte Code Size

Usefull info: EmbeddedLinuxTalkUniForum.ppt

Page 6: Introduction to Embedded Microcomputer System

Embedded Linux Basic

BootLoader

• BOOTLOADERS– Used to initialize the hardware

– Provides mechanism for initial interaction with board

– Provides mechanism to boot kernel

– Configured and built for specific board

• Common bootloader– ColdFire: Colilo, u-boot, dBUG

– Power Architecture™: u-boot

– ARM: blob, redboot, u-boot

– I386: GRUB, LILO

Target Board

Bootloader

Kernel

File system

Source: linux_presentation1.pdf

Page 7: Introduction to Embedded Microcomputer System

Embedded Linux Basic

Kernel

• KERNEL

– Continued initialization of the board

– Provides mechanism to interact

with devices (drivers)

– Provides underlying protocol

support

– (TCP/IP) and OS

– The Linux kernel configuration

allows many features to be

selected and configured

Target Board

Bootloader

Kernel

File system

Page 8: Introduction to Embedded Microcomputer System

Embedded Linux Basic

Kernel Modules

• KERNEL MODULES

– Implement device drivers

– Provide additional

functionality to kernel

– Reside in the file system

and can be loaded and

unloaded from the kernel

Target Board

Bootloader

Kernel

File system

Kernel Modules

Page 9: Introduction to Embedded Microcomputer System

Embedded Linux Basic

File Systems

• FILE SYSTEM– Protected by Memory

Management Unit (MMU) (user land)

– Applications live here

– Common Embedded File SystemTypes

• EXT2/3

• Journaling Flash File System version 2 (JFFS2)

• CRAMFS

• YAFFS

Target Board

Bootloader

Kernel

File system

Page 10: Introduction to Embedded Microcomputer System

Conceptual Architecture of Linux

Kernel

Source: Design and Implementation of Embedded Linux System.pdf

Page 11: Introduction to Embedded Microcomputer System

Linux Kernel System Structure

Source: Lab1_linux_arch_and_commands.ppt

Concrete DecompositionConceptual Decomposition

Page 12: Introduction to Embedded Microcomputer System

Building Embedded Linux

• Toolchain and library – Cross Compiler Gcc, Glibc, uClibc, Binutils

• Linux Kernel Source Code

• File system and basic application – BusyBox: combined several native linux command

• Preconfigured Buildtools:– Buildroot

– SnapGear

– LTIB: Linux the image builder

– Comercial licensed: IAR, Green Hils, etc.

Page 13: Introduction to Embedded Microcomputer System

Linux Kernel Source Code Tree

Page 14: Introduction to Embedded Microcomputer System

Linux File System Structure

Source: 3.1. General overview of the Linux f ile system.html

Usefull info: Source: Lab1_linux_arch_and_commands.ppt

Page 15: Introduction to Embedded Microcomputer System

Compiling Linux on Zoom Coldfire

M5474Litekit Development Board

Common Features

•Fire Engine Included (MCF5474Lite, 64MB DDR, 4MB Boot Flash)•PC Card Expansion One PCI 2.2 slot (32 Bit, 33 or 66MHz, 3.3V)

•Serial Ports One 115.2kbps RS-232 serial ports; Two TTL serial ports

•Can 2.0b One port (MCF5485 only) •USB USB 2.0 One High speed device (on Fire Engine) •SPI

•RTC •Network Support One RJ45 Ethernet jack connectors

(application/debug) •BDM Interface •Software

• LogicLoader™ (bootloader/monitor) • Freescale dBUG ROM Monitor

• Third party development tools and software wrapped in individual CDs

• Cygwin and GNU Cross Development Toolchain

•Mechanical Mini-ITX • 6.7” (170mm) long x 6.7” (170mm) wide x 1.3” (33mm) high

Page 16: Introduction to Embedded Microcomputer System

M5474Litekit Limitation

Curently not directly supported model, linux source code currently only support for:

M5475EVB, M5484Lite & M5485EVB model

Fire Engine CPLDThe CPLD device, on Fire Engine SOMs

shipped as part of a development kit, is in an un-programmed state. A programmed CPLD is not required for microprocessor, memory, or on-chip peripheral functionality.

The CPLD program that Logic has developed gives the system additional functionality (such as a Memory-Mode CompactFlash interface). Please read the CPLD license agreement below for more information on gaining access to CPLD programming files.

http://support.logicpd.com/products/devkit/freescale/coldfire_litekit

CPLD shipped un programmed

State, no second f lash for application

image, no access to compact f lash

Page 17: Introduction to Embedded Microcomputer System

M5474Litekit Source Finding

Hint: Available model supported by u-boot are:

M5475AFE: - boot 2MB, RAM 64MB

M5475BFE: - boot 2MB, code 16MB, RAM 64MB

M5475CFE: - boot 2MB, code 16MB, Video, USB, RAM 64MB

M5475DFE: - boot 2MB, USB, RAM 64MB

M5475EFE: - boot 2MB, Video, USB, RAM 64MB

M5475FFE: - boot 2MB, code 32MB, Video, USB, RAM 128MB

M5475GFE: - boot 2MB, RAM 64MB

Kernel

Only support AFE model to FFE Model

Current relese kernel only support for mcf5484 which differ from mcf5474 who doesn‟t have security engine (SEC) driver.

From HW. Spec Says 4MB Boot Flash, but the upper 2MB access had been blocked by hardware

Conclusion:

Current flash size will only hold the bootloader code, the linux system may only run via a server,

a tftp server needed to deploy the kernel image and a nfs server to deploy the file server

Some changes to be made in the linux the image builder (LTIB) due to unsupported model.

Future work:

Asking for firmware CPLD code to vendor, to enable the compact flash access to get the system had ability to run linux in standalone mode.

Page 18: Introduction to Embedded Microcomputer System

LTIB – Linux The Image Builder

Software Prerequisite Requerment to build:• Source Code m547x_8x_evb_20080811-final-ltib.iso, Available to download

at:http://www.freescale.com/webapp/sps/download/license.jsp?colCode=CWF-MCF547X-548X-2-6-KL&location=null&fpsp=1&WT_TYPE=Board%20Support%20Packages&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=iso&WT_ASSET=Downloads&Parent_nodeId=1100875301996736292646&Parent_pageType=product

• A Host PC running linux, in the practice using opensuse11 with installed packages: Kernel development, Console tools and File Server. Note: turn off Firewall to make server function work properly.

• Another Host PC running in windows xp with Serial Communication to run terminal like Terra Term and a LPT port connection to run CF Flasher to be able to flash the board using BDM interface.

– CF Flasherhttp://www.freescale.com/files/soft_dev_tools/software/programmers/CFFLASHER.zip?fps

p=1&WT_TYPE=Programmers%20(Flash,%20etc.)&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=zip&WT_ASSET=Downloads

– P&E driver available for download at: https://www.pemicro.com/login.cfm?from_url=/downloads/download_file.cfm?download_id=53

Page 19: Introduction to Embedded Microcomputer System

LTIB – Linux The Image Builder

Hardware Prerequisite

PC

Running

Linux

Target Board

M5474LiteKit

LAN with

Cross Cable

LAN

port

BDM

Jtag

Port

Serial

Port

PC

Windows

Xp

LPT

Cable

Serial Cable

Cross F-F

PSU

5V

Page 20: Introduction to Embedded Microcomputer System

Installing LTIB

• The user manual to deploy the LTIB, available from BSP Targeting the Freescale_M547X_8X.pdf included inside the m547x_8x_evb_20080811-final-ltib.iso

• Note: The AN2950 from freescale web site pointed to earlier linux BSP (savannah_ltib-20070321.tar.gz) in this case it cannot be use.

• Mounting The m547x_8x_evb_20080811-final-ltib.iso– Mkdir <mount_dir>

– Mount –o loop m547x_8x_evb_20080811-final-ltib.iso < mount_dir >– Cd < mount_dir >

• Installing LTIB– ./insatall.sh <install_dir>

• This will extract ltib packages to directory <install_dir>/ltib-m5475evb-20080808. Make a backup of original source– Tar czvf ltib-m5475evb-20080808.tgz ltib-m5475evb-20080808/

Page 21: Introduction to Embedded Microcomputer System

Installing LTIB

• Default configured package are targeted for

M5475EVB.

• Later on we will need to change the source code

to meet M5474Lite.

• First install install the Toolchain and rebuild all

package, make sure your not running as root.

> Cd ltib-m5475evb-20080808

>./ltib

Page 22: Introduction to Embedded Microcomputer System

Installing LTIB

Since we running as non root, it will output an error, but we must not run as

root to prevent any damage to system

Page 23: Introduction to Embedded Microcomputer System

Installing LTIB

• Change user to root

> Su

> Password: <type in

Password>

> Visudo• Add the above needed

lines into user privilaged

section

Note: Change user name

„huntu2‟ to your local username

To finish type in

“:wq”

Page 24: Introduction to Embedded Microcomputer System

Installing LTIB• Now Change back to normal user from root by type in

> Exit

• Run the ltib again

> ./ltib

• To Follow the process, open in a new shell type in:

> cd <install_dir>/ ltib-m5475evb-20080808> tail host_config.log –f

• Upon Succesfull build thoolchain are located at “/opt”, while other remains at install dir. You may use it for creating your applications.

/<root> /<install_dir>/ltib-m5475evb-20080808/

/opt

freescale/usr/local/gcc-4.2.125-eglibc-2.5.125/m68k-linux

bin

lib

M68k_linux-* <Cross Compiler>

Page 25: Introduction to Embedded Microcomputer System

LTIB Directory Structure

/<install_dir>/ltib-m5475evb-20080808/ Ltib, rootfs.jffs2

bin/

config/ platform/ mcf4e/ Main.lkc

dist/

Main Configuration

Need to be changed

doc/

rpm/

tmp/

rootfs/ boot u-boot.bin, uImage

release_log/

BUILD/

RPMS m68k *.rpm

Flash File system image

Uboot and kernel

image

Rpm sources

packages

Directory that hold source

code if modified

Page 26: Introduction to Embedded Microcomputer System

Configuring the u-boot

• Current Board default for

M5475EVB

– Differ from M5474Lite

which don‟t have second

code flash

• Available u-boot

config don‟t have

M5474lite option

Page 27: Introduction to Embedded Microcomputer System

Configuring the u-boot

• From the u-boot Readme files of the source it self, there are M5475AFE to M5475GFE model supported by u-boot

• Change the main.lkc at config/platform/mcf4e directory

> vi config/platform/mcf4e/main.lkc

Reference:1000331_Rev_B.pdf (ColdFire Lite Development Kit QuickStart Guide)

Page 28: Introduction to Embedded Microcomputer System

Configuring the u-boot• Press “i” to insert new character

• Add These lines below last optionconf ig PKG_U_BOOT_M5475AFE

bool "UBoot M5475AFE boot2MB,RAM64MB"

conf ig PKG_U_BOOT_M5475BFE

bool "UBoot M5475BFE boot2MB,code16MB,RAM 64MB“

conf ig PKG_U_BOOT_M5475CFE

bool "UBoot M5475CFE boot2MB,code16MB,Video,USB,RAM64MB"

conf ig PKG_U_BOOT_M5475DFE

bool "UBoot M5475DFE boot2MB,USB,RAM64MB"

conf ig PKG_U_BOOT_M5475EFE

bool "UBoot M5475EFE boot2MB,Video,USB,RAM64MB"

conf ig PKG_U_BOOT_M5475FFE

bool "UBoot M5475FFE boot2MB,code32MB,Video,USB,RAM128MB"

conf ig PKG_U_BOOT_M5475GFE

bool "UBoot M5475GFE boot2MB,RAM64MB”

• Add Another lines to make boolean had mean to u-boot config

default "M5475AFE_conf ig" if PKG_U_BOOT_M5475AFE

default "M5475BFE_conf ig" if PKG_U_BOOT_M5475BFE

default "M5475CFE_conf ig" if PKG_U_BOOT_M5475CFE

default "M5475DFE_conf ig" if PKG_U_BOOT_M5475DFE

default "M5475EFE_conf ig" if PKG_U_BOOT_M5475EFE

default "M5475FFE_conf ig" if PKG_U_BOOT_M5475FFE

default "M5475GFE_conf ig" if PKG_U_BOOT_M5475GFE

• Press “esc” to exit insert mode, then type in “:wq” to save and quit

Page 29: Introduction to Embedded Microcomputer System

Configuring the u-boot• Recall the “./ltib –configure” we had:

• Choose the AFE (closest ones) model, exit and save, LTIB will Compile and producing all images

Page 30: Introduction to Embedded Microcomputer System

Deploying u-boot

• The simplest way is to use the CFlasher from windows xp

• You may also use dBug console to flash the u-boot image

Page 31: Introduction to Embedded Microcomputer System

U-boot Result

• Upon sussesfull u-boot load tou may check the board info using “bdinfo” and check the environment using “printenv” or in short “pri”

Page 32: Introduction to Embedded Microcomputer System

Configuring Kernel

• Recall “./ltib –

configure”

• Check on “configure

kernel” and “leave

kernel source”

• Exit and save

• LTIB will copy linux

source to

“rpm/BUILD/linux”

Page 33: Introduction to Embedded Microcomputer System

Configuring Kernel

• On The Kernel configuration, click paltform dependent setup

• Click on

MCF547x/548x

support

Page 34: Introduction to Embedded Microcomputer System

Configuring Kernel

• The processor model available are listed in the menu, choose the same as the u-boot model, that will be MCF5474AFE

• Click select then exit and save

• The LTIB will then compile the kernel and produced all images

• This kernel cannot be use, since it still involve SEC driver as previous finding, if deployed to the board, the kernel will halt at loading M5484_device

Page 35: Introduction to Embedded Microcomputer System

Configuring Kernel• The kernel source code placed in

the “rpm/BUILD/linux” directory since we checked the “leave kernel source” option.

• The processor spesific option are placed at the “arch/” directory, as explained before.

• Go to the

> cd rpm/BUILD/linux-2.6.25/arch/m68k/coldfire/

> vi mcf548x-devices.c

• Press „I‟ to insert „//‟ in front of “platform_device_register(&coldfire_sec_device);” lines

• Press “:wq” to write and exit

Page 36: Introduction to Embedded Microcomputer System

Final LTIB Compilation Image

• Recall “./ltib” to compile all over again, this

time no need to configure because are

config are already in the correct place

• The ltib will produce all usabele images:

– u-boot.bin -> binary bootloader

– uImage -> binary kernel image

– rootfs/ -> root folder for nfs deployment

– rootfs.jffs2 -> root file system image for deploy

in flash

Page 37: Introduction to Embedded Microcomputer System

Host PC: Setting TFTP Server

• Re login as root by type in

> su

> password: <type in our password>

• Call YAST to configure server

> yast

• Choose Network server->tftp server->enable

• Click ok and finish.

> exit

• Copy uImage to /tftpboot

> cp rootfs/boot/uImage /tftpboot/.

• Your kernel image is ready at tftp server

Page 38: Introduction to Embedded Microcomputer System

Host PC: Setting NFS Server

• Copy the “rootfs/”

directory to “/tftpboot”

> cp –vrf rootfs/ /tftpboot/.

• Call “yast” to configure

server

• Choose “network service”

-> “NFS Server”

• Checklist “start”, disable

“NFSv4”, then press

“next”

Page 39: Introduction to Embedded Microcomputer System

Host PC: Setting NFS Server

• Choose “add” then browse to “/tftpboot/rootfs”

• On the host wildcard, type in:

“rw,no_root_squash,async,no_subtree_check”

• Click finish and exit

• Your NFS server are ready

Page 40: Introduction to Embedded Microcomputer System

u-boot Script

• TO make the u-boot to be able to boot linux you must edit u-boot environment.

• Set the ip address and server

> set ipaddr <board_ip>

> set serverip <server_ip>

• Set the boot argument to pass as kernel command line that will be executed by kernel

> set bootargs root=/dev/nfs rw nfsroot=192.168.0.20:/tftpboot/rootfs ip=192.168.0.30:192.168.0.20:192.168.0.30:255.255.255.0::eth0:off mtdparts=physmap-flash.0:4M(uboot)ro

• Set the bootcmd that will executed automaticly each u-boot resart

> set bootcmd „tftp 2000000 uImage; bootm 2000000‟

• Save the environment to flash

> save

Page 41: Introduction to Embedded Microcomputer System

Linux First Run

• Reset the board, it will

execute script in the

u-boot environment

setting.

• First it will load kernel

(uImage) via tftp

server then loading

file system via nfs

server.

Page 42: Introduction to Embedded Microcomputer System

Linux First Run

• Congratulation you have succeeded running linux on your embedded board,

• You may use installed application, adding new application by reconfiguring ltib (kernel, package and busybox) and or creating your own application, just like programming in native linux running on PC.

Page 43: Introduction to Embedded Microcomputer System

Thank You


Recommended