Questions tagged [stack]

Anything related to hardware and software stacks, i.e. data structures managed using a LIFO (Last-In First-Out) policy.

Anything related to hardware and software stacks, i.e. data structures managed using a LIFO (Last-In First-Out) policy.

See also Wikipedia on stack.

34 questions
34
votes
14 answers

What makes the stack concept useful in embedded programming?

Below is an illustration of the stack concept: I have read many times about the stack pointer and how some variables are stored in SRAM on a stack. Many tutorials explain how it works, but not why this concept exist at all. Imagine I am the program…
GNZ
  • 1,559
  • 4
  • 25
  • 52
11
votes
3 answers

What does it mean for a CPU to support a stack?

How can a CPU not support a stack? Doesn't any architecture that uses subroutines (I'm pretty sure that's all architectures) have to push the return address onto the stack so it can return to where it called the subroutine from? The stack just means…
NickHalden
  • 4,167
  • 3
  • 31
  • 40
9
votes
1 answer

Main Stack Pointer(MSP) vs Process Stack Pointer(PSP)

I was reading the STM32 Programming manual and somewhere on "page 18 " i see these two kind of stack pointers. I always think that there is only ONE stack and therefore only ONE stack pointer to that exists in MCUs and now i'm confused of what these…
Amin Rostami
  • 889
  • 3
  • 12
  • 29
7
votes
6 answers

Exploiting stack buffer overflows on an Arduino

Is it possible exploit stack buffer overflows on an Arduino board?
DarkCoffee
  • 415
  • 1
  • 4
  • 11
7
votes
3 answers

How to implement simple stack switching in PIC12/16 cores?

I am trying to understand how real time operating systems work. I have looked at the source codes of some RTOSes. I want to learn by creating my simple RTOS, something like FLIRT. I am using PIC16 series and XC8 C compiler with MPLABX. I also want…
abdullah kahraman
  • 5,930
  • 7
  • 59
  • 104
5
votes
1 answer

PIC24F Software Stack?

I know many of the lower-end PICs have fixed hardware stacks that can become an issue during firmware development. I've recently heard that the PIC24-series (and maybe just anything above PIC18 series) have software-defined stacks? Does that mean…
tarabyte
  • 3,112
  • 10
  • 43
  • 67
5
votes
2 answers

Must FreeRTOS task stack size account for interrupt stack size?

I have FreeRTOS running on a MKE06 Cortex-M0+ (based on SAMD20 demo), GCC toolchain. I am trying to figure out optimal task stack sizes (with the help of avstack.pl). I want to use only static memory allocation. In the FAQ I have read this: The…
filo
  • 8,801
  • 1
  • 25
  • 46
4
votes
2 answers

Why are communciation protocols presented as Stacks (vertical) rather than as a conveyor belt (horizontal)?

The OSI model and other models represent a communication system as a stack of multiple layers. In this case we get a vertical structure where "user" is at the top and the receiver of communication at the bottom. What I have wondered for quite some…
quantum231
  • 11,218
  • 24
  • 99
  • 192
4
votes
3 answers

Is there any restriction in the choice of Ethernet PHY, depending on the TCP/IP stack?

I am new on the forum and am currently working on a project to design an ethernet electronic board. I will have a microcontroller 32-bit with an external PHY. I wanted to know : depending on the TCP/IP stack I will choose, will there be any…
damien
  • 1,263
  • 3
  • 15
  • 25
4
votes
0 answers

How to know the memory occupied by the various memory segments in a microcontroller

I'm using STM32 based microcontroller, IAR embedded workbench and STlink v2 debugger. I just want to know how to check the memory utilized/used by the program/system in various memory segments like: Data segment(initialized and uninitialized) heap…
Myanju
  • 213
  • 1
  • 3
  • 9
4
votes
1 answer

Does MPLAB X have a call-graph analysis tool?

I'd like to start understanding how deep my microcontroller's stack goes (even if it's only an estimation). How can I do this using MPLAB X?
tarabyte
  • 3,112
  • 10
  • 43
  • 67
3
votes
4 answers

How can we determine memory usage of a microcontroller

How can we determine how much memory is being used, or will be used by firmware in a microcontroller? What tools can support this? Generally we don't use dynamic memory in embedded systems, but how can we determine the worst case stack usage for…
Engineer999
  • 161
  • 1
  • 7
3
votes
1 answer

stack implementation in 8051

I have a doubt on stack implementation in 8051 and I don't even know if I'm asking it in right way so please pardon me. I've been reading stack implementation in 8051 and many textbooks and references it's mentioned that when we push the data then…
d-coder
  • 131
  • 8
3
votes
4 answers

TRUE/FALSE or true/false?

In resource-constrained systems (like an 8-bit PIC), is there any benefit to using your own macros for true and false as opposed to using those defined from stdbool? #define TRUE (1) #define FALSE (0) // OR (dummy example) #include…
tarabyte
  • 3,112
  • 10
  • 43
  • 67
2
votes
2 answers

How does the Array allocated in the stack?

I was testing the code below on my STM32 board, but I could't understand how the array was being allocated in the stack. I'm assuming that there are 200 bytes of memory in STM32. Here is the code: void test1() { char data[1000]={0}; } void…
John G
  • 21
  • 3
1
2 3