160 likes | 242 Views
Getting Started With RTSC Component Development. Bob Frankel. Dave Russo. bob@biosbob.biz. d-russo@ti.com. What We'll Cover. Introducing RTSC. the 10,000 foot view how RTSC addresses some basic embedded software challenges programming fundamentals
E N D
Getting Started With RTSC Component Development Bob Frankel Dave Russo bob@biosbob.biz d-russo@ti.com
What We'll Cover Introducing RTSC • the 10,000 foot view • how RTSC addresses some basic embedded software challenges • programming fundamentals • "Hello World\n"realized as a RTSC { program, package, module } • advanced programming features • specifying, packaging, and configuring C/C++ embedded SW components RTSC In Action • a live demo • remote data-collection and logging application using multiple MSP430s • targets and platforms • what it takes to get "Hello World\n"running in your environment • the xdc.runtime package • modular, scalable, configurable building-blocks for any embedded C/C++ application a grand tour that hopefully inspires you to learn more....
RTSC Project Highlights • incubating in DSPS • source-code migration has begun, newsgroup activity increasing • real-world technology • deployed in several flagship products from Texas Instruments • zero-latency documentation • be sure to browse the online RTSC-Pedia for further information
C Component Producer Component Consumer Embedded Software Challenges software re-use HIGHER-LEVEL PROGRAMMING write once, deploy widely... flexible, generic, re-usable don't re-invent the wheel... optimized, optimized, optimized HIGHER-LEVEL PERFORMANCE • ISA, memory model • peripheral devices • static-vs-dynamic • quality-of-service • time-vs-space PLATFORM DIVERSITY ...
QUALITY In 25 Words Or Less.... RTSC is a suite of foundational tools for building, testing, and deploying re-usable target software content for diverse embedded platforms without compromising system performance
.lib Application Developers The RTSC Flow target script C SPECIFICATION platform IMPLEMENTATION CONFIGURATION ANALYSIS meta-domain IMPLEMENTATION target-domain .h COMPILER C LINKER .out COMPILER PACKAGING HARDWARE target Component Producer Component Consumer
"Hello World\n"Program prog.c prog.cfg #include <xdc/runtime/System.h> int main() { System_printf("Hello World\n"); return 0; } var System = xdc.useModule('xdc.runtime.System'); makefile target xdc.tools.configuro platform compiler.opt COMPILER linker.cmd LINKER prog.out
"Hello World\n"Package package.xdc package-repository path packagehello.pkg { /* module declarations normally go here */ }; c:/repo; h:/share; ... package.bld repo var Build = xdc.useModule('xdc.bld.BuildEnvironment'); var Pkg = xdc.useModule('xdc.bld.PackageContents'); foreach (var targ in Build.targets) { Pkg.addExecutable("prog", targ, targ.platform) .addObjects(["prog.c"]); } hello pkg config.bld var Build = xdc.useModule('xdc.bld.BuildEnvironment'); var C64P = xdc.useModule('ti.targets.C64P'); var GCC = xdc.useModule('gnu.targets.Mingw'); C64P.rootDir = "«c6xtools»"; C64P.platform = 'ti.platforms.sim64Pxx'; GCC.rootDir = "«gcctools»"; Build.targets = [C64P, GCC]; xdc build command package.mak
"Hello World\n"Module module Talker { configString text = "Hello World"; configInt count = 1; Void print(); } Talker.xdc public SPECIFICATION XDCspec definition language eXpanDed C XDCscript meta-language #include <xdc/runtime/System.h> #include "package/internal/Talker.xdc.h" Void Talker_print() { Int i; for (i = 0; i < Talker_count; i++) { System_printf("%s\n", Talker_text); } } Talker.c Talker.xs function module$use() { xdc.useModule('xdc.runtime.System'); } internal IMPLEMENTATION ANSI C target-language
acme.utils Bench Settings begin() end() enum OptType enable optimize isqrt Application Program • re-enforce the idiom of consuming RTSC-based content in a legacy development flow • serve as a client for the charlie.sqrtlib package and the acme.utils.Bench module • illustrate the assignment of config params in the meta-domain, hinting what's to come prog.cfg charlie.sqrtlib prog.c isqrt.h
Settings enum OptType optimize charlie.sqrtlib Package • present a model for delivering legacy C headers/libraries within a RTSC package • demonstrate the “power of (meta-)programmability” through more sophisticated scripts • explore charlie.sqrtlib.test — a companion package of unit-tests for these libraries charlie.sqrtlib charlie.sqrtlib.test isqrtTest1.cfg isqrtTest1.c isqrt.h package.xs isqrt_loop.c isqrt_unroll.c
enable acme.utils.Bench Module • examine a small RTSC module that exemplifies a wider-range of XDC language features • introduce a design-pattern used to manage alternate internal module implementations • show multiple implementations of the acme.utils.clock.IClock RTSC interface acme.utils Bench begin() end() acme.utils.clocks IClock getTime() IClock proxy PClock txn.clocks IClock IClock ClockStd Clock64P getTime() getTime()
interface IService CODE declares inherits-from inherits-from-and-implements directly-calls proxy ServiceX module Client module Service1 module Service2 CODE CODE CODE delegates to Proxy/Delegate Pattern dispatches-via-function-table In general, a client invokes a service through a local proxy, which in turn delegates to an actual provider. Other than reliance on a common service specification, the client and provider are effectively de-coupled from one another. memory allocation I/O & messaging math primitives event logging OS services ... this pattern subsumes many current uses of function-pointers in C
.c .o Bench_begin() { if(Bench_enable) { Bench_PClock_getTime() } } executable program .x “compiling” “linking” source code object code .c .o syntactic / semantic analysis optimization & code generation address relocation & resolution .c .o executable program WPO .x “compiling” “linking” source code intermediate code .c .o Whole-Program Optimization • optimization across compilation boundaries • inlining & specialization of extern functions • propogration & folding of extern constants • removal of unneeded program code & data • #define, #if capability in compiled binaries • available in most modern C compilers MODULE IMPLEMENTATION .c
BASIC PACKAGING WRAPPER MODULES package.xdc package.bld package.xs legacy code legacy code • packages encapsulate legacy headers & libraries • source code basically remains unchanged • wrapper modules expose legacy functionality • top-level fxns in XDC– interior code unchanged GLOBAL CONSTANTS TABLE GENERATION HMod Mod prm prm legacy code legacy code Mod_prm • module-level config params in wrapper modules • replace #define constants with param references • host-only “facade” modules for configuration • template-based generation of run-time code / data Capturing Legacy Content
And Now.... QuestionsComments Short-Break