单片机软硬件开发|keil编译后ROM和RAM变化

【单片机软硬件开发|keil编译后ROM和RAM变化】KEIL中编译后几个空间大小
1.Code=656:程序代码占用的空间
2.RO-data=https://www.it610.com/article/208:程序中常量占用的空间,只读数据如const+变量类型
3.RW-data=https://www.it610.com/article/0:初值不为0已被初始化的可读/写数据,运行时变量调用到RAM中。
4.ZI-data=https://www.it610.com/article/1632:初值为0未进行初始化的可读/写数据
RO:指令和常量=RO-data+RW-data
RW:初始化变量=RW-data+ZI-data
烧写的文件=RO+RW
RAM空间=RW+ZI
flash:Code+RO-data+RW-data
ram:RW-data+ZI-data

int main(void){} //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

int main(void){char mm; } //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

char mm; int main(void){} //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

const char mm=10; int main(void){} //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

char mm=10; int main(void){} //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

char mm=10; int main(void){mm++; } //Program Size: Code=700 RO-data=https://www.it610.com/article/224 RW-data=4 ZI-data=1636

int main(void){char mm=10; } //Program Size: Code=660 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

int main(void){char mm=10; mm++; } //Program Size: Code=660 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

const char mm=10; char tt; int main(void){} //Program Size: Code=656 RO-data=https://www.it610.com/article/208 RW-data=0 ZI-data=1632

const char mm=10; char tt; int main(void){if(mm==10)tt++; } //Program Size: Code=700 RO-data=https://www.it610.com/article/224 RW-data=4 ZI-data=1636

const char mm[10]={1,2,3,4,5,6,7,8,9,10}; char tt; int main(void){if(mm[2]==3)tt++; } //Program Size: Code=712 RO-data=https://www.it610.com/article/236 RW-data=4 ZI-data=1636

char mm[10]={1,2,3,4,5,6,7,8,9,10}; char tt; int main(void){if(mm[2]==3)tt++; } //Program Size: Code=712 RO-data=https://www.it610.com/article/224 RW-data=12 ZI-data=1636

    推荐阅读