C, skip static array initialization

Is there a way to instruct gcc to skip initialization for certain static, mutable variables? I have several circular buffers (declared volatile) that really do not need to be zeroed at startup and on my MCU, this is a waste of about ~ 2500 tcy.

Thanks in advance,

+6
source share
1 answer

If you use gcc , you can put the array object in the .noinit section:

 uint8_t arr[1024] __attribute__ ((section (".noinit"))); 
+6
source

Source: https://habr.com/ru/post/949889/


All Articles