Title: Koala
1Koala
- A Component Model for Building System Software
OpenCOM Reading Group
Jó Ueyama November 2004
2Overview
- What is Koala?
- Languages
- The component model
- Binding
- Analysis and comparison with OpenCOM
3What is Koala?
- Koala is
- architectural description language
- component model for development of embedded
software for consumer electronics products - It is used to build a large diversity of products
from a repository of components
4Languages
- CD - Component definitiondescribes components
referring to component definitions and interface
definitions - ID - Interface definitiondescribes function
prototypes and constants referring to datatype
definitions - DD - Datatype definitiondescribes datatypes
referring to other datatypes
5Koala Component Model - Concepts
- Component is a unit of encapsulation
- An interface is a small and coherent set of
functions - A module is a unit of code
- A Binding is a connection between interfaces
6Koala Interfaces
- Provide
- Like interfaces in Java and COM/XPCOM
- Require
- Similar to our OpenCOM receptacle
- Multiple
- Handle evolution and diversity
- Optional
- Fine tune/similar to COM QueryInterface
7Koala Interface Definition
- An interface definition describes the syntax and
semantics of a small set of functions
- Syntax names and types of functions and
arguments. - Semantics a (simple) logical model of the
behaviour. - Interfaces consist of constants and functions
only.
ID
interface ISoundControl // sdc void
SetVolume(Volume v) void SetTreble(Treble b)
8A Koala Component
- Koala Component
- Implemented in C
- Component Definition
- A group of components can be seen as components
(compound component)
C3
s1C1
s2C2
Component CtunerDriver provides ITuner
ptun IInit pini
requires II2c ri2c
r1
p3
9Datatype Definition
- An datatype definition declares a datatype that
is used for typing parameters in functions
(occurring in interfaces)
Ordinary C header file with machine readable
comments embedded
DD
typedef char Int8 / koala type Int8
/ typedef char Bool / koala type Bool /
10Modules
- Modules is a hand-written C file and a generated
header file - It can also be used to glue interfaces
- Module actually implements the component.
11Koala
workspace C C1 c1.cd m.c c1.c m.h
C2 c2.cd m.c c2.c m.h C3 c3.cd
c3.c I I1.id I2.id D global.h enums.h
workspace C C1 c1.cd m.c C2
c2.cd m.c C3 c3.cd I I1.id
I2.id D global.dd enums.dd
Koala loads the definitions, and writesh files
for module andc files for components
koala -pcr C -pir I -ptr D C3
12Binding
- Static Binding
- Usage of symbolic names
- Compiler generates define
- Glue Binding
- Glue code may be inserted as a module to allow
fine tune binding at the configuration time - Dynamic Binding
- Implemented by switches which route connection
between interfaces depending on the value of a
certain function.
13Static Binding
- Interfaces must be bound tip to base
interface I void f(void) void g(int x)
component C1 requires I r
s1C1
rI
CD
contains component C1 s1 component C2
s2 connects s1.r s2.p
component C2 provides I p
pI
s2C2
14Static Binding Implementation
/ file m1.c / include m1.h void
SomeFunc(void) r_Func(54)
/ Koala generated m1.h / define r_Func
C__p_func extern void C__p_Func(int x)
D
m1
r
p
Koala generated
handcrafted
C
m2
/ file m2.c / include m2.h void p_Func(int
x) x
/ Koala generated m2.h / define p_Func
C__p_func extern void C__p_Func(int x)
15Gluing
- Glue code may be inserted in a binding in the
form of a module... - the header file of m is generated
- the C file of m is hand written.
- This allows to fine tune components at the level
of configurations.
s1C1
contains component C1 s1 component C2 s2
module mconnects s1.r m m s2.p
rI
m
pI
s2C2
16Dynamic Binding by Switches
Dynamic Binding by Switches
A switch allows to create bindings that depend on
the value of certain functions.
In the example, p is connected through the switch
to either pp or i, depending on the value of the
control function in interface d. Koala optimises
switches if the setting is known at compile time,
and generates switch code otherwise.
p
d
pp
i
sC
17Function Binding
- Functions are bound on the basis of their name
- Sometimes, we must bind functions of different
names.
Within m cfre.rtun.SetFrequency(x)
ctun.ptun.SetFrequency(x) cfre.rtun.GetFreque
ncy() ctun.ptun.GetFrequency()
cfre.rtun.EnableOutput(x) chip.pout.EnableOutput
(x)
18Optional Interfaces
- Interfaces must be connected at the tip, unless
they are declared optional.
- Optional interfaces allow components to evolve
over time, without having to change existing
configurations.
A2
B
C2
19Analysis and Comparison
- Koala component is implemented only in C
- Suitable for electronics software
- But maybe not for other application domains
- Authors claim explicitly that Koala doesnt
support COM or Java components. - Component are not designed to be deployed in
other architectures - Third-party development not heavily addressed
- Limited re-configuration mechanisms
20Koala Caplet?
- Koala Caplet (as proof of concept)
- Generate Koala components and
- Deploy them on a Linux process?