The OP
Published on 2018-11-20 23:14
Only look at the author
This post is from 51mcu
Latest reply
This post was last edited by BasaraTama on 2018-11-26 22:42 Generally, arm programs contain Code segment, RW segment, and ZI segment by default; RW segment is an initialized global variable; ZI segment is an uninitialized global variable; its initial value is 0, so it does not occupy rom space, and ram can be directly cleared to 0, which will not affect the size of the bin/hex executable file output by the compiler. The initialization of the RW segment, ZI segment, and stack needs to be completed before the main function is executed. You can see what operations are done in crt0.o and startup.s. Generally, you can see that the main function is called in the crt0.o and startup.s codes, and there are memcpy (moving the initial value of the global variable in the load space rom to the execution space ram) and memset (clearing the execution space ram where the uninitialized global variable is located) operations before main is executed. The above segment addresses and space addresses can be described by the linker script of the linker. It is recommended to read the compiler principle/programmer's self-cultivation.
Details
Published on 2018-11-26 22:33
| ||
|
||
2
Published on 2018-11-21 08:56
Only look at the author
| |
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
|
|
|
3
Published on 2018-11-21 09:22
Only look at the author
This post is from 51mcu
Comments | ||
|
||
|
This post is from 51mcu
Comments | ||
|
||
|
This post is from 51mcu
| ||
|
||
|
6
Published on 2018-11-21 11:28
Only look at the author
This post is from 51mcu
Comments
Oh! So where are the variables without initial values stored? When actually compiling, adding or reducing variables does not affect the size of the code. So when downloading the program, are the variables stored in the RAM area? Or are they defined in the ROM area, and the variables are defined in the RAM area when the power is initialized? I can't figure it out now.
Details
Published on 2018-11-21 15:55
| ||
|
||
|
This post is from 51mcu
Comments
It depends on your data type. By default, the memory code is assigned to the ROM area. You cannot write xdata in the extended memory and pdata in the paged memory... Keil will clear all memory data to 0 during initialization. If this initialization clear is not executed in the assembly of the project under construction, and it is a software reset,
Details
Published on 2018-11-21 16:16
| ||
|
||
|
8
Published on 2018-11-21 16:16
Only look at the author
This post is from 51mcu
| ||
|
||
|
liushiming82
Currently offline
|
9
Published on 2018-11-21 16:25
Only look at the author
This post is from 51mcu
| |
Personal signature单片机软件/硬件交流群:127034610
|
||
|
This post is from 51mcu
| ||
|
||
|
BasaraTama
Currently offline
|
11
Published on 2018-11-26 22:33
Only look at the author
This post is from 51mcu
| |
|
||
|
EEWorld Datasheet Technical Support
EEWorld
subscription
account
EEWorld
service
account
Automotive
development
circle
About Us Customer Service Contact Information Datasheet Sitemap LatestNews
Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190