SysTick_Handler triggering before main initialization is complete
I am using custom STM32G4 board and generated code using the MCSDK 6.2.0. I am observing that the SysTick_Handler(void) function is called before the peripheral initializations, and it is leading to hardware fault.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_ADC2_Init();
#ifdef DACENABLED
MX_DAC1_Init();
#endif
MX_CORDIC_Init();
MX_OPAMP1_Init();
MX_OPAMP2_Init();
MX_OPAMP3_Init();
MX_TIM1_Init();
MX_TIM4_Init();
MX_FDCAN1_Init();
/* USER CODE BEGIN 2 */
MX_MotorControl_Init();
/* Initialize interrupts */
MX_NVIC_Init();
HAL_FDCAN_Start(&hfdcan1);
system_ready = true;
#ifdef DACENABLED
HAL_DAC_Start(&hdac1,DAC_CHANNEL_1);
#endif
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
// HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_12);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}But the Systick interrupt is enabled only in MX_MotorControl_Init(). Then why it is called sometime after the HAL_Init();
