3.4 Software Development Flow

There are many development tool chains available for ARM® microcontrollers. Majority of them support C/C++ and assembly language. In most cases, the program generation flow can be summarized in a diagram as shown in Figure 3.13. Figure 3.13. Typical program generation flow.
In most simple applications, the programs can be completely written in the C language. The C compiler compiles the C program code into object files, and then generates the executable program image file using the linker. For the case of GNU C compilers, the compile and linking stages are often merged into one single step.
Projects that require assembly programming use the assembler to generate object code from assembly source code. The object files can then be linked together with other object files in the project to produce an executable image.
Beside from the program code, the object files and the executable image may also contain various debug information.
Depending on the development tools, it is possible to specify the memory layout for the linker using command line options. However, in projects using GNU C compilers, a linker script is normally required to specify the memory layout. A linker script is also required for other development tools when the memory layout gets complicated. In ARM development tools, the linker scripts are often called scatter-loading files. If you are using Keil® Microcontroller Development Kit (MDK), the scatter-loading file can be generated automatically from the memory layout window. You can use your own scatter-loading file if you prefer.
After the executable image is generated, we can test it by downloading it to the flash memory or internal RAM of the microcontroller and test it. The whole process can be quite easy; most development suites come with a user friendly IDE. When working together with an in-circuit debugger (sometimes referred to as an In-Circuit Emulator (ICE), debug probe, or USB-JTAG adaptor), you can create a project, build your application, and download your embedded application to the microcontroller in a few steps (Figure 3.14). Figure 3.14. An example of development flow.
In many cases an in-circuit debugger is needed to connect the debug host (personal computer) to the target board. The Keil® ULINK2 (Figure 3.15) is one of these products available and can be used with Keil Microcontroller Development Kit. Figure 3.15. ULINK 2 USB-JTAG adaptor.
The flash programming function can be carried out by the debugger software in the development suite, or in some cases by a flash programming utility downloadable from microcontroller vendor Web site. The program can then be tested by running on the microcontroller, and by connecting the debugger to the microcontroller, the program execution can be controlled and the operations can be observed. All these can be carried out via the debug interface of the Cortex®-M processor (see Figure 3.16). Figure 3.16. Various usages of the debug interface on the Cortex®-M processors.
For simple program codes, we can also test the program using a simulator. This allows us to have full visibility to the program execution sequence, and allows testing without actual hardware. Some development suites provide simulators that can also simulate peripheral behavior. For example, Keil MDK provides device simulation for many microcontrollers based on the ARM Cortex-M processors.
Apart from the fact that different C Compilers perform differently, different development suites also provide different C language extension features, as well as different syntax and directives in assembly programming. Chapters 5, 6, and 21Chapter 5Chapter 6Chapter 21 of this book provide assembly syntax information for ARM development tools (including ARM Development Studio 5 and Keil MDK) and GNU compiler. In addition, different development suites also provide different features in debug, utilities and different support for debug hardware.