In general, I like the way that ST handles code generation by their device configurator, CubeMX. The generated files contain sections that are entirely controlled by the framework, interspersed with blocks intended for user code that is preserved in ...