Skip to content

Commit 6c6ca7c

Browse files
committed
Abstract the HAL to a general folder
Allows shared HAL and easy builds, without generating code for each individual project. Only HAL Conf.h gets regenerated now.
1 parent 1f30b44 commit 6c6ca7c

1,209 files changed

Lines changed: 689186 additions & 30158 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

VCU/firmware/.mxproject

Lines changed: 15 additions & 13 deletions
Large diffs are not rendered by default.

VCU/firmware/BUILD.bazel

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,29 @@ load("//:tools/outputs/build_outputs.bzl", "binary_out", "hex_out")
33

44
cc_binary(
55
name = "vcu_firmware_2026",
6-
srcs = glob(
7-
[
8-
"Core/Src/**/*.c",
9-
"Drivers/*HAL_Driver/**/*.c",
10-
"Middlewares/**/*.c",
11-
"USB_DEVICE/**/*.c",
12-
"Core/Inc/**/*.h",
13-
"Drivers/**/*.h",
14-
"Middlewares/**/*.h",
15-
"USB_DEVICE/**/*.h",
16-
],
17-
18-
allow_empty = True # allows empty globs, so the codebase can grow without refactoring
19-
),
6+
srcs = glob([
7+
"Core/Src/**/*.c",
8+
"Core/Inc/**/*.h",
9+
], allow_empty = True)
10+
+ [
11+
# Include the HAL for compilation
12+
"//drivers/stm32g4:hal_srcs",
13+
],
2014

2115
includes = [
2216
"Core/Inc",
23-
"Drivers/STM32G4xx_HAL_Driver/Inc",
24-
"Drivers/STM32G4xx_HAL_Driver/Inc/Legacy",
25-
"Drivers/CMSIS/Device/ST/STM32G4xx/Include",
26-
"Drivers/CMSIS/Include",
27-
"USB_DEVICE/App",
28-
"USB_DEVICE/Target",
29-
"Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
30-
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
31-
"Middlewares/Third_Party/FreeRTOS/Source/include",
32-
"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2",
33-
"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F",
34-
"//longhorn-lib:longhorn_lib"
3517
],
3618

37-
# Linker options
19+
deps = [
20+
"//drivers/stm32g4:stm32_headers",
21+
],
22+
23+
# Linker options, also includes the reset handler startup file
3824
linkopts = [
3925
"-T $(location //toolchain:stm32g474vetx_flash_script)",
4026
"$(location //toolchain:stm32g474_startup)",
4127
],
4228

43-
# Defines for the C preprocessor
4429
defines = [
4530
"DEBUG",
4631
"USE_HAL_DRIVER",
@@ -52,7 +37,6 @@ cc_binary(
5237
"//toolchain:stm32g474_startup",
5338
],
5439

55-
# Target platform constraints
5640
target_compatible_with = [
5741
"@platforms//cpu:arm",
5842
"@platforms//os:none",
@@ -67,6 +51,6 @@ binary_out(
6751
)
6852

6953
hex_out(
70-
name = "vcu_firmare_hex",
54+
name = "vcu_firmware_hex",
7155
src = ":vcu_firmware_2026"
72-
)
56+
)

VCU/firmware/Core/Inc/FreeRTOSConfig.h

Lines changed: 0 additions & 171 deletions
This file was deleted.

VCU/firmware/Core/Inc/gpio.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file gpio.h
5+
* @brief This file contains all the function prototypes for
6+
* the gpio.c file
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
/* USER CODE END Header */
20+
/* Define to prevent recursive inclusion -------------------------------------*/
21+
#ifndef __GPIO_H__
22+
#define __GPIO_H__
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
/* Includes ------------------------------------------------------------------*/
29+
#include "main.h"
30+
31+
/* USER CODE BEGIN Includes */
32+
33+
/* USER CODE END Includes */
34+
35+
/* USER CODE BEGIN Private defines */
36+
37+
/* USER CODE END Private defines */
38+
39+
void MX_GPIO_Init(void);
40+
41+
/* USER CODE BEGIN Prototypes */
42+
43+
/* USER CODE END Prototypes */
44+
45+
#ifdef __cplusplus
46+
}
47+
#endif
48+
#endif /*__ GPIO_H__ */
49+

VCU/firmware/Core/Inc/stm32g4xx_hal_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
/*#define HAL_SMBUS_MODULE_ENABLED */
6363
/*#define HAL_SPI_MODULE_ENABLED */
6464
/*#define HAL_SRAM_MODULE_ENABLED */
65-
/*#define HAL_TIM_MODULE_ENABLED */
65+
#define HAL_TIM_MODULE_ENABLED
6666
/*#define HAL_UART_MODULE_ENABLED */
6767
/*#define HAL_USART_MODULE_ENABLED */
6868
/*#define HAL_WWDG_MODULE_ENABLED */

VCU/firmware/Core/Inc/stm32g4xx_it.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ void HardFault_Handler(void);
5151
void MemManage_Handler(void);
5252
void BusFault_Handler(void);
5353
void UsageFault_Handler(void);
54+
void SVC_Handler(void);
5455
void DebugMon_Handler(void);
56+
void PendSV_Handler(void);
5557
void SysTick_Handler(void);
5658
/* USER CODE BEGIN EFP */
5759

VCU/firmware/Core/Inc/tim.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file tim.h
5+
* @brief This file contains all the function prototypes for
6+
* the tim.c file
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
/* USER CODE END Header */
20+
/* Define to prevent recursive inclusion -------------------------------------*/
21+
#ifndef __TIM_H__
22+
#define __TIM_H__
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
/* Includes ------------------------------------------------------------------*/
29+
#include "main.h"
30+
31+
/* USER CODE BEGIN Includes */
32+
33+
/* USER CODE END Includes */
34+
35+
extern TIM_HandleTypeDef htim1;
36+
37+
/* USER CODE BEGIN Private defines */
38+
39+
/* USER CODE END Private defines */
40+
41+
void MX_TIM1_Init(void);
42+
43+
/* USER CODE BEGIN Prototypes */
44+
45+
/* USER CODE END Prototypes */
46+
47+
#ifdef __cplusplus
48+
}
49+
#endif
50+
51+
#endif /* __TIM_H__ */
52+

0 commit comments

Comments
 (0)