DioneOS
   HOME

TheInfoList



OR:

DioneOS (pronounced /djoneos/) is a multitasking preemptive,
real-time operating system A real-time operating system (RTOS) is an operating system (OS) for real-time applications that processes data and events that have critically defined time constraints. An RTOS is distinct from a time-sharing operating system, such as Unix, which m ...
(RTOS). The system is designed for
microcontroller A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable i ...
s, originally released on 2 February 2011 for the
Texas Instruments Texas Instruments Incorporated (TI) is an American technology company headquartered in Dallas, Texas, that designs and manufactures semiconductors and various integrated circuits, which it sells to electronics designers and manufacturers globall ...
TI MSP430x, and then on 29 March 2013 for the
ARM Cortex-M3 The ARM Cortex-M is a group of 32-bit reduced instruction set computer, RISC ARM architecture, ARM processor cores licensed by Arm Holdings. These cores are optimized for low-cost and energy-efficient integrated circuits, which have been embedd ...
. Target microcontroller platforms have limited resources, i.e., system clock frequency of tens of
MHz The hertz (symbol: Hz) is the unit of frequency in the International System of Units (SI), equivalent to one event (or cycle) per second. The hertz is an SI derived unit whose expression in terms of SI base units is s−1, meaning that one he ...
, and memory amounts of tens to a few hundred
kilobyte The kilobyte is a multiple of the unit byte for digital information. The International System of Units (SI) defines the prefix ''kilo'' as 1000 (103); per this definition, one kilobyte is 1000 bytes.International Standard IEC 80000-13 Quantiti ...
s (KB). The RTOS is adapted to such conditions by providing a compact and efficient image. The efficiency term here means minimizing further
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, an ...
(CPU) load caused by system use. According to this definition, the system is more effective when it consumes less CPU time to execute its internal parts, e.g., managing threads. The DioneOS system is intended for autonomic devices where user interface has limited functions. The core functions provided by the system is an environment for building multitasking firmware by means of standard, well known concepts (e.g. semaphores, timers, etc.). Because of the target domain of application, the system uses a
command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
and has no
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
.


Memory model

Texas Instruments Texas Instruments Incorporated (TI) is an American technology company headquartered in Dallas, Texas, that designs and manufactures semiconductors and various integrated circuits, which it sells to electronics designers and manufacturers globall ...
company manufactures a wide range of
microcontroller A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable i ...
s that use the MSP430 core. Depending on the version, the processor contains different amount of
flash memory Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for the NOR and NAND logic gates. Both us ...
and
random-access memory Random-access memory (RAM; ) is a form of computer memory that can be read and changed in any order, typically used to store working Data (computing), data and machine code. A Random access, random-access memory device allows data items to b ...
(RAM), e.g., MSP430f2201 has 1KB/128B correspondingly, but MSP430f5438 has 256KB/16KB. When the size of the memory exceeds 64 KB limit, as happens when the memory cannot fit in a range 0–64 KB,
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mos ...
addressing is insufficient. Due to this constraint, chips with larger memory are equipped with extended core (MSP430x). This version of the
processor Processor may refer to: Computing Hardware * Processor (computing) **Central processing unit (CPU), the hardware within a computer that executes a program *** Microprocessor, a central processing unit contained on a single integrated circuit (I ...
has wider registers (20-bit) and new
instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection of instructions Music * Instruction (band), a 2002 rock band from Ne ...
for processing them. At compiling, the programmer selects the type of memory model (''near'' or ''far'') that is used for and memories. This choice determines accessible memory range, hence when the above 64 KB limit is programmed, the ''far'' model must be used. The DioneOS supports the ''far'' model for code modules, so large firmware that uses extended can be developed and run under the system's control. The system uses the ''near'' memory model for data segments.


Thread management

The firmware started under the DioneOS system consists of threads that are executed in pseudo-
parallel Parallel is a geometric term of location which may refer to: Computing * Parallel algorithm * Parallel computing * Parallel metaheuristic * Parallel (software), a UNIX utility for running programs in parallel * Parallel Sysplex, a cluster of IBM ...
way. Each thread has its own, unique priority used for ordering the threads, from most important to least. The thread priority value defines a precedence for running over others. In the DioneOS system the thread can be in one of following states: * Running - the thread is currently executed by processor, * Ready - the thread is ready to be run, * Waiting - the thread is blocked and waits on some synchronization object. Because there is only one core in the processor, only one thread can be in Running state. This is the thread that has the highest priority from all threads that are not in Waiting state. Change of the thread state can be caused by: *
trigger Trigger may refer to: Notable animals and people ;Mononym * Trigger (horse), owned by cowboy star Roy Rogers ;Nickname * Trigger Alpert (1916–2013), American jazz bassist * "Trigger Mike" Coppola (1900–1966), American gangster ;Surname * Bru ...
ing an object, that hold the thread, * unsuccessful acquiring the object that is already locked (e.g. a mutex that is owned by someone else), * elapsing timeout, * state change of another thread, that may lead to preemption. The system handles up to 16 threads, including idle one with the lowest priority. The idle thread should be always ready to be run, and never switched to Waiting state, so it is not permitted to call any functions that would block from inside this thread. The idle thread can be used to determine total system load.


Features of the system

The DioneOS system provides: * items for synchronisation: mutexes and counting semaphores, used for thread synchronization, signalling from ISR to a thread and guarding shared resources, * methods for time management: timers, thread sleeping, timeouts, * communications items implemented by events and queues available as
circular buffer In computer science, a circular buffer, circular queue, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams. Ther ...
s, * memory management by
memory pool Memory pools, also called fixed-size blocks allocation, is the use of pools for memory management that allows dynamic memory allocation comparable to malloc or C++'s operator new. As those implementations suffer from fragmentation because of va ...
that allocates memory only in fixed-size blocks but is free of fragmentation issues that may appear when heap is used. Regular allocation by malloc/free on heap is also available, it is provided by standard C
libraries A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
. * testing support objects: signaling events on chip pins, critical exceptions, objects marking that helps is detection of errors like use of deleted object or double memory deallocation, etc.


Context switch

As it was stated in the 'Threads Management' chapter, the firmware consists of pseudo-parallel threads. Each thread has its own context, that contains core registers of the processor, last execution address and private stack. During the switch between threads the system saves the context of stopped thread and recovers the context of the one being run. This state saving makes possible breaking the thread execution and further continuation, even if between them other thread has been executed. Note that preemption followed by
context switch In computing, a context switch is the process of storing the state of a process or thread, so that it can be restored and resume execution at a later point, and then restoring a different, previously saved, state. This allows multiple processes ...
may happen in any moment, even if no system function is called in the thread. Although it may happen in unexpected location in the executed code, the thread work is not distorted due to the system and the context saving. From the thread point of view, the switch can be done in background. The context switch is critical operation in the system and the time of its execution determines if how effective the system is. Because of that the context switch in the DioneOS system was optimized for short time. The most important parts were written in
assembler Assembler may refer to: Arts and media * Nobukazu Takemura, avant-garde electronic musician, stage name Assembler * Assemblers, a fictional race in the ''Star Wars'' universe * Assemblers, an alternative name of the superhero group Champions of A ...
, so the switch can be done in 12–17 μsswitching time depends on the system configuration, the longer value appears when the switch is interfered by system tick interrupt. (for fosc=25 MHz). In the DioneOS system the context switch can be initiated from
interrupt handler In computer systems programming, an interrupt handler, also known as an interrupt service routine or ISR, is a special block of code associated with a specific interrupt condition. Interrupt handlers are initiated by hardware interrupts, softwar ...
(interrupt service routine). This property is useful for moving an event handling to the thread and commonly implemented in two-layer architecture: * the interrupt handler - is called after hardware interrupt has occurred. In this part interrupts are disabled, so execution cannot be continued for long time, otherwise the system responsiveness is compromised. In this layer only jobs that require fast response for interrupt should be processed, any others should be passed to higher layer, * higher layer - processing in separated thread without blocking interrupts; this thread can be preempted. Constraints are not so tight here as in the interrupt handler. The code execution does not block the system. * The context switch measured from signaling point in ISR to other thread recovery takes 10us (for fosc=25 MHz) in the DioneOS system.


Configuration

The DioneOS has multiple configuration options that affects features inserted in the compiled image of the system. A lot of them are source code switches that are gathered in
configuration file In computing, configuration files (commonly known simply as config files) are computer file, files used to configure the Parameter (computer programming), parameters and Initialization (programming), initial settings for some computer programs. T ...
and can be altered by a developer of
firmware In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide h ...
. By this means it is possible to control additional testing parts. If they are enabled the system is built in a version that provides more detection of unusual conditions and run-time information that helps in debugging process. When the errors are found and eliminated these extra features can be disabled for having full performance of the system. Example of a fragment of configuration file: .. #define CFG_CHECK_OVERFLOW /* overflow testing in semaphores/mutexes */ #define CFG_CHECK_LOCK /* lock issue detection caused by preemption conditions during scheduler lock */ #define CFG_LISTDEL_WITH_POISON /* marking deleted items on the list in os_list1_del()*/ #define CFG_MEM_POOL_POISON_FILL 0xDAAB /* pattern for marking de-allocated memory items */ #define CFG_LISTDEL_POISON 0xABBA /* pattern for marking removed list items */ #define CFG_CHECK_EMPTY_SEM_DESTROY /* testing semaphore before destroy in os_sleep()*/ #define CFG_FILL_EMPTY_MEM_POOL /* free memory fill with pattern */ ..


References


External links

* {{Real-time operating systems Real-time operating systems Embedded operating systems