Writing Cortex-M4 assembly language

Before we start to write an assembly language subroutine, we need an idea of what the function has to achieve. The best way to specify this is to first write the function in a high-level language, such as C, and then translate the C code into assembly language line by line. Some experienced assembly language programmers argue that this is inefficient, but the technique produces well-documented code that can be optimized in further iterations of the design.

Getting ready

To translate the C code, we need to be familiar with both the instruction set and the addressing modes that are used by the Cortex-M4. Details of the instruction set can be found in ARM's Architecture Reference Manual and also in the ARM Cortex-M4 ...

Get ARM® Cortex® M4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.