Introductory training materials

We receive many enquiries from people who are looking for an introductory guide to development techniques for embedded systems. The questions come from people who are about to join one of our introductory training courses, from professional programmers (particularly those who are considering a career change from “desktop” to “embedded” systems), and from students at numerous universities and colleges around the world. In response to these questions, we’ve created this webpage. On this page, we provide an “8-step guide” for people who want to begin to learn how to program embedded systems. Our focus from the start is on the development of reliable embedded systems. 
The page includes links to our free introductory training course on “Embedded C”, which is distributed via YouTube®. 

1. Learn how to program in C for a “desktop” computer
Before you can start to program embedded systems, you need to learn how to program. While it is not impossible to begin programming using an embedded board, most people find it much easier to learn how to program on a desktop computer before they start to deal with the complexities of cross-compilation, debugging over a JTAG link, etc. We therefore recommend that you learn how to program a desktop computer, in C, before you start trying to program an embedded processor. To explain why we recommend learning C, we make the following observations: - Computers (such as microcontroller, microprocessor or DSP chips) only accept instructions in “machine code” (“object code”).
- Machine code is, by definition, in the language of the computer, rather than that of the programmer. Interpretation of the code by the programmer is difficult and error prone.
- All software, whether in assembly, C, C++, Java or Ada must ultimately be translated into machine code in order to be executed by the computer.
- There is no point in creating ‘perfect’ source code, if we then make use of a poor translator program (such as an assembler or compiler) and thereby generate executable code that does not operate as we intended.
- When compared to “desktop” processors, embedded processors tend to have limited processor power and very limited memory available: the language used must be efficient.
- To program embedded systems, we need low-level access to the hardware: this means, at least, being able to read from and write to particular memory locations (using ‘pointers’ or an equivalent mechanism).
Of course, not all of the issues involved in language selection are purely technical: - No software company remains in business for very long if it generates new code, from scratch, for every project. The language used must support the creation of flexible libraries, making it easy to re-use (well-tested) code components in a range of projects. It must also be possible to adapt complete code systems to work with a new or updated processor with minimal difficulty.
- Staff members change and existing personnel have limited memory spans. At the same time, systems evolve and processors are updated. Many embedded systems have a long lifespan. During this time, their code will often have to be maintained. Good code must therefore be easy to understand now, and in five years time (and not just by those who first wrote it).
- The language chosen should be in common use. This will ensure that you can continue to recruit experienced developers who have knowledge of the language. It will also mean that your existing developers will have access to sources of information (such as books, training courses, WWW sites) which give examples of good design and programming practice.
Even this short list immediately raises the paradox of programming language selection. From one point of view, only machine code is safe, since every other language involves a translator, and any code you create is only as safe as the code written by the manufacturers of the translator. On the other hand, real code needs to be maintained and re-used in new projects, possibly on different hardware: few people would argue that machine code is easy to understand, debug or to port. Inevitably, therefore, we need to make compromises; there is no perfect solution. All we can really say is that we require a language that is efficient, high-level, gives low-level access to hardware, and is well defined. In addition – of course – the language must be available for the platforms we wish to use. Against all of these points, C scores well. We can summarise C’s features as follows: - It is a ‘mid-level’ language, with ‘high-level’ features (such as support for functions and modules), and ‘low-level’ features (such as good access to hardware via pointers);
- It is very efficient;
- It is popular and well understood;
- Even desktop developers who have used only Java or C++ can soon understand C syntax;
- Good, well-proven compilers are available for every embedded processor (8-bit to 32-bit or more);
- Experienced staff are available;
- Books, training courses, code samples and WWW sites discussing the use of the language are all widely available.
Overall, C’s strengths for embedded system development greatly outweigh its weakness. It may not be an ideal language for developing embedded systems, but is unlikely that a perfect language will ever be created. 
“Can you recommend a book on ‘desktop C’?”
We’ve found “C in a Nutshell” by Peter Prinz and Tony Crawford to be a useful guide to “desktop C”. 

2. Learn the basics of “embedded C”

When you are familiar with desktop C, we suggest that you begin to explore embedded systems using a simple processor. For example, the 8051 microcontroller is a popular “starter” processor which is still used in many “real” systems. If you decide to start with the 8051 microcontroller, “Embedded C” provides a gentle introduction to the programming of embedded systems (using 8051 microcontrollers). Please note that Embedded C is a self-contained “teach yourself” program: the package includes both a compiler and processor simulator (on CD), which means that you can run all of the examples in the book (and learn a great deal about the programming of embedded systems in C) without buying — or building — any hardware. Further information is available. 
Code examples from “Embedded C” Copies of the code examples from Embedded C are available for download here (zip file).

Course notes for “Embedded C”
A set of course notes based on “Embedded C” are available here. These notes are intended for use in a 10-week introductory module on embedded systems. 

Teaching slides for “Embedded C”
If you wish to use “Embedded C” in a university or college course, a complete set of Powerpoint slides (10 files, zipped) is available. These would be suitable for use in an introductory course on embedded systems. These files were created by Dr. Jimmy To, a faculty member at the Hong Kong Polytechnic University. 

3. Use our free guide to learn more about the use of the C language in embedded systems

Written by Peter J. Vidler, our popular Introduction to Embedded C is intended to form the basis of a self-study course that provides a guide to the C programming language as it is used in embedded systems. It introduces some of the key features of the C language, before moving on to consider some more advanced features such as pointers and memory allocation. Throughout this guide we present some exercises of varying length and difficulty, which you should attempt before continuing. To help with this we use the free RapidiTTy® Lite IDE, targeting a TTE®32 microcontroller. The examples in this guide use the hardware simulator that is included in the RapidiTTy® Lite package. If you have access to an FPGA development board, such as the Altera® DE2-115, then you will be able to try your code out in hardware. You can download the guide here. You can find out more about our free RapidiTTy Lite toolset here. 

4. Download “Patterns for Time-Triggered Embedded Systems”

Building on the foundations presented in “Embedded C”, “Patterns for Time-Triggered Embedded Systems” is a 1000-page book which illustrates how you can create a range of reliableembedded systems. In total, PTTES contains details of more than 70 useful “design patterns”, complete with guidelines to help you apply these techniques in your own projects: full source code for all of the patterns is also included. Following an agreement with the original publishers, PTTES is now distributed by SafeTTy Systems. You can now download the complete book from this WWW site. Detailed code examples from the book are also available for download. Downloads are free (and no registration is required). 
|