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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

90 Chapter 7<br />

Be<strong>for</strong>e a module is <strong>de</strong>clared, the library “SC2RTOS.h” has to be inclu<strong>de</strong>d.<br />

This allows the compiler to use the correct implementation of the SystemC<br />

constructions in every module <strong>de</strong>claration. Concerning the channels, an additional<br />

argument has been introduced in the channel <strong>de</strong>claration. This argument<br />

specifies the type of communication (HW_SW, SW_HW, SW or HW) of a<br />

particular instance of the channel. This parameter is used to <strong>de</strong>termine the<br />

correct channel implementation. The current version of the proposed software<br />

generation method is not able to <strong>de</strong>termine automatically the partitions of<br />

the processes that a particular instance of a channel communicates, thus this<br />

in<strong>for</strong>mation must be explicitly provi<strong>de</strong>d.<br />

4. APPLICATION EXAMPLE<br />

In or<strong>de</strong>r to evaluate the proposed technique a simple <strong>de</strong>sign, a car Anti-lock<br />

Braking System (ABS) [17] example, is presented in this section. The system<br />

<strong>de</strong>scription has about 200 SystemC co<strong>de</strong> lines and it inclu<strong>de</strong>s 5 modules with<br />

6 concurrent processes.<br />

The system has been implemented in an ARM-based plat<strong>for</strong>m that inclu<strong>de</strong>s<br />

an ARM7TDMI processor, 1 Mb RAM, 1 Mb Flash, two 200 Kgate FPGAs,<br />

a little configuration CPLD and an AMBA bus. The open source eCos<br />

operating system has been selected as embed<strong>de</strong>d RTOS. In or<strong>de</strong>r to generate<br />

software <strong>for</strong> this plat<strong>for</strong>m-OS pair, a SystemC-to-eCos Library has to be<br />

<strong>de</strong>fined. This library is application in<strong>de</strong>pen<strong>de</strong>nt and it will allow the generation<br />

of the embed<strong>de</strong>d software <strong>for</strong> that plat<strong>for</strong>m with the eCos RTOS.<br />

The SC2ECOS (SystemC-to-eCos) Library has about 800 C++ co<strong>de</strong> lines<br />

and it basically inclu<strong>de</strong>s the concurrency and communication support classes<br />

that replace the SystemC kernel. This library can be easily adapted to a different<br />

RTOS.<br />

The main non-visible elements of the concurrency support are the uc_thread<br />

and exec_context classes. The uc_thread class maintains the set of elements<br />

that an eCos thread needs <strong>for</strong> its <strong>de</strong>claration and execution. The exec_context<br />

class replaces the SystemC sc_simcontext class during software generation.<br />

It manages the list of <strong>de</strong>clared processes and its resumption. These elements<br />

call only 4 functions of eCos (see Table 7-2):<br />

Table 7-2. eCos functions called by the SC2eCos library.<br />

Thread<br />

management<br />

Synchronization<br />

managament<br />

Interruption<br />

managament<br />

eCos Functions<br />

cyg_thread_create<br />

cyg_thread_resume<br />

cyg_user_start<br />

cyg_thread_<strong>de</strong>lay<br />

cyg_flag_mask_bits<br />

cyg_flag_set_bits<br />

cyg_flag_wait<br />

cyg_interrupt_create<br />

cyg_interrupt_attach<br />

cyg_interrupt_acknowledge<br />

cyg_interrupt_unmask

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

Saved successfully!

Ooh no, something went wrong!