3 ms·
#3 is true for embedded. When you power your MCU, you'll get RAM with 0xff. Something will insert code to zero bss section. Usually it's so-called system initia
by vbezhenar 2y ago
#3 is true for embedded. When you power your MCU, you'll get RAM with 0xff. Something will insert code to zero bss section. Usually it's so-called system initialization code which will transfer control to libc initialization code. So you'll have your MCU wasting cycles (if you don't really need zero-initialized globals).
I'm not aware of operating systems implementation, but I doubt that there's some magic to provide zero-initialized memory. To zero out memory, you need CPU work. Probably OS won't reuse memory because of security reasons and will need to erase it any way.
That's not a big issue, of course. With some linker tinkering you can declare truly uninitialized global variables. Not "standard C", but whatever.
- cozzyd 2y agoYou can change this zero initialization easily enough on a microcontroller (either by removing that code or modifying the linker map).