Question

I'm currently using IAR Embedded Workbench to do development for an NXP LPC2378 micro. I think I'm running into issues where my IRQ and CSTACK need to be bigger since the CPU keeps crashing and I noticed that these regions would "bleed" over into surrounding memory areas. I guess I dont really understand what these and the other regions of memory are used for? I use an RTOS (CMX) which reserves RAM for the ISR, but this seems like its for something different.

What are the IRQ_STACK, CSTACK, SVC_STACK, FIQ_STACK, UND_STACK, and ABT_STACK used for when I am using an RTOS, or are they something separate entirely?

Was it helpful?

Solution

LPC23XX have a few different modes. Each mode has its own stack. Things like interrupts involve switching mode by saving the context registers (to the current mode's stack, I believe) before switching to a different mode, among other things.

That you are using an RTOS doesn't change the purpose of these stacks, but sometimes RTOSes may have requirements about them (you might want to look this up for CMX).

  • IRQ_STACK - Interrupt (IRQ) mode stack.
  • CSTACK - User and system modes stack. This is your regular stack for code execution most of the time.
  • SVC_STACK - Supervisor mode stack. Some instructions can only be run in SVC mode. IIRC the CPU starts in this mode and drops out of it after the initial setup has been done.
  • FIQ_STACK - FIQ interrupt mode stack. Fast interrupts (FIQs) can occur during an IRQ - they're like a higher priority IRQ. FIQs and IRQs are disabled when in a FIQ.
  • UND_STACK Undefined instruction mode stack.
  • ABT_STACK Abort mode stack, for data aborts and so on. (You can set up handlers to run when an abort is triggered.)

I'm not familiar with IAR, but if these are sizes then they are equivalent to UND_Stack_Size, SVC_Stack_Size, ABT_Stack_Size, FIQ_Stack_Size, IRQ_Stack_Size, and USR_Stack_Size in uVision. ISR_Stack_Size or equivalent should be the sum of the first five.

Remember, overflowing the stack(s) makes bad things happen. You quite possibly need to make your stack(s) larger, but like I said, you probably need to look up the min. required values for CMX.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top