1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Programming With eCos</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos User Guide"
20 HREF="ecos-user-guide.html"><LINK
22 TITLE="Programming With eCos"
23 HREF="user-guide-programming.html"><LINK
25 TITLE="Programming With eCos"
26 HREF="user-guide-programming.html"><LINK
28 TITLE="Configuring and Building eCos from Source"
29 HREF="configuring-and-building-ecos-from-source.html"></HEAD
40 SUMMARY="Header navigation table"
57 HREF="user-guide-programming.html"
71 HREF="configuring-and-building-ecos-from-source.html"
84 NAME="PROGRAMMING-WITH-ECOS">Chapter 10. Programming With <SPAN
89 >The following chapters of this manual comprise a simple tutorial
90 for configuring and building <SPAN
93 >, building and running <SPAN
97 and finally building three stand-alone example programs which use
101 > API to perform some simple tasks.</P
103 >You will need a properly installed <SPAN
106 > system, with the correct
107 versions of the GNU toolchain. On Windows
108 you will be using the bash command line interpreter that comes with
109 Cygwin, with the environment variables set as described in the
110 toolchain documentation.</P
116 NAME="DEVELOPMENT-PROCESS">The Development Process</H1
118 >Most development projects using <SPAN
121 > would contain some (or
122 most) of the following:</P
136 > is configured to provide the desired API (the inclusion
137 of libc, uitron, and the disabling of certain undesired funtions,
138 etc.), and semantics (selecting scheduler, mutex behavior, etc.).
140 HREF="configuring-and-building-ecos-from-source.html"
144 >It would normally make sense to enable <SPAN
148 at this time as well, to catch as many programming errors during
149 the development phase as possible.</P
151 >Note that it should not be necessary to spend much time on
155 > configuration initially. It may be important to perform fine
156 tuning to reduce the memory footprint and to improve performance
157 later when the product reaches a testable state.</P
164 NAME="AEN481">Integrity check of the <SPAN
169 >While we strive to thoroughly test <SPAN
173 of configuration permutations mean that the particular configuration
174 parameters used for your project may not have been tested. Therefore,
175 we advise running the <SPAN
178 > tests after the project's
182 > configuration has been determined. See <A
183 HREF="running-an-ecos-test-case.html"
187 >Obviously, this should be repeated if the configuration changes
188 later on in the development process.</P
195 NAME="AEN490">Application Development - Target Neutral Part</H2
197 >While your project is probably targeting a specific architecture
198 and platform, possibly custom hardware, it may be possible to perform
199 part of the application development using simulated or synthetic
202 >There are three good reasons for doing this:</P
208 >It may be possible by this means to perform application
209 development in parallel with the design/implementation
210 of the target hardware, thus providing more time for developing
211 and testing functionality, and reducing time-to-market.</P
215 >The build-run-debug-cycle may be faster when the application
216 does not have to be downloaded to a target via a serial interface.
217 Debugging is also likely to be more responsive when you do not have to
218 to communicate with the remote GDB stubs in RedBoot via serial. It
219 also removes the need for manually or automatically resetting the
224 >New hardware can often be buggy. Comparing the behaviour of the
225 program on the hardware and in the simulator or synthetic target may
226 allow you to identify where the problems lie.</P
230 >This approach is possible because all targets (including
231 simulators and synthetic ones) provide the same basic API: that
232 is, kernel, libc, libm, uitron, infra, and to some extent, HAL and
235 >Synthetic targets are especially suitable as they allow you
236 to construct simulations of elaborate devices by interaction with
237 the host system, where an IO device API can hide the details from
238 the application. When switching to hardware later in the development
239 cycle, the IO driver is properly implemented.</P
241 >Simulators can also do this, but it all depends on the
242 design and capabilities of the simulator you use. Some, like
244 HREF="http://sources.redhat.com/sid"
249 HREF="http://bochs.sourceforge.net/"
253 complete hardware emulation, while others just support enough of the
254 instruction set to run compiled code.</P
256 >Therefore, select a simulator or synthetic target and use
257 it for as long as possible for application development. That is,
258 configure for the selected target, build <SPAN
261 >, build the application
265 >, run and debug. Repeat the latter two steps until
266 you are happy with it.</P
268 >Obviously, at some time you will have to switch to the intended
269 target hardware, for example when adding target specific feature
270 support, for memory footprint/performance characterization,
271 and for final tuning of <SPAN
274 > and the application.</P
281 NAME="AEN511">Application Development - Target Specific Part</H2
283 >Repeat the build-run-debug-cycle while performing final tuning
284 and debugging of application. Remember to disable <SPAN
288 checking if you are testing any performance-related aspects, it can
289 make a big difference.</P
291 >It may be useful to switch between this and the previous step
292 repeatedly through the development process; use the simulator/synthetic
293 target for actual development, and use the target hardware to continually
294 check memory footprint and performance. There should be little cost
295 in switching between the two targets when using two separate build
305 SUMMARY="Footer navigation table"
316 HREF="user-guide-programming.html"
325 HREF="ecos-user-guide.html"
334 HREF="configuring-and-building-ecos-from-source.html"
344 >Programming With <SPAN
353 HREF="user-guide-programming.html"
361 >Configuring and Building <SPAN