RTSC Module Primer

From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 29-Jul-2014 21:07 UTC

RTSC Module Primer

Producing and consuming spec'd modules

This Primer puts RTSC modules front-and-center. Initially focusing on how you (playing the role of "client") would consume RTSC modules within C programs, we'll eventually explain how you (playing the role of "supplier") could just as easily produce C-based modules of your own—consumed in turn by others as part of a larger RTSC application.

Along the way, the Primer will introduce two special-purpose languages which (working hand-in-hand with standard C) forge a symbiotic alliance of programming capabilities that RTSC names eXpanDed  C:

  • XDCspec serves as RTSC's specification language—used here to define a module's programmatic boundary (what others term its API) as a formal contract between client and supplier; and

  • XDCscript serves as RTSC's meta-language—used here by suppliers and clients alike to streamline host-based production/consumption of spec'd modules targeted for a range of execution platforms.

Acknowledging general industry trends towards employing flexible, re-usable software components—but also recognizing the challenges of achieving these ideals with C alone—the eXpanDed  C model exemplified throughout the Primer effectively takes the ever-familiar C programming language to entirely new heights.

As an overarching objective, RTSC promises a higher-level form of C programming—one suitable for developing, delivering, and deploying real-time software components—but without sacrificing overall system performance through additional runtime overhead.

Contents

Who's the audience

Needless to say, we assume you know C. But we also assume you're a software practitioner quite comfortable with the overall flow of building and running C programs—especially on embedded hardware platforms. At the end of the day, RTSC starts with concepts and processes already familiar to C programmers—and then takes these to an entirely new level.

We don't, however, expect you've had any prior experience (or even exposure) to object-oriented programming using languages such as C++ or Java; and we certainly don't presume any knowledge of software components from an academic perspective. By the same token, those of you with some general background in modern software design techniques should find many of the premises underlying RTSC modules familiar, natural, and almost obvious.

But as we already said, RTSC starts and ends with C. For embedded C programmers who often ask "what's next" as applications grow ever larger and more complex—and who harbor concerns about the steep learning curve and the potential performance pitfalls of moving (say) to C++—RTSC may fill an important void for you.

What we'll cover

We've structured the Primer as a series of lessons that successively build upon one another, constantly reiterating and reinforcing concepts and idioms fundamental to producing and consuming RTSC modules.

Lesson 0 Getting started — installing examples and tools
Lesson 1 Basic concepts — constructing "Hello World"
Lesson 2 Configuration parameters — using the Bench module
Lesson 3 Instance objects — using the RandGen module
Lesson 4 Instance object life-cycle — using the RandGen module
Lesson 5 Packages — revisiting "Hello World"
Lesson 6 Modules — generalizing "Hello World"
Lesson 7 Modules — implementing acme.utils.Bench
Lesson 8 Instance modules — implementing bravo.math.RandGen
Lesson 9 Modules, packages, and testing — bringing it all together
Lesson 10 Next steps — learning more about RTSC

Except for the first and last lesson, the remaining lessons each center around a small self-contained example that illustrates common programming idioms used when either producing or consuming any RTSC module. Lessons 1-4 initially focus on the client perspective of a module, illustrating general programming patterns for using arbitrary RTSC modules within a standard C program; we'll also examine a generalized build-flow for such programs that you can easily instantiate with existing tools such as make.

As a bridge to the supplier's perspective of RTSC modules, Lesson 5 first introduces select aspects of the all-important RTSC package—essential for building as well as delivering modules to the client. Lessons 6-9 then proceed to specify and implement a graduated series of modules—some already used from the client's perspective in earlier lessons.

How to proceed

Iteratively.... This Primer actually packs quite a bit of (new) information inside each successive lesson, warranting several passes through the material. Start by simply navigating from one lesson to the next, picking up what you can by quickly skimming the content. And even when you circle back for a more thorough reading of each lesson, don't feel compelled to run any of the programming examples at that time—you can always operate in "read-only" mode and still learn quite a bit about RTSC modules.

You might also find it helpful to break the Primer in half, first tackling the material in Lessons 1-4 on the client's view of RTSC modules before advancing to the supplier's perspective in Lessons 5-9. Having said that, we do not recommend skipping the latter half of the Primer:  producing a flexible yet efficient RTSC module is simply too important—and too easy—for you not to master.

Though we have made the examples available as a separate download, you can generally just "copy-and-paste" source code fragments directly off the page:

prog.c
1
 
 
 
2
 
 
#include <stdio.h>
 
int main()
{
    printf("Hello World\n");
    return 0;
}

Throughout the lessons, we'll refer to individual lines in these examples using symbols like 1 or 2. Besides matching the corresponding labels tagging the example code, these symbols serve as live links that will return you to the original example should it have already scrolled off the screen.

FYI.... We'll occasionally interject some additional commentary on the material at hand in this format, usually providing deeper insights into a particular aspect of RTSC. In some cases, these inline comments provide a glimpse into the larger world of RTSC programming for which this Primer will prepare you.

And finally, other than resources listed in a See also section at end of each Lesson, you'll find virtually no links to other RTSC-Pedia documents until the final Lesson; we just want you to stay focused on the material at hand before jumping off elsewhere. If you are, however, looking for an overview of RTSC from 10,000 feet—something to read before hitting the ground—our Introducing RTSC white-paper should satisfy you. Else, if you're a C programmer ready to read some code, proceed onward.

See also

Introducing RTSC Learning about Real-Time Software Components
High-Level FAQs General questions about Real-Time Software Components

[printable version]  [offline version]offline version generated on 29-Jul-2014 21:07 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved
Personal tools
package reference