TNKernel
Introduction
Software
Hardware
How to build
Download
 

Introduction

From http://www.tnkernel.com: "TNKernel is a compact and very fast real-time kernel for the embedded 32/16/8 bits microprocessors.

TNKernel performs a preemptive priority-based scheduling and a round-robin scheduling for the tasks with identical priority. The current version of TNKernel includes semaphores, mutexes, data queues, event flags and fixed-sized memory pools. The system functions calls in the interrupts are supported.

TNKernel is a fully portable (is written mostly in ANSI C except the processor-specific parts), but the current version of TNKernel has been ported for the ARM, Microchip (r) PIC24/dsPIC and Freescale (r) HCS08 and ColdFire(r) microprocessors.

TNKernel has been written "under the significant influence" of the µITRON 4.0 Specifications.

µITRON 4.0 Specifications is an open real­time kernel specification developed by the ITRON Committee of the TRON Association. The µITRON 4.0 Specification document can be obtained from the ITRON Project web site (http://www.assoc.tron.org/eng/document.html ).

TNKernel is distributed in the source code form, free of charge under the
FreeBSD-like license."

TNKernel has been created by Yuri Tiomkin, his page can be find here.

Software

Compared to the build from Yuri I made some small structural changes, which should alleviate the maintenance and creation of new ports. A new port is a new CPU family and not a CPU from this family itself. I tested only the ports where hardware was available, see hardware section. If your port is not available, take a look at the original TNKernel page. It is possible that you will find your port there (e.g. PIC24/dsPIC, HCS08, ColdFire).

My structure of the software looks like:

The ARM port was tested with CrossWorks for ARM v2.0.3 and v1.7b21. For the Cortex-M3 port CrossWorks for ARM v2 is needed. The project files for the corresponding port can be found inside the prj directory. Inside the src directory you will find main.c and a hardware.c file.

The tnkernel directory is now divided in several sub directories. The version and the source which is needed for TNKernel itself. The core part of TNKernel reside inside the source directory.

Compared to the original structure, the following changes were made inside the source directory. The tn_port.c/h files was renamed to tn_arch.c/h, arch for architecture. At the same time the files was split in a general architecture file tn_arch.c and in the specific files like:

  • tn_arch_arm.c
  • tn_arch_cm3.c
  • tn_arch_arm_gcc.s
  • tn_arch_cm3_gcc.s

The tn_port name is now reserved for the port specific parts which can be found in the corresponding sub directories from the port directory itself. Currently ports exist for the following families:

  • AT91SAM7
    • tn_port_sam7.c
    • tn_port_sam7.h
  • AT91SAM3
    • tn_port_sam3.c
    • tn_port_sam3.h
    • tn_port_sam3_irq.c
  • LPC2000
    • tn_port_lpc2000.c
    • tn_port_lpc2000.h
  • LPC1000
    • tn_port_lpc1000.c
    • tn_port_lpc1000.h
    • tn_port_lpc1000_irq.c
  • STR71X
    • tn_port_str71x.c
    • tn_port_str71x.h
  • STM32
    • tn_port_stm32.c
    • tn_port_stm32.h
    • tn_port_stm32_irq.c

If your port is not available, take a look at the original TNKernel page. It is possible that you will find your port there (e.g. PIC24/dsPIC, HCS08, ColdFire).

Hardware

The blinky example was tested on the following eval boards. If you have a different board check the file hardware.c, where you will find the setup for the LED.

Port Board Compiler Setting
AT91SAM7 AT91SAM7X-EK TNARCH_ARM, TN_PORT_SAM7
AT91SAM3 SAM3U-EK TNARCH_CM3, TN_PORT_SAM3
LPC2000 LPC-P2148 TNARCH_ARM, TN_PORT_LPC2000
LPC1000 MCB1760 TNARCH_CM3, TN_PORT_LPC1000
STR71X HITEX STR7 TNARCH_ARM, TN_PORT_STR71X
STM32 STM3210E-EVAL TNARCH_CM3, TN_PORT_STM32

How to build

To handle the new structure, some compiler defines must be set. For the architecture you must set one of the following:

  • TN_ARCH_ARM and TNKERNEL_PORT_ARM               (ARM Architecture)
  • TN_ARCH_CM3 and TNKERNEL_PORT_CORTEXM3  (Cortex-M3 Architecture)

And for the several ports set of the following:

  • TN_PORT_SAM7
  • TN_PORT_SAM3
  • TN_PORT_LPC2000
  • TN_PORT_LPC1000
  • TN_PORT_STR71X
  • TN_PORT_STM32

Download

TNKernel Users guide v2.3 (381 KB)

TNKernel v2.5.1 & blinky app (484KB)

TNKernel v2.5.3 & blinky app, tested with CrossWorks for ARM 2.0.5 (478KB)

TNKernel v2.6.0 & blinky app, tested with CrossWorks for ARM 2.0.10 (489KB)