Stack Memory

Stack Memory

Stack and Heap have no physical presence. They are part of the RAM memory which is used to store the data.?

No alt text provided for this image


This article is about What is Stack. Why, Where and How is it used?

So, let's dig deep into the RAM ??

  • The Stack is an area of RAM where a program stores temporary data during the execution of code blocks.??
  • It is mainly used during function and interrupt/exception handling.
  • The stack is traced using the stack pointer (SP) register of the MCU. Data in the stack memory is added and removed in a LIFO(Last-In-First-Out) manner.

There are two memory access instructions. Which is generally used to Store and Remove data from the Stack Memory.?

1) PUSH: Add data into the Stack

2) POP: Remove data from the Stack

No alt text provided for this image

Both instructions affect the stack pointer register value (increment or decrement).?

There are four stack suffixes (stack operation models) :

1) FD ( Full Descending Stack)?

2) FA (Full Ascending Stack)?

3) ED (Empty Descending Stack)?

4) EA Empty Ascending Stack)?

Note:- The Procedure Call Standard for the ARM Architecture (AAPCS), and the ARM and Thumb C and C++ compilers always use a full descending stack.

Full Descending Stack: In this model the stack pointer always points to the last filled data in the stack memory. If we want to push the data into the stack memory then the stack pointer will first decrement the address and then push the data into the stack.

Let's end this article right here because I need some air...?? In the comment section you will tell me about other stack operation models.

要查看或添加评论,请登录

Alok Mishra的更多文章

社区洞察

其他会员也浏览了