• AVR Freaks

Hot!Viewing the stack contents in MPLAB X?

Author
onnimikki
Starting Member
  • Total Posts : 50
  • Reward points : 0
  • Joined: 2013/07/06 06:06:17
  • Location: 0
  • Status: offline
2019/01/08 09:16:16 (permalink)
0

Viewing the stack contents in MPLAB X?

Hi,
 
is there a way to view (in runtime) the contents of the stack (or heap) on a PIC32 or a PIC16?
 
It appears that this USED to be a feature in MPLAB X, but I can't seem to find it now (http://microchipdeveloper.com/emhead:eep-stack-snapshot)
 
thanks!
 
James
 
#1

14 Replies Related Threads

    Jim Nickerson
    User 452
    • Total Posts : 6722
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/08 09:44:02 (permalink)
    0
    Do these devices have a "hardware stack" ?
    #2
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/08 09:58:33 (permalink)
    0
    Hi,
     
    The PIC16F1619 that I'm using has a 16 level deep hardware stack.  The PIC32MX220 has a software stack.
     
    J
    #3
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/08 10:24:12 (permalink)
    0
    Ah... just found the Hardware Stack view in MPLAB X when I plugged in my PIC16.  DIdn't see something similar with the PIC32 in simulator mode.
    #4
    GeorgePauley
    Moderator
    • Total Posts : 1261
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/08 12:21:07 (permalink)
    0
    Stacks vary widely by device and tool.  Lower end devices often have only a hardware stack which is not readable.  Many higher end devices often only have a software stack in RAM and don't have a hardware stack at all.  These types of considerations end up affecting what stack displays MPLAB X will or won't show. 

    But it gets even MORE complicated.  Some higher end debug tools (e.g. ICD4) will play a game where they pop everything off the hardware stack to read it's contents, and then push it all back on, behind the scenes, during a debug halt.  So what tool you have matters to MPLAB X too.  And the simulator is a special case as it will always make it's emulated hardware stack available to MPLAB X IDE. 

    The reason you don't see a hardware stack view using simulator for PIC32 is that PIC32's don't have a hardware stack.
    #5
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/08 23:08:29 (permalink)
    0
    Thanks George! I had a feeling that it was going to be complicated. :-)
     
    For the higher end devices like the PIC32, with the stack being in RAM, is there a way just to have a look at the region of RAM that contains the stack?  Even just in simulation would be fine with me.
     
    thanks!
     
    J
    #6
    Jim Nickerson
    User 452
    • Total Posts : 6722
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 07:42:19 (permalink)
    0
    What actual problem are you trying to fix ?
    Or is this an academic question ?
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 18858
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 07:48:50 (permalink)
    +1 (1)
    For PIC32 you there is a window that shows the call stack.
    #8
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 07:58:19 (permalink)
    0
    JANickerson
    What actual problem are you trying to fix ?
    Or is this an academic question ?




    Not trying to solve a specific problem yet, but am trying to figure out how to access stack, heap and general RAM.  Am looking at how this is done on a few platforms (SAMD, PIC16/32, LPC).  At the moment, it looks like I might be able to do this using MPLAB X watchpoints defined by RAM address.  But that seems clunky compared to the RAM views in both MCUXpresso and Keil.
     
    Yes, it's all academic at this point since I'm a prof and use PICs and ARMs in class. :-)
     
    all the best,
    J
    #9
    Jim Nickerson
    User 452
    • Total Posts : 6722
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 08:00:29 (permalink)
    0
    Sometimes you might find you get better answers if you state the reason for the question up front.
    #10
    GeorgePauley
    Moderator
    • Total Posts : 1261
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 08:30:33 (permalink)
    0
    In a meeting so working from memory here...
     
    I think it's MPLAB X - Window - Memory Views - and then select the memory you want to view.
    #11
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 09:35:16 (permalink)
    0
    JANickerson
    Sometimes you might find you get better answers if you state the reason for the question up front.


    Hi Jim,
     
    Tried to frame the question about RAM to include the reason on a different, earlier thread and got zero response... so figured I needed to word it in terms of the stack and to change the context.  And, thus, much better response.  Up-front about the reason seemed to throw people off. :-)
    #12
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 09:37:18 (permalink)
    0
    GeorgePauley
    In a meeting so working from memory here...
     
    I think it's MPLAB X - Window - Memory Views - and then select the memory you want to view.




    Hi George,
     
    Yes, that mostly works (CPU Registers, SFRs, etc.).  On the PIC16 we can see the stack that way, but on the PIC32 and SAMD (with the software stacks) there is no specific option for viewing the stack (or the general RAM space).
     
    all the best,
     
    James
     
     
    #13
    Howard Long
    Super Member
    • Total Posts : 796
    • Reward points : 0
    • Joined: 2005/04/04 08:50:32
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2019/01/09 09:50:16 (permalink)
    +1 (1)
     
    PIC32, MPLAB X
     
    Memory: Window -> Target Memory Views -> Data Memory
    Call Stack: Window -> Debugging -> Call Stack
    #14
    onnimikki
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2013/07/06 06:06:17
    • Location: 0
    • Status: offline
    Re: Viewing the stack contents in MPLAB X? 2020/07/08 03:29:36 (permalink)
    0 (2)
    this is just a test post... please ignore.
    #15
    Jump to:
    © 2020 APG vNext Commercial Version 4.5