window ce
TRANSCRIPT
What can CE do
– Industrial Automation
– Set-Top Boxes
– Medical Devices and Systems
– ATMs
– Projectors and Large Screen Displays
– VoIP Devices
– First edition released in 1996
– Windows CE .NET 4.x is widely used
Introduction to BSP
• Windows CE can run on different hardware platforms.
• How can we do that?
• The answer is BSP !• Board Support Package is the software that
implements and supports the OEM adaptation layer (OAL) and device drivers for a standard development board (SDB).
Compare with Desktop Version
– Windows XP : 1.5GB
No inherent real time support
256 levels of thread priority
Minimal : 200KB Windows XP : 1.5GB
Lager and lager… Can NOT be
customized
Quick and easy to customize OS for a particular system
More than 200 optional component
Compact Version of Win32 API, MFC..
UNICODE only
ASCII / UNICODE
Commercial software, source code is MS 1st level secret.
70% of Windows CE 5.0 source code is shared.
Memory Management
– Windows CE uses ROM (read only memory), RAM (random access memory)
• The ROM in a Windows CE system is like a small read-only hard disk
• The RAM in a Windows CE system is divided into two areas: program memory and object store
– Windows CE is a 32-bit operating system, so it supports 4GB virtual address space
Memory Management…..
– Upper 2GB is kernel space, used by the system for its own data
– Lower 2GB is user space
• 0x42000000-0x7FFFFFFF memory is used for large memory allocations, such as memory- mapped files
• 0x0-0x41FFFFFF memory is divided into 33 slots, each of which is 32MB
Processes and Threads Management
– Windows CE limits 32 processes being run at any one time
– Every process at least has a primary thread associated with it upon starting (even if it never explicitly created one)
– A process can created any number of additional threads (only limited by available memory)
– Each thread belongs to a particular process (and shares the same memory space)
– SetProcPermissions API will give the current thread access to any process
– Each thread has an ID, a private stack and a set of registers
Processes and Threads Management…..
– When a process is loaded
• Assigned to next available slot
• DLLs loaded into the slot
• Followed by the stack and default process heap
• After this, then executed
– When a process’ thread is scheduled
• Copied from its slot into slot 0
– This is mapped back to the original slot allocated to the process if the process becomes inactive
Processes and Threads Management…..
– Thread– A unit of execution – A piece of code that can be scheduled to run by the kernel– May be launch by a process or a driver
– Process– A collection of threads with a common execution environment– A process has at least on thread– Launch from an executable file– Can create threads to handle interrupts
– Driver– A DLL, (dynamically loaded library) loaded into the device
manager process– Supports the Device I/O Control Interface– Can create threads to handle interrupts
Processes and Threads Management…..
– Processes allocate stack for each thread, the default size is 64KB, depending on the link parameter when the program is compiled
• Top 2KB used to guard against stack overflow
• Remained available for use
– Variables declared inside functions are allocated in the stack
– Thread’s stack memory is reclaimed when it terminates
Scheduler
– Is responsible for determining which thread will run– Has a queue for threads for each priority level– Will always schedule the first thread at the highest priority level
– A thread gets to run for set length of time, called a quantum
– Typically 100 milliseconds– A quantum of 0 means the quantum never runs out
• The thread can run until blocked or interrupted
– A Thread runs until—– Its quantum runs out– It is interrupted by a higher priority thread– Its blocked by a resource contention
• Such as access to a critical section or a mutex
ISRs And ISTs
– Interrupt Service Routine (ISR)– A piece of code loaded into the kernel
– Assigned to a particular IRQ
– Called immediately to handle the hardware interrupt
– Should be written to run quickly with few outside dependencies
– Can be chained together if multiple device might use the same IRQ
– Notifies the kernel which IST should run
– Interrupt Service Thread (IST)– A thread registered to handle an interrupt
– Can be created by either a process or a driver
– Scheduled like any other thread on the system
– Should be written to do the bulk of the interrupt handling work
Priority Levels
– Windows CE 5.0 has 256 levels of priority
– Level 0 is the highest and 255 is the lowest
• The old CE model of 8 levels now map to the lowest 8 of the new model
– The default level for a thread is 252
– Levels 0 through 248 can be reserved by OEM