前言
程序的存储
程序的主要存储模型

通过代码分析
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PI 3.1415926
enum color
{
red,
green,
yellow
};
int a = 6;
char* str1;
static int c = 3;
static int d;
const int b = 5;
int main()
{
static int e;
static int f = 2;
const char g;
char *str2 = "hello";
char str3[]="world";
str1 = (char*)malloc(sizeof(char)*strlen(str2));
strcpy(str1,str2);
if(a>5);
printf("str1 = %s\r\n",str1);
printf("str2 = %s\r\n",str2);
printf("str3 = %s\r\n",str3);
return 0;
}
#define PI 3.1415926
enum color
{
red,
green,
yellow
};
int a = 6;
char* str1;
static int c = 3;
static int d;
const int b = 5;
int main()
{
static int e;
static int f = 2;
const char g;
char *str2 = "hello";
char str3[]="world";
str1 = (char*)malloc(sizeof(char)*strlen(str2));
strcpy(str1,str2);
if(a>5);
printf("str1 = %s\r\n",str1);
printf("str2 = %s\r\n",str2);
printf("str3 = %s\r\n",str3);
return 0;
}
中断向量表
这些存储区与ROM和RAM的关系
ROM和RAM是什么
ROM与Flash是什么关系

ROM,RAM和以上的哪些存储结构体关系
断电和通电状态下的数据存储
为什么要分断电和通电状态分析
断电状态数据存储



通电状态数据存储

;1-栈
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
; <h> 栈配置,用于变量,函数调用
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000400 ; 1KB
AREA STACK, NOINIT, READWRITE, ALIGN=3 ;告诉汇编器汇编一个新的代码段或者数据段,名字叫做STACK,不初始化,可读可写,以8字节对齐
Stack_Mem SPACE Stack_Size ;对应EQU的那一行,表示分配1KB的空间
__initial_sp
;2-堆
; <h> 堆配置,用于malloc等函数的动态内存分配
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x00000200 ;512B
AREA HEAP, NOINIT, READWRITE, ALIGN=3 ;告诉汇编器汇编一个新的代码段或者数据段,名字叫做HEAP,不初始化,可读可写,以8字节对齐
__heap_base ;堆的起始地址
Heap_Mem SPACE Heap_Size ;对应EQU的那一行,表示分配512B的空间
__heap_limit
PRESERVE8 ;当前堆栈8字节对齐
THUMB ;兼容 THUMB 指令,老的指令,16bit,现在Cortex-M3的都是THUMB-2指令,兼容16/32位
参考文章