Software Development Cycle for Microcontrollers

Following steps are involved in software development cycle for microcontrollers and microprocessors.

  1. Writing codes
  2. Translating codes
  3. Debugging the codes with the help of tools via emulators
  4. Programming microcontroller to build up the first prototype of the system.

Writing Microcontroller Code

  • Software Code for a microcontroller is written in a programming language of choice (often Assembly or C). This source code is written with a standard ASCII text editor and saved as an ASCII text file.
  • Programming in assembler involves learning a microcontroller’s specific instruction set (assembler mnemonics), but results in the most compact and fastest code.
  • A higher-level language like C is for the most part independent of a microcontroller’s specific architecture, but still requires some controller specific extensions of the standard language to be able to control all of a chip’s peripherals and functionality.
  • The penalty for more portable code and faster program development is a larger code size (20%…40% compared to assembler).

Translating the Code

  • Next the source code needs to be translated into instructions the microcontroller can actually execute. A microcontroller’s instruction set is represented by “opcodes“. Opcodes are a unique sequence of bits (“0” and “1”) that are decoded by the controller’s instruction decode logic and then executed.
  • Instead of writing opcodes in bits, they are commonly represented as hexadecimal numbers, whereby one hex number represents 4 bits within a byte, so it takes two hex numbers to represent 8 bits or 1 byte.
  • For that reason, a microcontroller’s firmware in machine readable form is also called Hex-Code and the file that stores that code Hex-File.

Assemblers, Compilers, Linkers and Librarians

Assemblers or (C) Compilers translate the human readable source code into “hex code” that represents the machine instructions (opcodes). 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) and the files have been linked (with the Linker), the output results in a number of files that can be used for debugging the software and programming the actual microcontroller’s memory.

Debugging the Code

  • A debugger is a piece of software running on the PC, which has to be tightly integrated with the emulator that you use to validate your code.
  • For that reason, all emulator manufacturers ship their own debugger software with their tools, but also compiler manufacturers frequently include debuggers, which work with certain emulators, into their development suites.
  • A Debugger allows you to download your code to the emulator’s memory and then control all of the functions of the emulator from a PC.
  • Common debugging features include the 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.
  • Also, debugger can execute one instruction at a time(Single stepping) through the code; and looking at a history of executed code (trace).

So far, we’ve talked about several different pieces of software such as Text Editor, Assembler or Compiler, Linkers, Librarians and Debugger.

You can easily imagine that it can become quite a time-consuming challenge to alternate back and forth between all of these programs during the debugging process. This is where an integrated development environment (IDE) comes in.

Programming the Microcontroller

Once the program is completed and runs successfully. It needs to be write into the microcontroller. For that, the ROM programmer is required. FLASH microcontrollers can be programmed both in-circuit (in-system) and out-of-circuit.

Out-of-Circuit Programming

  • OTP microcontrollers are typically programmed out-of-circuit. That means the microcontroller is programmed before being soldered on the target board.
  • For that purpose production grade programmers offer a choice of optional, high quality, expensive, zero-insertion-force (ZIF) pin adapters to support different package flavours.

In-System Programming (ISP)

  • In In-circuit programming the microcontroller is already soldered into the target system and can be programmed via one of its communication interfaces (UART, SPI).
  • The signals required for programming routed to an in-system-programming (ISP) connector to which an ISP programmer can be hooked up. The ISP connector required varies from manufacturer to manufacturer and microcontroller to microcontroller
  • It is recommended that before you start your PCB layout, you decide on which ISP programmer you want to use and find out which ISP connector is required for it.
  • As ISP programming is done via a serial interface it is slower than out-of-circuit programming that uses parallel data transfers – something you might want to consider if you have to program 100000 devices.

Recent posts

Leave a Comment

Your email address will not be published. Required fields are marked *