stm32 heap and stack

Publisher:小九分析仪Latest update time:2016-07-27 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
First, let's understand the meaning of heap and stack ():

(1) Stack: Automatically allocated and released by the compiler, it stores function parameter values, local variable values, etc. Its operation is similar to the stack in the data structure.

(2) Heap: Generally allocated and released by the programmer. If the programmer does not release it, it may be reclaimed by the operating system when the program ends. The allocation method is similar to the linked list in the data structure.

(3) Global area (static area): Global variables and static variables are stored together. Initialized global variables and static variables are in one area, and uninitialized global variables and uninitialized static variables are in another adjacent area. They are automatically released by the system after the program ends.

(4) Text constant area: Constant character strings are stored here.

(5) Program code area: stores the binary code of the function body.

There are a lot of nouns to explain, but this is not the point. The point is to look at the examples!

​ int a=0; //global initialization area

   char *p1; //global uninitialized area

   main()

    {

    int b; //stack

    char s[]="abc"; //stack

    char *p3= "1234567"; //In the text constant area

    static int c =0 ; //static initialization area

    p1= (char *)malloc(10); //heap area

    strcpy(p1,"123456"); //"123456" is placed in the constant area

    }

Keywords:stm32 Reference address:stm32 heap and stack

Previous article:ARM 11 naked running 1 LED cycle light up
Next article:STM32SPI read and write functions

Recommended ReadingLatest update time:2024-11-16 18:09

Discussion on AC and DC sampling of STM32 ADC
cutting edge Regarding the STM32 sampling problem, I believe many people have encountered such a problem, whether it is about the underlying configuration of the ADC or the choice of the ADC sampling solution, or the ADC software and hardware filtering algorithm. Here, the blogger will extend the training questions he
[Microcontroller]
Discussion on AC and DC sampling of STM32 ADC
Design of intelligent control network terminal based on STM32 embedded system
Intelligent network terminal is an embedded terminal device that realizes intelligent management. It usually has the basic functions of security access control system and automatic control. This article focuses on the design and implementation of the network control function of intelligent embedded terminal based on
[Microcontroller]
Design of intelligent control network terminal based on STM32 embedded system
How to solve the problem of the program stuck at B. when running STM32
background: When the program is running, it is found that the program is stuck at B. Solution: If the program is stuck at B., it means that an interrupt has not been processed, causing the program to be unable to jump out after entering the interrupt. After checking the program, I found that an interrupt was d
[Microcontroller]
STM32 Note SD card reading and writing and FatFS file system
Because I need to use it, I learned how to operate the SD card with SPI, and at the same time transplanted a free and open source FAT file system: FatFS. It feels good. I have realized the operation of reading and writing files on the microcontroller. Next, I can explain my G code!   My SD card underlying operation re
[Microcontroller]
STM32_BKP backup data
Today we will explain "STM32F103 BKP backup data". The knowledge about "BKP backup data" is not difficult, but there are still a few points to note. BKP, as the name implies, is a backup register (see the reference manual), which is mainly used for backup data.   The difference between my article and other articles on
[Microcontroller]
STM32_BKP backup data
stm32 initializes three serial ports
serial.c  #include "serial.h"          int fputc(int ch,FILE *p) //The system automatically uses this function when using printf     {         USART_SendData(USART2,(u8)ch);           while(USART_GetFlagStatus(USART2,USART_FLAG_TXE)==RESET);         return ch;              }     /*************************************
[Microcontroller]
STM32 Learning IIC
Like other peripherals, the STM32 standard library provides an I2C initialization structure and initialization function to configure the I2C peripheral. The initialization structure and function are defined in the library files "stm32f4xx_i2c.h" and "stm32f4xx_i2c.c".   I2C_ClockSpeed;  I2C_Mode;  I2C_DutyCycle;  I2C
[Microcontroller]
STM32 study notes USB data receiving and sending process analysis
Now that you have learned USB, you must understand how USB devices communicate with USB host data. Here we mainly talk about the device side, because our code is used for USB devices. We need to define the USB interrupt. First, in the interrupt vector table of STM32, two interrupts are given to USB. We can find these
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号