LPC2148 ARM7 myKernel Details - Bhavin Kamdar
Keil’s RTX Kernel Features Active Tasks 250 Scheduling Round-Robin,Premeptive Task Priorities 1-250 Kernel RAM space < 300 bytes RAM space for task TotalStackSize+52 bytes Task Stack space On-demand Semaphores/Mutex Yes User timers Unlimited
TotalStackSize+RAM variables MyKernel Features Active Task 8 Scheduling Round-Robin Kernel RAM space 256 bytes RAM space per task TotalStackSize+RAM variables Stack Size 512 bytes per task Semaphores/Mutex Yes User Timers Yes (Limited) Hardware RTC
myKernel Memory map The first 4096+256 bytes of RAM space is reserved for the kernel and task stack Each task is assigned 512 bytes of stack (512 * 8=4096 bytes) The kernel requires 256 bytes of memory to store task stack pointers, task return addresses and other scheduler variables
myKernel Scheduler The scheduler for myKernel is written completely in assembly to have full control over task stack and context switching. Scheduler executes in privilged mode of ARM whereas all task are executed in user mode only. Two complementary functions are provided in scheduler to add and remove tasks.
myKernel Scheduler (cntd) Each task is given a time slice of 10ms The task context during a task switch is saved and retrieved from the task stack only Scheduler identifies task by a 8 bit process ID (PID).
Mutex / Task lists Each peripheral (UART0, GLCD, MMC and BT module) has its own binary semaphore Semaphore checking is implemented in assembly to provide true Read-while-write access Also each peripheral has an optional task list which allows access to peripheral in turn.