TNKernel port for the ARM Cortex-M3
Description
1. Hardware-specific information
With a Cortex-M3 core, TNKernel uses SysTick timer as
system timer source.
TNKernel operates in a privileged mode and uses
separate PSP (Process Stack Pointer) for each task.
2. Nested interrupts
A Cortex-M3 Nested Vectored Interrupt Controller (NVIC) is a part of
the CPU and performs nested interrupt processing with two most
important features:
- at
the interrupt entry, the CPU automatically saves
processor state
(registers PC, xPSR, r0-r3, r12, LR), which is pushed on to the stack.
- the
processor doesn't automatically disabled interrupts, when it
takes an exception (interrupt). It means that RTOS must
support
nested interrupts.
A TNKernel for Cortex-M3 completely supports nested interrupts. To recognize a nested interrupt condition, a two macros are used:

A function tn_inside_int() uses Cortex-M3 NVIC status register VECTACTIVE flag:
3. Context switching with Cortex-M3
With Cortex-M3 core, TNKernel
uses unified approach to request context switch - an invoking SVPend
exception (interrupt).
A SVPend exception priority is minimal (0xFF) and SVPend will be
processed last in the nested interrupts chain.
Inside an interrupt processing or inside TNKernel semaphores,
queues and other similar operations, when a context switch is required under certain conditions,
the system calls SVPend.
An each interrupt handler function calls a tn_int_exit()
function as the last operation. A tn_int_exit()function is a just PendSV
exception request:

Inside the SVPend interrupt handler, the system checks a context switching conditions and performs the operation, if it is necessarily.
A context switch routine is similar to
the Example 5-5 (Implement a simple context switcher) of the Cortex™-M3 Technical Reference
Manual (ARM DDI 0337E document).
The full register set is saved only at the context switch (at
the interrupt entry, the CPU automatically saves some
registers -see above).
Downloads
| tnkernel-2-6-CortexM3.zip |
TNKernel v. 2.6 Cortex M3 port source code.
The file also contains an examples for NXP LPC1766 MCU and projects for Rowley CrossStudio 1.7 and 2.0, IAR ARM 6.xx, GCC 4.x (CodeSourcery), Keil 4.xx |
| tnkernel-2-5-3-CortexM3-LPC1766.zip |
- A TNKernel Cortex-M3 port source code (ver. 2.5.3)
- An examples(source code) for the NXP(c) LPC1766 MCU - A projects for the Rowley CrossWorks Studio 1.7, Keil RVC v.3.xx, IAR ARM v.5.xx, GCC 4.3.2 (Codesourcery 2008q3-66) |
| tnkernel-cm3-1-0-src.zip |
- A TNKernel Cortex-M3 port source code
- An examples source code for the STMicroelectronics(c) STM32F103RBT6 MCU - A projects for the Rowley CrossWorks Studio 1.7, Keil RVC v.3.24, IAR ARM v.5.20, GCC 4.3.2 (Codesourcery 2008q3-66) |
| tnkernel-cm3-lm3sx-1-0-src.zip |
- An examples source code for the Luminary Micro(c) LM3S811 MCU
- A projects for the Rowley CrossWorks Studio 1.7, Keil RVC v.3.24, IAR ARM v.5.20, GCC 4.3.2 (Codesourcery 2008q3-66) |