21.9. Other Programming Techniques for Assembly Language

21.9.1. Allocating Data Space for Variables

In the previous assembly language function examples, the data processing can be handled with just a few registers, so it does not use any stack memory at all. By default, the stack memory allocation is done for us in the default start-up code. We could reduce the stack size allocated by modifying the Stack_Size definition from 0x200 to other stack size required:
Stack_Size      EQU     0x00000200
                AREA    STACK, NOINIT, READWRITE, ALIGN=3Stack_Mem       SPACE   Stack_Size__initial_sp
For most applications, there would be fair amount of data variables. For simple applications, we can also allocate memory space in the RAM. For example, ...

Get The Definitive Guide to ARM® Cortex®-M0 and Cortex-M0+ Processors, 2nd Edition 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.