Archive for the ‘OS’ Category

L4/Iguana Learning

There is a lot of buzz going around for virtualization systems where a base system (for example L4 based micro-kernel) supporting other real-time operating systems such as Linux variants, WinCE, Symbian, REX etc.

The primary reason is to provide more secure and highly reliable systems to the manufacturer of embedded systems. The GPL license makes a bit difficult for the manufacturers to adopt for open systems as they have to expose their firmware to the public. NICTA initiate is the response to address the smilar issues and provide a high end systems to the market.

http://markustips.blogspot.com

GCC C __attribute__ feature

Most of compilers support optimization level in which each level has special significance to optimize the source in terms of size, performance etc. This can be enabled by specified command line arguments, mostly known as options.

Moreover GCC compiler has a special characteristic additionally – declaring attributes of a function. The source can be optimized at programming level. While writing the source, the programmer has a chance to instruct the compiler to what should be taken care.

__attribute__ keyword is used when a function (declared only) is a declared and the corresponding instruction/s is/are mentioned with it.  There are many ways to do nasty things with it found here.

In the embedded system, the code is nicely put together in different sections according to the design/requirements.  The code goes into the text section. It happens that while starting the OS, it is so better to gather the initialization code together that as soon as the initialization is over, the related code can be removed from the main memory.  This can be achieved by combining initialization code into init section i.e  __attribute__ section(“.init”). This is where my journey has started for attribute feature.

This function attibute has been widely used in L4 micro-kernel, which provides a secured approach for embedded systems facilitating the hardware manufactures to protect their patents/innovation without exposing to the outside world.

There are many things can be done using Linux and GCC pair, but today this is enough to start with.

Nucleus – Interrupt Handling

In most of RTOS, whenever an interrupt arrives, the interrupt vector table’s corresponding routine is invoked to execute some piece of code to take the required action for that interrupt.

Nucleus RTOS had peculiar interrupt handling mechanism which is not found in some of those RTOS mechanism. Nucleus interrupts are handled in two phases called LISR (Low level ISR-Interrupt Service Routine) and HISR (High level ISR) parts.

The LISR routine is similar to existing RTOS’s ISR, but the important difference is if required more processing, it activates the corresponding HISR.  During LISR processing, only limited system calls are allowed and minimal processing is done. This ensures to respond to interrupt in very quick manner and reduces the latency for the same.

The HISR are scheduled similar to the task. They have priority 0 to 2 that are the highest priority levels defined by Nucleus. The remaining 3 to 255 priority levels are given to the tasks.  The lower the priority value, the higher the chances of task or HISR to get scheduled. The HISR can access most of the system calls.

Moreover, whenever the scheduler runs, it checks any activated HISR first. If found, it schedules all HISR before any of the task is scheduled.  This allows to perform the required extra processing in HISR after LISR is executed without spending much time in ISR.