Introduction à l'informatique embarquée

Intel 386+ (of course) with support for ISA, EISA, PCI, VLB, and ..... Page : 57. Samuel Kortas – Janvier/Février 2003. Debugging. ➢ Platform Builder includes a ...
1MB taille 3 téléchargements 43 vues
Introduction à l’informatique embarquée Samuel KORTAS

Janvier-Février 2003

Embedded Computing ¾

General Introduction

¾

The Linux Path

¾

The Windows Path

¾

Your Path?

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 2

1

General Introduction

Janvier-Février 2003

What is embedded computing? ‰

All Computing business that does not take place in a computer

Š today : phones, cars, satelites, cameras… Š tomorrow : fridge, pens, clothes….. everywhere ‰

more trends, less tools

‰

people don ’t forgive and forget easely :

Š your fridge can not get stuck in « runtime error » Š Mass products not update

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 4

2

A new Market and a world apart ‰

New scales, new trends

Š Real time features Š Mobility requirement Š lightness and power of the tools ‰

New Actors, New habits

Š OS : Vxworks, LynxOS, OSE….. Š Cross-compilation, remote debugging and minimalist environment ‰

Redirection of actors, adaption of habits

Š Linux and Windows CE Š Visual embedded tools Page : 5

Samuel Kortas – Janvier/Février 2003

Embedded key points ¾

Requirements :

Š ROM Š RAM Š CPU ¾ ¾ ¾

Process performance and priority Platform constraints : e.g. no EEPROM Cross compilation :

Š PC: Compilation, Emulator Š Target : Tests in debug or retail mode ¾ ¾

Clearly split the portable and the specific parts of the software Few tools to debug and test

Š During Design, the test requirements have to be examined Š The development of tools to test the driver may be a heavy part of the project

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 6

3

2. Linux Embarqué / Embedded Linux

Janvier-Février 2002

Linux Overview ¾

Linux Operating System Key Points

¾

Linux Kernel settings

¾

Embedding Linux

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 8

4

Linux Operating System Fundamentals

Linux OS ‰

Linux OS Key points

Š GNU, Open Source and Linux Kernel Š Where to find the information Š License, Software Pattern and Copyleft

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 10

5

An Operating System based on Linux

GNU : Free Unix environment

Linux Kernel

Free Software Fundation (cp, mv, emacs…)

Proprietary Application

GPL

No code Available

Proprietary Applications Open Source (Mozilla, Star Office…) Proprietary License

(Lexmark Driver)

Linux Kernel is the basis of a wider « free » Unix System Samuel Kortas – Janvier/Février 2003

Page : 11

The Linux Track ¾ ¾ ¾ ¾

Linus Torwald Started it all (as a task swapper for a class) Several enthusiastic people have developped the Kernel Today, 2/3 servers in the world run Linux Great Future in embedded world, for : free, portable and highly configurable.

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 12

6

Linux Actors ¾ ¾

¾ ¾ ¾

Community of several millions of testers and bug subscribers Hundreds of Hobby-Developpers coding for their own need and pleasure and releasing it to the community (eg : Lexmark in Ghostscript). Companies involved in distributing/supporting Linux : Red Hat, Mandrake, Infomagic. Companies supporting Linux to provide a standard for the internet : IBM, HP. Companies porting their applications/drivers to Linux.

Samuel Kortas – Janvier/Février 2003

Page : 13

What Support? ¾

Lots of documentation over the net

Š www.kernel.org to monitor the last changes. Š www.linuxdoc.org : howtos, Faq, installation guides…etc… Š Newsgroups: read www.dejanews.com! ¾

Well documented sources and support from enthousiastic developpers

¾

Commercial support just starting :

Š Distribution company : Mandrake, Redhat Š Well-known Company : IBM, HP… That want to support Linux as a standard.

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 14

7

What does free mean? ‰

Linux is released under the Gnu Public License :

Š One can copy, modify and sell Linux software, as long as its developers receive proper credit and that any changes to the source code are made public ‰

GPL stays GPL :

Š If you ever modify a GPL source for your own needs, these modifications must be released public.

Samuel Kortas – Janvier/Février 2003

Page : 15

What does it mean for a company? ¾ Avaibility of driver for new printer can make Linux users buy the company’s product (example of the ADSL Alcatel new webtouch USB modem, Lexmark Printer). ¾ Installation and bug tracking support should be provided by the company ¾Following kernel and major library version ¾Providing up to date rpm files ¾ Efficient user support via newsgroup or e-mail. Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 16

8

Setting the Linux Kernel

Linux OS

‰ Around Š Š Š Š

the Kernel

Stable and unstable branch Kernel and User mode Setting and compilation of the Kernel Multi-platform and embedded Linux

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 18

9

Linux Kernel ‰

Kernel is the core of the unix system Š Š Š Š

‰

Initialization of the environment for each architecture task scheduler Very low level driver (memory, interrupt…..) Optional drivers (network, file system, external devices)

Two Developping Branches for the kernel x.y.z Š Y even : stable branch, one release each month at the beginning Š Y odd : Test branch : several release a month, where everybody can test their ideas

‰

Complete rewritting of the Kernel with 2.0 Š USB Support reorganized in 2.4 Š Better Documentation right at the place of the source

Samuel Kortas – Janvier/Février 2003

Page : 19

Setting the kernel ‰

All Kernel sources (from version 0.1) can be downloaded from www.kernel.org. They must be installed in /usr/src/ directory

‰

Preparing the compilation

Š Get linux-2.4.3.tar.gz. It will uncompress as linux Š Configure the kernel to your own needs (USB Printer Support) z

Make xconfig (or make menuconfig from text console)

‰

Try It and cross fingers!!

‰

Documentation available at www.linuxdoc.org/HOWTO/KernelHOWTO.html

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 20

10

Kernel and User mode

User mode :

Kernel Mode :

• Processes

Kernel Mode

• Debugger

User Mode

• only printk

• Interruptions Coding and Testing Easy Less performance

• kernel freeze possible • very close to Hardware

Coding and Testing Tricky more performances

Samuel Kortas – Janvier/Février 2003

Page : 21

Embedding Linux

20/02/2003

11

Embedding Linux… ‰

Embedded Key points

‰

Market

‰

Linux Port available

‰

Customizing the Linux embedded system

Samuel Kortas – Janvier/Février 2003

Page : 23

Embedded Linux Market

Which 16 or 32-bit RTOS or kernel vendors have you used in the last 12 months for your embedded designs?« Annual growth of 25% Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 24

12

Linux everywhere ‰

There are many, many Linux ports: (see www.kernel.org) z

z z z z z z z z z z z

Intel 386+ (of course) with support for ISA, EISA, PCI, VLB, and MCA (and Merced) Alpha (Linux is 64-bit now) Motorola 68030+ Power PC ARM SPARC MIPS SGI (in progress) VAX (in progress) PalmPilot (in progress) 8086-80286 (in progress) And more!

Samuel Kortas – Janvier/Février 2003

Page : 25

… but only one Linux ¾

Only two things needs to be ported z z

¾

Part of the Kernel written in assembly language (roughly 10%) One cross-compilation environment : typically gcc (see Hard Hat linux at http://www.montavista.com)

Afterwards, applications only need to be recompiled z z z

Changing the compiler : gcc in strongarm-gcc Compiling the unix minimal package : cp, ls, rm… Adressing specific platform problem : different timing, storage environment, memory and CPU footprint

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 26

13

Advantages ¾

Development is easy and portable z z

z

¾

Coding and Testing on a Desktop PC Same environment to compile it on the final target : just the compiler changes Only one code to maintain for multiple platform

Benefit from last improvements/fix of the kernel z

z

Eg : On strong arm, the kernel stable last version is available less than one month after the i386 version (see www.arm.linux.org.uk) How to cope with that in industry?

Page : 27

Samuel Kortas – Janvier/Février 2003

Famous Desktop distributions ¾

Slackware (www.slackware.com)

¾ More easely lightened up ¾ Not used a lot anymore ¾ Uses pakage.tar.gz

¾ Debian (www.debian.org) : ¾ designed for system administrator ¾ Official GNU distribution ¾ Uses pakage.deb ¾ Redhat like ¾ Red Hat (www.redhat.com) ¾ Mandrake (www.linux-mandrake.com/en) ¾ SuSE (www.suse.com) ¾ Corel (linux.corel.com) ¾ Uses package.rpm

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 28

14

On Disk Distribution ‰

Benefits :

Š Š Š Š Š Š

‰

Let the computer clean no installation needed no wizard skill required a good trial path electronic pupil bag? Targetted application z rescue disk z demo disk

Concerns

Š slow Š no standard Š ease to add something?

Samuel Kortas – Janvier/Février 2003

‰

Examples

Š demolinux (www.demolinux.org) z Paris V z Roberto di Cosmo

Š Knoppix (www.knoppix.net) z GNU Debian z Klaus Knopper

Š others?

Page : 29

Small foot-print "embedded" Linux versions . . . ¾

ETLinux -- a complete Linux distribution designed to run on small industrial computers, especially PC/104 modules. (www.prosa.it/etlinux)

¾

LEM -- a small (< 8 MBytes) multi-user, networked Linux version that runs on 386's. (linux-embedded.com/lem.php3)

¾

LOAF -- "Linux On A Floppy" distribution that runs on 386's. (loaf.ecks.org)

¾

uClinux -- Linux for systems without MMUs. Currently supports Motorola 68K, MCF5206, and MCF5207 ColdFire microprocessors (www.uclinux.org)

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 30

15

"Real-time" Linux APIs . . . ¾

RTLinux -- this hard real-time Linux API was originally developed at New Mexico Institute of Technology. (www.rtlinux.com; www.fsmlabs.com)

¾

RTAI (DIAPM) -- a spin-off of the RTLinux real-time API that was developed by programmers at the Department of Aerospace Engineering, Polytechnic Politecnico di Milano (DIAPM). (www.rtai.org)

¾

… And lots of other Vanilla

¾

Notice : Linux has ill performance in hard real Time because the driver mode is not widely interruptible.

Samuel Kortas – Janvier/Février 2003

Page : 31

Win CE Overview

20/02/2003

16

Introduction to Win CE

¾

Win CE Design Goals

Š Š Š Š Š

Portable Modular and Compact Win32 Compatible RAD Tools Support Connectivity

Samuel Kortas – Janvier/Février 2003

Page : 33

Portable ¾ Easy portability to new processors ¾ Most parts of the OS written in C ¾ Support of various processors ¾ Complete list of supported processors available on Windows CE Web site - http://www.microsoft.com/windowsce/embedded

¾ Easy portability to new platforms ¾ OAL layer

¾

¾

Original equipment manufacturer (OEM) ¾ For Windows CE, an OEM is a company that manufacturers a hardware platform and ports Windows CE to that platform. OEM adaptation layer (OAL) Š That portion of Windows CE that must be provided by the hardware manufacture to adapt Windows CE to their platform.

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 34

17

Modular and Compact ¾ Modules ¾ Kernel, GWES, Filesys, and Communications

¾ Each module is divided into components ¾ Build an OS image that fits your needs ¾ Windows CE configurations - Minkern, Mininput, Mincomm, Mingdi, Minwmgr, Minshell, Maxall, IESample ¾ Components can be added, deleted, or replaced

¾ Execute in place (XIP) from ROM

Page : 35

Samuel Kortas – Janvier/Février 2003

Win32 Compatible ¾ Uses Win32 programming model ¾ Uses Win32 PE file format ¾ portable executable file format : The Microsoft implementation of the Common Object File Format.

¾ Supports a large number of 1500 Win32 API functions ¾ Supports other programming interfaces:

Š Š Š Š

MFC (Microsoft Foundation Classes) ATL (Active Template Library) COM (Component Object Model) MSMQ (Message Queuing)

Š Advantages: Š Ease of porting existing Windows applications Š Many developers have good Windows knowledge

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 36

18

RAD Tools Support ¾

Major requirement of OEMs and ISVs (Independent software vendor)

¾

Not restricted to a particular language

¾

Strong development support

Š Š Š Š

Languages: Visual Basic, Visual C++ Tools: Remote Debugger, Emulators Technologies: COM, MSMQ APIs: TAPI (Telephony Application Programming Interface), Winsock, CryptoAPI, NLS API (national language support) Š Libraries: ATL, MFC

Samuel Kortas – Janvier/Février 2003

Page : 37

Connectivity ¾

CE devices designed for mobility

¾

Support connectivity to desktop PC, other CE devices, and the internet

¾

Wide variety of communication options and API: Serial (Win32), LAN (NDIS), Modem (TAPI), Infra-red (IrDA), RAS (Remote Access Service), Winsock, and WinInet

¾

Secure communications at all levels

¾

Synchronization model: ActiveSync

¾

Mobile channels

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 38

19

Overview of Windows CE Architecture Windows CE-based applications Shells

Internet Explorer

Remote connectivity

Microsoft programming interfaces (Win32, COM, MFC, ATL)

Kernel

OAL

GWE

Communications interfaces (Winsock, RAS, TAPI, network)

Object Store (file systems)

Native and stream interface drivers

Communication module

Other drivers

Hardware

Samuel Kortas – Janvier/Février 2003

Page : 39

The Hardware ¾ Minimum hardware requirements: ¾ Supported processor ¾ Real-time clock ¾ Memory

¾ Reference platforms:

Š ODO (The Hitachi D9000 hardware development platform) Š CEPC

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 40

20

The Kernel Module ¾

Portable across supported processors

¾

Nk.exe, Coredll.dll (used by the applications to communicate together)

¾

Support RAM and ROM execution

¾

Modules can be compressed in ROM

¾

Demand paging supported by RAM, ROM, and FAT file system

Samuel Kortas – Janvier/Février 2003

Page : 41

The Kernel Module: Processes and Threads ¾ Processes ¾ Maximum 32 processes can be loaded at the same time ¾ Support for console applications

¾ Threads

Š Š Š Š ¾

Smallest unit of execution Number of threads only limited by available memory Preemptive priority-based scheduling (8 priorities) Quantum default length is 25ms (configurable)

WinCE 3.0 : more RTOS

¾ 256 priorities ¾ Quantum default length is 1ms

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 42

21

The Kernel Module: Virtual Memory Management

Reserved

2GB

Memory Mapping (Shared) Slot 32:Process32

2GB

. . . Slot 1:Process1 32MB

Slot 0:Active Process

Page : 43

Samuel Kortas – Janvier/Février 2003

The GWES Module ¾ Graphics, Window manager, and Event manager ¾ Graphic output (display and printer) ¾ User input: keyboard, stylus, mouse, etc. ¾ Window management: messages routing etc.

¾ GWES is the most componentized Windows CE module ¾ GWES exports only a subset of the Win32 API functions

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 44

22

Support for Development Languages ¾

Microsoft Platform Builder

¾

Windows CE Toolkit for Visual Basic 6.0

¾

Windows CE Toolkit for Visual C++ 6.0

¾

Remote Application and Kernel Debugger

¾

Windows CE Emulators (PPC / HPC / HPC Pro)

¾

Custom SDK

Samuel Kortas – Janvier/Février 2003

Page : 45

API Differences with Windows 95 / Windows NT ¾

What is missing

Š Redundant APIs Š Windows NT security functions, ANSI API, “LE” of OLE (Object Linking and Embedding)

Š Portions of the large APIs like TAPI, Sockets,Printing,USER/GDI ¾ What is different

Š Š Š

Memory size and power management are special concerns Device driver model is different (few layers between the API and the hardware) Thread scheduling is simpler (smaller kernel)

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 46

23

Development for Win CE 2.12

What is Platform Builder ¾ ¾

Adapts Windows CE OS to your platform Embedded development tools

Š Š Š Š ¾ ¾ ¾

Compilers Kernel Debugger Windows CE remote tools Export SDK

Integrated Development Environment (IDE) Run-time libraries Sample code

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 48

24

Overview to the Customization Process

Platform is ready and final

Configure Platform

Modify Platform •OAL •Device Drivers •Configurations •Custom modules

Build Platform Image

Download and Debug Image

Export SDK

Platform needs modifications

Samuel Kortas – Janvier/Février 2003

Page : 49

Customizing a Win CE Image

¾

Configuring a Platform

¾

Modifying a Platform

¾

Building a Platform

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 50

25

Choosing a Reference Configuration Microsoft provides 8 reference configurations : ¾ Minkern: memory minimal version of WindowsCE

Š Memory, process, and file management Š Heap and memory allocation Š Registry and databases ¾

Mininput: minimal version of Windows CE

Š User input Š Native driver support (keyboard, display) ¾

Mincomm: minimal version of Windows CE with communications

Š Data communication : IRDA, Serial, TAPI, Š Networking: TCP/IP, PPP (Point-to-Point Protocol), WinInet, Secure Socket

¾

Mingdi: minimal version of Windows CE with graphic device interface support

Samuel Kortas – Janvier/Février 2003

Page : 51

Choosing a Reference Configuration ¾

Minwmgr: Almost all the main modules and components are available

Š Window management, graphic, and drawing support Š COM support Š Communication

¾

Minshell: nearly complete version of Windows CE

Š Command processor (similar to Cmd.exe) Š Task manager ‰

Maxall: almost all modules and components are available

Š Microsoft Message Queue Š Pocket Word, Pocket Internet Explorer ¾

IEsample: sample version with Internet Explorer 4

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 52

26

Configuring a Platform

Samuel Kortas – Janvier/Février 2003

Page : 53

Modifying a Platform Using the component view and the catalog

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 54

27

Modifying a Platform Modifying a platform settings

Page : 55

Samuel Kortas – Janvier/Février 2003

Development Platform Development PC CEPC

Network

¾

The Ethernet link is used to :

Š Download the image Š Debbug the code Š Implement the remote File System

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 56

28

Debugging ¾

Platform Builder includes a debugger

Š Breakpoint Š Step by step Š … ¾

Debug messages using Debug Zones

Samuel Kortas – Janvier/Février 2003

Page : 57

Win CE Support

http://www.microsoft.com/embedded

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 58

29

Question time! ‰

Any questions?

‰

I have one !... a study case Š how to debug a cellular phone? Š A printer?

Samuel Kortas – Janvier/Février 2003

20/02/2003

Page : 59

30