Common codebase, different HSE. Any solution when using STM32CubeMx and IDE?
So I'm kinda out of ideas on a simple solution on this.
System:
The project is using a common code/binary for two slightly different hardwares. Runtime detection is used (through IO's) to detect what hardware the software is running on. On the current prosject the HSE input is different between the two. You could discuss the logic of this, but here we are, and there are some clear benefits to it as well.
Issue:
Clock configuration needs to be different even if working with one CubeMX file. This is easily handled with selecting "Do not generate system call" in CubeMx and simply duplicating the SystemConfig_Clock() function and keeping one the main. Its not every day clock config is changed.
The issue is however that the compiler define HSE_VALUE is also updated by CubeMx. And it seems to be done so by a script replacing all instances. This value is used in the system file for returning system clock to other peripherals.
Is there any clean and good way to do this?
Could HSE_VALUE somehow be made dynamic? I dont mind changing system_stm32xxx.c but I guess CubeMx will replace it as soon as it gets the chance.
BR
K. Tommy
