SystemClock_Config() and extern "C"
Posted: Sat Mar 08, 2025 3:00 am
The question of how to change the default system clock setup has come up here many times. The advice normally given is to define a SystemClock_Config() function with extern "C" in the sketch .ino file. That is really just repeating what is says here https://github.com/stm32duino/Arduino_C ... ock_config for those who have missed seeing that.
I was looking at this after I myself gave the advice about the extern "C" on SystemClock_Config() in a recent thread here (viewtopic.php?t=2578). I was a bit surprised to discover, when I tested it, that the extern "C" was not actually required. Regardless of whether I have that on my SystemClock_Config() or not, it still gets called automatically.
What is the true story? Was the extern "C" required at some time, but not anymore? Or, maybe it is still required, but not in all situations?
I was looking at this after I myself gave the advice about the extern "C" on SystemClock_Config() in a recent thread here (viewtopic.php?t=2578). I was a bit surprised to discover, when I tested it, that the extern "C" was not actually required. Regardless of whether I have that on my SystemClock_Config() or not, it still gets called automatically.
What is the true story? Was the extern "C" required at some time, but not anymore? Or, maybe it is still required, but not in all situations?