Hi,
The linker put global data into .data segment and .bss segment. Those data with initial value is put in .data segment. The data hasn't initial value is put in .bss segment.
When power on, the data in RAM is uncertain. They often appear zero, but it is not guaranteed. In KDS startup file (startup.c or startup_MKE06Z4.s) it write 0 to fill the bss segment. Then it copy initial data to .data segment.
For example, in startup_MKE06Z4.s
ldr r1, =__etext //data segment start address in Flash
ldr r2, =__data_start__ //data start address in RAM
ldr r3, =__data_end__ //data end address in RAM
subs r3, r2
ble .LC0 //get data length
.LC1:
subs r3, 4
ldr r0, [r1,r3]
str r0, [r2,r3] //copy data segment
bgt .LC1 //loop
.LC0:
Pleas pay attention to __etext, __data_start__, __data_end__ . These address value is defined in .ld file. You can check these address value and compare all the data when simulation on your board.
Regards,
Jing