KRNL - An Arduino Kernel - Usage and Configuration and Install

Just install krnl.zip in you arduino IDE

Optimization

Two important things to optimize for:

  • ram usage

  • cpu usage

Different Arduinos has from 512B up to 8 kB or RAM.

KRNL use of RAM is static and is set by call to k_init

You have to give max number of tasks, semaphores and message queues as parameters to k_init

IF you try to create more tasks, semaphores or message queues than the limit you have given by k_init SNOT will NOT start when you are calling k_start !!!

Stack

There shall be space for at least a context swicth on the stack which is approx 35 B on top of your use of local variabels in functions.

KRNL call k_stak_usage can write og Serial stack status (unused stack) for your tasks. To be able to write you have to define STAK_USAGE in krnl.h

k_unused_stak returns as name indicate unused stack for a task

rest has to be corrected /JDN

maybe not all up to date

A test setup

  • 4 tasks

  • 3 semaphores

  • 2 message queues

gives (432)*15 + 2*12 + 34 = 193B plus stak for the tasks

100B for each task gives 193 + 400B = 600B of RAM usage.

happy krnl hacking