main.c reference¶
Role of main.c¶
main.c should remain as close as possible to STM32CubeMX-generated code.
The preferred design is:
CubeMX controls peripheral initialization and startup sequence;
handwritten code is inserted only through
USER CODEsections;application logic is attached through
#include "platform.h",#include "user_code_0.h", and#include "user_code_2.h".
Documentation rule¶
This file should be documented as an integration and initialization shell, not as the primary place for handwritten application logic.