29.01.2015 Views

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

118 Chapter 9<br />

varying hardware plat<strong>for</strong>ms; and<br />

varying implementation languages.<br />

The approach chosen to reflect and provi<strong>de</strong> support <strong>for</strong> these variabilities<br />

at the UML level consisted in <strong>de</strong>fining stereotypes and associated tagged<br />

values – the UML’s primary means of extension. Using «OS-specific»,<br />

«plat<strong>for</strong>m–specific», and «language–specific» stereotypes, mo<strong>de</strong>l<br />

elements were marked as specific with respect to one (or more) of these<br />

dimensions (<strong>for</strong> an example of their usage, see class SerialIO in the class<br />

diagram of Figure 9-4).<br />

Even though adding a different implementation language to the framework<br />

obviously represents an immense ef<strong>for</strong>t, and C++ has been the only inten<strong>de</strong>d<br />

language, the framework was <strong>de</strong>signed so as to reduce <strong>de</strong>pen<strong>de</strong>ncies on a<br />

specific language’s capabilities. More precisely, the set of OO features used<br />

was limited to that of the Java programming language wherever viable because<br />

the latter’s set of supported OO notions was consi<strong>de</strong>red a common <strong>de</strong>nominator<br />

among current OO languages. Inevitable C++ specifics were accounted<br />

<strong>for</strong> by using <strong>de</strong>dicated Real-Time-Studio -provi<strong>de</strong>d stereotypes, avoiding<br />

pollution of the actual mo<strong>de</strong>l with language specifics.<br />

In or<strong>de</strong>r to provi<strong>de</strong> <strong>for</strong> the extensibility <strong>de</strong>man<strong>de</strong>d from a framework, some<br />

of the mechanisms suggested in the UML-F profile [9] were applied. These<br />

consisted in the use of specific stereotypes to <strong>de</strong>signate hot spots of<br />

(explicitly) expected extensions. These stereotypes, in contrast to the ones<br />

introduced above, however, are of a mere documentary nature.<br />

Since the framework resembles, in first regard, a mapping from a constant<br />

high-level API to a set of native APIs of different operating systems and<br />

hardware plat<strong>for</strong>ms, only few interactions were sufficiently complex to warrant<br />

dynamic mo<strong>de</strong>ling. Methods were implemented manually within the UML<br />

tool, and sequence diagrams were used to illustrate the behavior of more<br />

complex implementations. The manually-implemented dynamic co<strong>de</strong> was<br />

complemented by Real-Time Studio’s co<strong>de</strong> generator, effectively realizing<br />

the vision of “single-click” co<strong>de</strong> generation.<br />

A mapping from mo<strong>de</strong>led to co<strong>de</strong>-level variabilities with respect to OS and<br />

plat<strong>for</strong>m was achieved by adapting Real-Time Studio’s co<strong>de</strong> generation<br />

templates to surround the respective mo<strong>de</strong>l elements’ source co<strong>de</strong> artifacts<br />

by pre-processor statements, reducing the problem to conditional implementation.<br />

Likewise, <strong>de</strong>pen<strong>de</strong>nt fragments of methods’ bodies implemented within<br />

the UML tool accounted <strong>for</strong> such variabilities through the explicit use of<br />

conditional pre-processor statements. The resulting co<strong>de</strong> can be configured<br />

and compiled <strong>for</strong> a given hardware plat<strong>for</strong>m by <strong>de</strong>fining appropriate preprocessor<br />

constants.<br />

This static management of variabilities (as opposed to run-time <strong>de</strong>pen<strong>de</strong>ncies)<br />

is sufficient since OS, plat<strong>for</strong>m, and language <strong>de</strong>pen<strong>de</strong>ncies can all<br />

be resolved at build time. This still allows <strong>for</strong> later variability with respect<br />

to the features used in an application since the latter will only inclu<strong>de</strong> those

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!