2021-11-13 08:23 PM
I know this is a vague question, but it's a very strange problem I'm facing. My application (based on STM32G0) is working fine. I used CubeMX to autogenerate all the code, and have been building on top of it. Now I am looking to clean things up a bit so code is better organized and I changed my SystemClock_Config() to a static function. By making this simple change, my code has stopped working. I haven't dug into the exact nature of the failure yet, but it seems like some of my timers may not be running correctly.
The only change is that instead of calling the SystemClock_Config() function from main(), I call a System_Init() (on the same line in main) which then immediately calls the now static SystemClock_Config().
I suspect there's some other underlying issue that was being masked previous, but this got me thinking of what would this even change that could have any impact on the application. So with that, I have 2 questions:
2021-11-14 07:19 AM
Making SystemClock_Config a static function won't cause it to behave differently. Look into what "code has stopped working" means in particular. Stay objective, don't guess at solutions that don't make sense.