Developing Embedded Systems A Tools Introduction By Volker
Developing Embedded Systems - A Tools Introduction By Volker Soffel General Manager Micro. Controller Pros Corporation
Developing Embedded Systems - A Tools Introduction
Microcontroller Development Cycle • Writing the code • Translating the code • Debugging the code with the help of debugging tools, including emulators • Programming a Flash or OTP version of the microcontroller to built up a first functional prototype of your system
Writing the code • Code is written in Assembler or C • Written with a standard ASCII text editor and saved as an ASCII text file. • Programming in assembler involves learning a specific instruction set , results in the most compact and fastest code. • C is for the most part independent of architecture, requires some controller specific extensions of the standard language to be able to control all of a chip's peripherals and functionality. The penalty is a larger code size
Translating the code • Code needs to be translated into instructions the microcontroller can actually execute. • A microcontrollers instruction set is represented by "op codes". • Op codes are a unique sequence of bits ("0" and "1") • For that reason a microcontroller's firmware in machine readable form is also called Hex-Code • File that stores that code is called Hex-File.
Assemblers or (C-) Compilers • Translate the human readable source code into "hex code“ • To support modular code and reusable libraries of code, most assemblers and compilers today come with Linkers and Librarians.
Linkers • Link code modules saved in different files together into a single final program. • At the same time they take care of a chip's memory allocation By assigning each instruction to a microcontroller memory addresses in such a way that different modules do not overlap.
Librarians • Help you to manage, organize and revision control a library of re-usable code modules. • Once the ASCII source code text file has been ü Assembled (with an Assembler) or Compiled (with a Compiler), ü Files have been linked (with the Linker), ü Output results in a number of files that can be used for debugging the software & programming the actual microcontroller's memory.
Debugging the code • Debugger allows you to download your code to the emulator's memory • Then control all of the functions of the emulator from a PC. Common debugging features ü Capability to examine and modify the microcontroller's on-chip registers, data- and program-memory; ü Pausing or stopping program executing at defined program locations by setting breakpoints; ü Single-stepping (execute one instruction at a time) through the code; ü Looking at a history of executed code (trace).
Integrated Development Environment (IDE) • Several different pieces of software: Text Editor, Assembler or Compiler, Linkers, Librarians and Debugger. • It is quite a time-consuming challenge to alternate back and forth between all of these programs during the debugging process (discover a bug, edit the source code, compile it again, link it again, download the modified code to the emulator, etc. ). This is where an integrated development environment (IDE) comes in.
Debugging Tools • When it comes to debugging a code and testing application there are several different tools Differ greatly in terms of ü Development time spend ü Debugging features
Simulators • Models the behaviour of the complete microcontroller in software. • Some include the whole system (simulation of peripherals outside of the microcontroller). • No matter how fast your PC, there is no simulator in the market that can actually simulate a microcontroller's behaviour in real-time. • Are best suited to test algorithms that run completely within the microcontroller (like a math routine for example). • They are the perfect tool to complement expensive emulators for large development teams, where buying an emulator for each developer is financially not feasible.
Microcontroller Starter Kits • Commonly bundle ü Hardware board ü In-system programmer with some software components (assembler, linker, debugger, sometimes an IDE and a codesize limited "evaluation" version of a compiler) • Allows very basic emulation and debugging functions • These kits are most predominant with Flash based microcontrollers. The Flash memory allows an actual sample of the microcontroller to be used to "emulate" itself, by using the included in-system programmer to download the code into the Flash and execute it.
Evaluation board • Included with the starter kits is an evaluation board • Main purpose is ü To get you started on your development quickly without the need to develop your own hardware board. ü Board is typically equipped with a sample of a microcontroller to allow you to execute and evaluate your code. ü Also supports the capability to hook up your own hardware if you prefer a setup closer to your final application.
Evaluation board • A big advantage of these kits over simulators is ü Work in real-time ü Allow for easy input/output functionality verification • Simulators on the other hand offer ü Powerful debugging features • Starter kits, ü Completely sufficient and the cheapest option to develop simple microcontroller projects
Emulators • Hardware that ideally behaves exactly like the real microcontroller chip with all its integrated functionality. • Most powerful debugging tool of all • An emulator always works transparent or non-intrusive • All emulators contain 3 essential functions in different implementation forms: • The emulator control logic, including emulation memory • The actual emulation device • A pin adapter that gives the emulator's target connector the same "package" and pinout as the microcontroller to be emulated
Emulator memory • Uses external static RAM as the emulated micro's program memory. • RAM memory allows for code to be changed quickly • An "indefinite" number of times code can be changed during the software debugging process.
Emulation Control Logic • Control logic is required to recreate functions • Functions with additional logic • Works truly transparent or non-intrusive Means you have all the pins, all the memory and all the peripheral functions available like with the real microcontroller.
Programming a Flash or OTP version • FLASH microcontrollers can be programmed both in-circuit (in-system) and out-of-circuit. • In-circuit programming ü Microcontroller is already soldered into the target system ü Can be programmed via one of its communication interfaces (UART, SPI) ü Programming is done via a serial interface it is slower than out-of-circuit programming that uses parallel data transfers
Out-of-Circuit Programming • OTP microcontrollers are typically programmed out-of-circuit. • Means the microcontroller is programmed before being soldered on the target board.
- Slides: 20