Program size depending on the use of a single instruction

Hello,

I am currently working with a Nucleo STM32-F303K8 board and I observed a strange thing. My project involves many features of the µC: DAC, ADC, CAN bus, SPI bus and so on … and is made of several files. I am working with the mbed online compiler.
But, when I added a soft reset command “NVIC_SystemReset()” at the beginning of the main() program, the flash memory size of the program dropped from 60.1kB to 45kB. Commenting this line leads to the 60.1kB program after rebuild.
Does anyone has an explanation ?

Thank you.

Because the compiler removes unused functions? Calling NVIC_SystemReset() at the beginning of the main() means the program just keeps resetting. Right?

1 Like

Yes indeed! (and I realize my question was stupid…). Thank you.

1 Like