Passing parameters between C and the assembly language

When a function or subroutine is called, its address must be loaded into the PC so that it can be executed and, when it terminates, execution of the calling routine must continue. In addition, there must be a convention that defines the following:

  • How parameters are passed to the function
  • How parameters are returned
  • Which (if any) registers can be modified by the function

The ARM Architecture Procedure Call Standard deals with these issues (refer to Procedure Call Standard for the ARM Architecture, http://infocenter.arm.com/).

Getting ready

In this section, we will learn more about the ARM Architecture Procedure Call Standard (AAPCS) by writing an assembly language subroutine that receives a parameter ...

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.