STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
systick.c
Go to the documentation of this file.
1 
25 /* Includes ------------------------------------------------------------------*/
26 #include "systick.h"
27 
28 #include "board.h"
29 #include "mcu_hal.h"
30 
31 /* Functions -----------------------------------------------------------------*/
32 void SystickInit(void)
33 {
34  (void)HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000U);
35  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
36  HAL_NVIC_SetPriority(SYSTICK_IRQ_PRIORITY, 0U, 0U);
37 }
38 
39 void SystickDeInit(void)
40 {
41  // Message: A conversion should not be performed between a pointer to
42  // object and an integer type [misra-c2012-11.4]
43  // Reason: The following defines are addressing the memory mapped
44  // registers of the microcontroller.
45  // Risk: Conversion of a pointer to object into an integer may
46  // produce a value that cannot be represented in the chosen
47  // integer type resulting in undefined behavior.
48  // Prevention: Code reviews.
49  SysTick->CTRL = 0U; // cppcheck-suppress [misra-c2012-11.4]
50  SysTick->LOAD = 0U; // cppcheck-suppress [misra-c2012-11.4]
51  SysTick->VAL = 0U; // cppcheck-suppress [misra-c2012-11.4]
52 }
53 
57 // NOLINTNEXTLINE(readability-identifier-naming,clang-diagnostic-missing-prototypes)
58 void SysTick_Handler(void)
59 {
60  HAL_IncTick();
61 }
62 
This file contains the board-specific GPIO pin definitions, peripheral configurations,...
#define SYSTICK_IRQ_PRIORITY
Definition: board.h:147
void SystickDeInit(void)
De-initialize the SysTick timer.
Definition: systick.c:39
void SystickInit(void)
Initialize the SysTick timer with a 1 ms tick period.
Definition: systick.c:32
void SysTick_Handler(void)
This function handles systick timer interrupts.
Definition: systick.c:58
This file includes the microcontroller-specific HAL header files.
This file contains the SysTick timer initialization and de-initialization function prototypes.