Questions tagged [stack]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
93 views

Problem with backtrace during STM32 debugging

I've been working with a STM32 nucleo board, model F446RE, and my application code only uses low level drivers, no HAL features are employed. My compilation process has been created manually, with a ...
andre.hre's user avatar
  • 139
0 votes
1 answer
87 views

On an embedded system, when you have a hardware interrupt, what happens to the process status word?

I have been taught that when an interrupt arrives, the following generally happens: The current instruction finishes. The interrupt is acknowledged. The hardware state(PSW) is stored . The PC is ...
Thomas Stokes's user avatar
34 votes
14 answers
11k views

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 ...
GNZ's user avatar
  • 1,638
0 votes
1 answer
508 views

Going below the bottom of the stack in ATmega328P

I'm working with an AVR based project and just have one curiosity. The ATmega328P has total 2kB of SRAM. The lowest address of the stack can be 0x8FF. Now suppose the stack pointer is at 0x8FF. What ...
user137273's user avatar
1 vote
1 answer
74 views

Linkage pointer in procedure

https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2017/c12/c12s3/procedures_answers.pdf I don't understand how the linkage pointer can be the ...
Ray's user avatar
  • 159
0 votes
2 answers
121 views

8085 : Storing data in stack

In 8085 whatever address the stack pointer holds, we always start storing bytes from one less than this address . Eg. If SP holds 2008H. We will store 16-bit data at 2007 and 2006H. Why don't we store ...
Urooj's user avatar
  • 173
2 votes
3 answers
2k views

How to debug this I2C hard fault?

I am using an STM32F103C8T6, STM32CubeIDE with HAL. During accessing an LCD (1602), with I2C, I get a hard fault. I try to debug it, but somehow I don't see the stack. See the following screenshot: ...
Michel Keijzers's user avatar
0 votes
4 answers
1k views

ZiLOG Z80 Stack Pointer Location in Memory?

I am trying to design a board for a Z80 based computer, and am having trouble designing the memory map. I have found that the Program Counter defaults to address ...
LukeIsMe's user avatar
0 votes
1 answer
114 views

My counter for my cpu stack alternates between counting up and down

My Counter for my cpu stack is given the up signal at the same time it is given the clock pulse to advance. This happens on the pull from stack instruction so the counter goes back up the stack one ...
Dustin Harris's user avatar
3 votes
4 answers
5k views

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 ...
Engineer999's user avatar
9 votes
1 answer
13k views

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 ...
Amin Rostami's user avatar
0 votes
1 answer
249 views

Stack overflow results

I have been forcing a problem regarding to corruption of the MCU flash memory content during software running. This corruption occurs randomly and I have got an idea whether the flash memory ...
Steve's user avatar
  • 1,061
1 vote
2 answers
5k views

How does an "if" statement and "always@" statement work in Verilog?

I'm trying to program an 8 level stack register for a Program Counter. It is working well enough, but for some reason, when I test it, some combinations of inputs produce unexpected results. This is ...
Eddysanoli's user avatar
0 votes
2 answers
267 views

Existence (or reason of lack) of simple cmos LIFO registers IC

There's a project I'm working on that needs a simple LIFO register. What I mean by simple is to support the PUSH & POP operations, and I guess EMPTY and FULL indicators. I must be searching with ...
Sachiko.Shinozaki's user avatar
2 votes
1 answer
1k views

Power Supply Stacking in Parallel

I have two DLM 60-10 Sorenson bench power suppllies (10A limit) that I am wanting to stack in parallel so that I can provide between 1 and 20 A, at a consistent 12 V. I'm not particularly an ...
Austin Prater's user avatar
5 votes
2 answers
3k views

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 ...
filo's user avatar
  • 8,901
1 vote
2 answers
1k views

Preventing Stack overflows in PIC MCU using C language MPLAB X

I am writing a C language code for PIC16f877a for an Alarm clock. In short, the alarm clock shows Time, Set alarm and a temperature & humidity reading on an LCD. I have written interrupts for ...
Mohsin Anees's user avatar
-3 votes
2 answers
1k views

Manually storing the stack pointer rather than using push and pop (Assembly)

What will be the instruction sequence that implements PUSH R4? A: SUB SP, SP, #4 STR R4, [SP, #0] B: ...
stumped's user avatar
  • 145
0 votes
1 answer
799 views

Confusion on pop for recursive assembly code

I'm confused on what happens during POP. When POP LR happens does that change the PC to the location of ...
stumped's user avatar
  • 145
1 vote
1 answer
2k views

What happens If the interrupt occurs during the execution of HALT instruction?

Consider the following program segment on a hypothetical processor . I have this question in my course CS201. Suppose this processor has 32 bits Load/Store operations, ALU operations is 16 bits and ...
Garner's user avatar
  • 113
0 votes
1 answer
785 views

stack calculation in microcontroller

I have written a program to estimate the stack usage in the following manner I have defined a global pointer variable to unsigned char. I have defined a local variable in the main program and have ...
rajesh's user avatar
  • 437
4 votes
0 answers
3k views

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: ...
Myanju's user avatar
  • 213
2 votes
2 answers
3k views

Is there stack available in PIC ISRs?

I'm trying to better understand the interaction between the foreground (interrupt) and background (while (1)) loops in a PIC microcontroller. Specifically, a ...
tarabyte's user avatar
  • 3,142
0 votes
1 answer
518 views

Context switching and systick handling on the STM32F series

I am using a STM32F407 board to build my own tiny RTOS and I have some questions. How can I define my own stack in different memory location, so I can have one stack for each queue of tasks? How do I ...
sedfy Elkebear's user avatar
-4 votes
2 answers
2k views

scheduler and stack

i develop my own scheduler on stm32f407 board i have different queues of tasks with different priorities and frequencies i want to mange stack operations myself when in SysTick_Handler event each ...
sedfy Elkebear's user avatar
3 votes
1 answer
1k views

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 ...
d-coder's user avatar
  • 131
4 votes
1 answer
1k views

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's user avatar
  • 3,142
3 votes
4 answers
1k views

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? ...
tarabyte's user avatar
  • 3,142
2 votes
2 answers
2k views

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: <...
John G's user avatar
  • 21
4 votes
2 answers
449 views

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 ...
quantum231's user avatar
  • 11.6k
7 votes
6 answers
4k views

Exploiting stack buffer overflows on an Arduino

Is it possible exploit stack buffer overflows on an Arduino board?
DarkCoffee's user avatar
11 votes
3 answers
2k views

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 ...
NickHalden's user avatar
  • 4,177
5 votes
1 answer
978 views

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 ...
tarabyte's user avatar
  • 3,142
4 votes
3 answers
549 views

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/...
damien's user avatar
  • 1,263
7 votes
3 answers
3k views

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 ...
abdullah kahraman's user avatar