The Definitive Guide to the ARM Cortex-M3

Chapter 10: Cortex-M3 Programming

Overview

The Cortex-M3 can be programmed using either assembler or C. There might be compilers for other languages, but most people will use assembler, C, or a combination of the two in their projects. Because a lot of information on the way to do programming depends on the tool chain and silicon chips you use, this book will not focus on the details of compiling a program or how to download the program to your circuit board. A little bit of this information is covered in Chapters 19 and 20.

Using Assembly

For small projects, it is possible to develop the whole application in assembly language. Using assembler, you might be able to get the best optimization you want. However, it might increase your development time, and it could be easy to make mistakes. In addition, handling complex data structures or function library management can be extremely difficult in assembler. Yet even when the C language is used in a project, in many situations part of the program is implemented in assembly language:

  • Functions that cannot be implemented in C, such as special register accesses and exclusive accesses

  • Timing-critical routines

  • Tight memory requirements, causing part of the program to be written in assembly to get the smallest memory size

Using C

C has the advantage of being portable and easier for implementing complex operations, compared to assembly language. Since it's a generic computer language, C does not specify how the processor is initialized. For these areas, tool chains can have...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programming Languages
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.