02- VxWorks-BSP & Boot Sequcence
Short Description
Download 02- VxWorks-BSP & Boot Sequcence...
Description
PEMP ESD531
Session 02 BSP & Booting Sequence
Session Speaker
B.N.Shobha ©
M.S Ramaiah School of Advanced Studies Studies - Bangalore
1
Session Objectives •
PEMP ESD531
To disc discus usss gene genera rall prin princi cipl ples es invo involv lved ed in booting a system and in VxWorks
•
To motivate and clarify the transfer of control from hardware, to firmware, to software during system boot.
•
To disc discus usss Boar Board d Sup Suppo port rt Pac Packa kage ge conc concep eptt in VxWo VxWork rkss
•
To unde unders rsta tand nd memo memory ry mana manage geme ment nt and and cro cross ss deve develo lopm pmen entt in in VxWorks
©
M.S Ramaiah School of Advanced Studies Studies - Bangalore
2
Session Objectives •
PEMP ESD531
To disc discus usss gene genera rall prin princi cipl ples es invo involv lved ed in booting a system and in VxWorks
•
To motivate and clarify the transfer of control from hardware, to firmware, to software during system boot.
•
To disc discus usss Boar Board d Sup Suppo port rt Pac Packa kage ge conc concep eptt in VxWo VxWork rkss
•
To unde unders rsta tand nd memo memory ry mana manage geme ment nt and and cro cross ss deve develo lopm pmen entt in in VxWorks
©
M.S Ramaiah School of Advanced Studies Studies - Bangalore
2
Session Topics
PEMP ESD531
• Gene Genera rall Boot Boot Seq Seque uenc ncee • Memory Memory Layou Layoutt in in VxW VxWork orkss • Torna Tornado do dire directo ctory ry Struc Structur turee • BSP BSP orga organi niza zati tion on • VxWo VxWork rkss Ima Image gess • Booti Booting ng proc process ess in VxW VxWork orkss • Cros Crosss-de deve velo lopm pmen entt
©
M.S Ramaiah School of Advanced Studies Studies - Bangalore
3
Boot Process
PEMP ESD531
• BIOS – reads the boot boot sector sector of the the boot boot disk disk (floppy, (floppy, hard disk, …, according to the BIOS parameter setting) • Flop Floppy py:: the the fir first st sect sector or • Hard disk: the first first secto sectorr is the the master master boot record record (MBR) – stored stored the informatio information n about about how a hard disk disk has been partitioned. • boot boot sec secto torr ends ends wit with h 0xAA 0xAA55 55 – Load the boot sector sector (512 (512 bytes bytes), ), which which will contain contain program code for loading the operating system kernel 0x000 JMP 0x03E 0x003 Disk parameters 0x03E Program code loading the OS kernel 0x1FE 0xAA55 ©
Boot Sector (Floppy)
M.S Ramaiah School of Advanced Studies Studies - Bangalore
4
MBR
PEMP ESD531
• A small program that reads the partition table – Checks which partition is active (i.e. bootable) – Reads the boot sector of active partition (boot sector-contains another small program that reads the first part of the OS stored on that partition) – jump jump into into the boot boot secto sectorr at at offs offset et 0 • The original partitioning scheme for PC hard disk allowed only four primary partitions (too little in real-life) – only 4 partition entries. Each entry is 16 bytes Code for loading the boot sector of the active partition 0x1BE 0x010 Partition 1 0x1CE 0x010 Partition 2 0x000 0x1BE
0x1DE 0x010
Partition 3
0x1EE 0x010 0x1FE 0x002
Partition 4
©
0xAA55
M.S Ramaiah School of Advanced Studies Studies - Bangalore
5
PEMP ESD531
MBR
• Solution = Extended partition (EP) : allows partitioning a primary •
• • •
partition into sub-partitions Sub-partitions are logical partitions and behave like primary partitions but are created differently The first sector of extended partition is same as MBR The first partition entry is for the first logical drive, yhe second partition entry points to the next logical drive The first sector of each PP or EP contains a boot sector MBR Boot Sector Data area of PP-1 EP Boot Sector Data area of PP-3
Boot Sector Unused Boot Sector Data area of LP-1 Unused Boot Sector Data area of LP-2
Boot Sector Data area of PP-4 ©
M.S Ramaiah School of Advanced Studies - Bangalore
6
Structure of a Partition Entry 1 Boot 1
HD
Boot flag: 0=not active, 0x80 active Begin: head number Begin: sector and cylinder number of boot sector
2 SEC
CYL
1 SYS
System code: 0x83 Linux, 0x82: swap, 0x05: extend
1
HD
PEMP ESD531
End: head number
2 SEC
CYL
End: sector and cylinder number of boot sector
4 low byte
high byte
4 low byte
high byte
Relative sector number of start sector Number of sectors in the partition
• Booting is carried out from the active partition which is determined by the boot flag ©
M.S Ramaiah School of Advanced Studies - Bangalore
7
Booting a Computer
PEMP ESD531
• Switch on. It will check disk drive (floppy or hard disk) • Boot sector contains an initial program (bootstrap program) which is run to initialize all aspects of the system - CPU registers, device controllers, memory contents. • The bootstrap program locates the OS kernel and loads it into memory. • The OS then starts executing the first process and waits for some event to occur. • The occurrence of an event is usually signaled by an interrupt from either the hardware or the software. • Hardware may trigger an interrupt by sending a signal to the CPU via the system bus. • Software may trigger an interrupt by executing a special operation called a system call. ©
M.S Ramaiah School of Advanced Studies - Bangalore
8
Board Support Package (BSP)
PEMP ESD531
• VxWorks is a modular design which isolates all hardwarespecific functionality into a set of libraries called the Board Support Package(BSP). BSP for short, it is a software-only layer (hardware dependent) • These libraries provide an identical software interface to the hardware of all boards. • A Board + its BSP = “standard” platform for an O/S (hardware independent) • They include facilities for hardware initialization, interrupt handling, hardware clock and timer control, mapping of local and bus memory, memory sizing.
©
M.S Ramaiah School of Advanced Studies - Bangalore
9
PEMP ESD531
BSP Device Initialization Frame Work Device 1
...
Device n
CPU Self initialization initialize and start Kernel Addressing Control
Random Access Memory
“C” code setup
Register with O/S
Start device
Initialize Interrupt System Remaining O/S initializations ©
M.S Ramaiah School of Advanced Studies - Bangalore
10
BSP – Relationship to O/S
PEMP ESD531
• BSP - Equivalent of a “lower” O/S layer. • It provides a “standard” set of capabilities for the main “higher” O/S to run on • eg. memory, communications, and other device interfaces • It provides a controlled startup sequence from power-on / reset (the “bootstrapping” process) • includes the pre-kernel initialization and starting up the kernel itself • Provides a set of switches to turn on/off different capabilities of and to the O/S. • All the switches together represent the “standard” platform and its allowed variants • The “ON” switches represent capabilities on the board and O/S ©
M.S Ramaiah School of Advanced Studies - Bangalore
11
PEMP ESD531
BSP – Relationship to Device Drivers
• It provides a controlled startup sequence from power-on / reset for the devices to be initialized, and started up as usable devices to the O/S and application • It provides a framework for each of the devices driver code to be included • It uses the corresponding device driver’s code for this process • The controlled start-up sequence ensures a “sane” environment which is progressively built up to full capability of the board
©
M.S Ramaiah School of Advanced Studies - Bangalore
12
Tornado Directory Tree
host
PEMP ESD531
Tornado host-resident Tools
share Shared XDR code
/usr/wind
target VxWorks OS. Board Support Package
©
M.S Ramaiah School of Advanced Studies - Bangalore
13
Host Directory Tree
host
©
PEMP ESD531
include
Header files for Tornado Tools.
host-os bin lib man
Host-specific tools.
resource
GUI, Tcl and Help supports files
tcl man
Standard Tcl distribution UNIX man pages on Tornado tools
src
Source for VxColor demo.
Tornado and GNU host executables. Tornado Tool libraries GNU man pages
M.S Ramaiah School of Advanced Studies - Bangalore
14
Target Directory Tree
config all h lib man
target
src
PEMP ESD531
Files to configure and build VxWorks Generic configuration files.
bsp-name Board Support Package (BSP) VxWorks header files Libraries provided by VxWorks
UNIX man pages Partial VxWorks source code.
unsupportedTools, drivers
©
M.S Ramaiah School of Advanced Studies - Bangalore
15
PEMP ESD531
Libraries
•VxWorks routines are grouped into libraries. •Each library has corresponding include file(s). •Examples: Library ---------taskLib memPartLib semLib lstLib sockLib
©
Routine ----------taskSpawn malloc semTake lstGet send
Include file(s) -----------------taskLib.h stdLib.h semLib.h lstLib.h types.h, socket.h sockLib.h
M.S Ramaiah School of Advanced Studies - Bangalore
16
VxWorks System Components
©
M.S Ramaiah School of Advanced Studies - Bangalore
PEMP ESD531
17
What is BSP Build/Create Means?
PEMP ESD531
• We are porting VxWorks to a new target board – VxWorks and the Tornado debugger are already available for the target processor / architecture – Tornado and VxWorks development capability is already available for the host • Reference BSP on same processor / architecture • Device driver code for devices on board • BSP template for processor architecture
©
M.S Ramaiah School of Advanced Studies - Bangalore
18
BSP primary files
PEMP ESD531
• Primary BSP files: - Source files. - Include files. - Make files. • Source files: - Generic code is written in C. Architecture specific and - performance optimized code is assembly. • Include files: - All includes and definitions specific to a CPU board are localized in two files. • Make file: - Controls building of all images
©
M.S Ramaiah School of Advanced Studies - Bangalore
19
BSP Source and Include files •
•
•
PEMP ESD531
target/config/all/configAll.h specifies default, or base configuration which applies to all boards. Modifying this file is discouraged. target/config/bsp/config.h extends or overrides the defaults specified in configAll.h for the particular board BSP. Modify this file to change the VxWorks image for this board. target/config/bsp/.h is a BSP specific header of static constructs
©
M.S Ramaiah School of Advanced Studies - Bangalore
20
Booting
PEMP ESD531
• Hardware must first be configured: • VxWorks Boot ROMs replace board manufacturer’s ROMs. • Jumpers (etc.) set as described in target\config\bsp\target.txt. • VxWorks Boot ROMs enable: • Setting boot parameters via a serial connection. • Downloading & executing VxWorks image. • Booting scenarios: • ethernet • serial • BOOTP / TFTP • shared memory network • local disk ©
M.S Ramaiah School of Advanced Studies - Bangalore
21
View more...
Comments