White Note 3 --- Stack

Refer  https://blog.csdn.net/myqq1418/article/details/81584761

Stack:

     "Stack (Stack)" and "heap (heap)" are two different dynamic data area, the stack is a linear structure, a chain structure stack
    heap (heap): generally assigned by the programmer release, if the program members do not release, may recover by the OS at the end of the program; public, if you want to use, you can get a portion of the heap by malloc (sizeof (xxx)); heap is an increasing upward from low address
    stack (stack): automatically by the compiler dispensing release, including temporary variables function parameters, local variable values, etc., used immediate release; the stack is down from the upper address.
    both are contiguous
    when the stack has been increased up, and the stack has been down application, then the last It may result in a stack overflow


    For example microcontroller 51, the microcontroller 51 includes a memory RAM chip, off-chip RAM, a ROM;
    on-chip RAM particular partition: 00H ~ 1FH working register
                     20H ~ 2FH bit addressing area
                30H ~ 7FH user RAM area
                80H ~ FFH special function registers (52 SCM high 128)
    stack area is opened in the RAM an address, also provide corresponding hardware, i.e., the SP register.
    Usually the stack area in the lower 128-bit, microcontroller reset, SP default address is 7FH.
    51 microcontroller, ROM address of 0000H ~ FFFFH (64k), to use a different RAM instruction operation.
    in the MSP430, the memory have a common structure, though physically completely separate storage area, such as RAM, ROM, peripheral modules, the SFR and the like, but are arranged in the same address space, using the same set of addresses, a data bus, the instruction.
    the MSP430, the stack memory space 0200H above.

 

  

  

Guess you like

Origin www.cnblogs.com/ssherry/p/12155246.html