STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
board.h
Go to the documentation of this file.
1 
17 #ifndef BSP_BOARD_H
18 #define BSP_BOARD_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
33 /* Includes ------------------------------------------------------------------*/
34 #include "mcu_hal.h"
35 
36 #include <stdbool.h>
37 
38 /* Defines -------------------------------------------------------------------*/
39 // Message: A conversion should not be performed between a pointer to
40 // object and an integer type [misra-c2012-11.4]
41 // Reason: The following GPIO port and pin defines contain conversions that
42 // are addressing memory mapped registers and hardware specific
43 // features.
44 // Risk: Conversion of a pointer to object into an integer may produce a
45 // value that cannot be represented in the chosen integer type
46 // resulting in undefined behavior.
47 // Prevention: Code reviews.
48 
50 // cppcheck-suppress-macro [misra-c2012-11.4]
51 #define LED_GREEN1_GPIO_PORT GPIOB
53 // cppcheck-suppress-macro [misra-c2012-11.4]
54 #define LED_GREEN1_GPIO_PIN GPIO_PIN_13
56 // cppcheck-suppress-macro [misra-c2012-11.4]
57 #define LED_GREEN1_GPIO_ACTIVE_STATE GPIO_PIN_RESET
59 // cppcheck-suppress-macro [misra-c2012-11.4]
60 #define LED_GREEN1_GPIO_INACTIVE_STATE GPIO_PIN_SET
61 
63 // cppcheck-suppress-macro [misra-c2012-11.4]
64 #define LED_GREEN2_GPIO_PORT GPIOA
66 // cppcheck-suppress-macro [misra-c2012-11.4]
67 #define LED_GREEN2_GPIO_PIN GPIO_PIN_5
69 // cppcheck-suppress-macro [misra-c2012-11.4]
70 #define LED_GREEN2_GPIO_ACTIVE_STATE GPIO_PIN_SET
72 // cppcheck-suppress-macro [misra-c2012-11.4]
73 #define LED_GREEN2_GPIO_INACTIVE_STATE GPIO_PIN_RESET
74 
76 // cppcheck-suppress-macro [misra-c2012-11.4]
77 #define BUTTON_GPIO_PORT GPIOC
79 // cppcheck-suppress-macro [misra-c2012-11.4]
80 #define BUTTON_GPIO_PIN GPIO_PIN_13
82 // cppcheck-suppress-macro [misra-c2012-11.4]
83 #define BUTTON_GPIO_PRESSED_STATE GPIO_PIN_SET
84 
86 #define SDMMC_INIT_MAX_TRIES 5U
88 #define SDMMC_IRQ_PRIORITY 1U
90 #define SDMMC_DMA_IRQ_PRIORITY 2U
92 #define SDMMC_TRANSFER_TIMEOUT 500U
93 
95 // cppcheck-suppress-macro [misra-c2012-11.4]
96 #define SDMMC_GPIO_D0_PORT GPIOC
97 
99 // cppcheck-suppress-macro [misra-c2012-11.4]
100 #define SDMMC_GPIO_D0_PIN GPIO_PIN_8
101 
103 // cppcheck-suppress-macro [misra-c2012-11.4]
104 #define SDMMC_GPIO_D1_PORT GPIOC
105 
107 // cppcheck-suppress-macro [misra-c2012-11.4]
108 #define SDMMC_GPIO_D1_PIN GPIO_PIN_9
109 
111 // cppcheck-suppress-macro [misra-c2012-11.4]
112 #define SDMMC_GPIO_D2_PORT GPIOC
113 
115 // cppcheck-suppress-macro [misra-c2012-11.4]
116 #define SDMMC_GPIO_D2_PIN GPIO_PIN_10
117 
119 // cppcheck-suppress-macro [misra-c2012-11.4]
120 #define SDMMC_GPIO_D3_PORT GPIOC
121 
123 // cppcheck-suppress-macro [misra-c2012-11.4]
124 #define SDMMC_GPIO_D3_PIN GPIO_PIN_11
125 
127 // cppcheck-suppress-macro [misra-c2012-11.4]
128 #define SDMMC_GPIO_CLK_PORT GPIOC
129 
131 // cppcheck-suppress-macro [misra-c2012-11.4]
132 #define SDMMC_GPIO_CLK_PIN GPIO_PIN_12
133 
135 // cppcheck-suppress-macro [misra-c2012-11.4]
136 #define SDMMC_GPIO_CMD_PORT GPIOD
137 
139 // cppcheck-suppress-macro [misra-c2012-11.4]
140 #define SDMMC_GPIO_CMD_PIN GPIO_PIN_2
141 
143 // cppcheck-suppress-macro [misra-c2012-11.4]
144 #define SDMMC_GPIO_AF GPIO_AF12_SDMMC1
145 
147 #define SYSTICK_IRQ_PRIORITY 0U
148 
150 #define VCP_UART_BUFFER_SIZE 80U
152 #define VCP_UART_TX_TIMEOUT 100U
153 
155 // cppcheck-suppress-macro [misra-c2012-11.4]
156 #define VCP_UART_INSTANCE USART2
157 
159 #define VCP_UART_BAUDRATE 115200U
160 
162 // cppcheck-suppress-macro [misra-c2012-11.4]
163 #define VCP_UART_GPIO_TX_PORT GPIOD
164 
166 // cppcheck-suppress-macro [misra-c2012-11.4]
167 #define VCP_UART_GPIO_TX_PIN GPIO_PIN_6
168 
170 // cppcheck-suppress-macro [misra-c2012-11.4]
171 #define VCP_UART_GPIO_RX_PORT GPIOA
172 
174 // cppcheck-suppress-macro [misra-c2012-11.4]
175 #define VCP_UART_GPIO_RX_PIN GPIO_PIN_2
176 
178 // cppcheck-suppress-macro [misra-c2012-11.4]
179 #define VCP_UART_GPIO_AF GPIO_AF7_USART2
180 
181 /* Function prototypes -------------------------------------------------------*/
188 void BoardInit(void);
189 
196 void BoardDeInit(void);
197 
203 void SetVectorTableLocation(const uint32_t address);
204 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif
void SetVectorTableLocation(const uint32_t address)
Set the vector table location to the specified address.
Definition: board.c:79
void BoardDeInit(void)
De-initialize the board hardware and peripherals.
Definition: board.c:65
void BoardInit(void)
Initialize the board hardware and peripherals.
Definition: board.c:55
This file includes the microcontroller-specific HAL header files.