Skip to content

Commit 130cf27

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/code_gen_improvement-2.0.1.0
2 parents b55c6ca + 9c01e69 commit 130cf27

34 files changed

Lines changed: 2975 additions & 3353 deletions

.clang-format

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
TabWidth: 4
4+
UseTab: Never
5+
ColumnLimit: 100
6+
PointerAlignment: Left
7+
AccessModifierOffset: -4
8+
SortIncludes: Never
9+
AllowShortIfStatementsOnASingleLine: false
10+
AllowShortLoopsOnASingleLine: false
11+
Cpp11BracedListStyle: true
12+
BreakBeforeBraces: Attach
13+
BinPackArguments: false
14+
BinPackParameters: false
15+
AllowAllArgumentsOnNextLine: false
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
AlignAfterOpenBracket: BlockIndent
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Format Checks
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '**.cpp'
8+
- '**.hpp'
9+
- '**.c'
10+
- '**.h'
11+
- '.pre-commit-config.yaml'
12+
- '.clang-format'
13+
- '.github/workflows/format-checks.yml'
14+
15+
jobs:
16+
format:
17+
name: Check code format
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.12'
28+
29+
- name: Install tools
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install pre-commit
33+
sudo apt-get update
34+
sudo apt-get install -y clang-format
35+
36+
- name: Run pre-commit
37+
run: pre-commit run --all-files --show-diff-on-failure

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "Core/Inc/Communications/JSON_ADE"]
55
path = Core/Inc/Code_generation/JSON_ADE
66
url = https://github.com/HyperloopUPV-H8/JSON_ADE
7-
[submodule "Tests/VirtualMCU"]
8-
path = Tests/VirtualMCU
9-
url = https://github.com/HyperloopUPV-H8/VirtualMCU

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
minimum_pre_commit_version: "3.5.0"
2+
default_install_hook_types:
3+
- pre-commit
4+
- pre-push
5+
repos:
6+
- repo: https://github.com/pre-commit/mirrors-clang-format
7+
rev: v17.0.6
8+
hooks:
9+
- id: clang-format
10+
files: ^(Core/|tools/).*
11+
types_or:
12+
- c
13+
- c++
14+
exclude: ^Core/Inc/Code_generation/Packet_generation/.*Template\.hpp$|^tools/binary_metadata_template\.cpp$

.vscode/launch.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@
100100
"cwd": "${workspaceFolder}",
101101
"externalConsole": false
102102
},
103+
{
104+
"name": "Debug ST-LIB tests (simulator)",
105+
"type": "cppdbg",
106+
"request": "launch",
107+
"program": "${workspaceFolder}/out/build/simulator/deps/ST-LIB/Tests/st-lib-test",
108+
"args": [],
109+
"cwd": "${workspaceFolder}",
110+
"externalConsole": false,
111+
"stopAtEntry": false,
112+
"MIMode": "lldb",
113+
"preLaunchTask": "Tests: Build simulator"
114+
},
103115
{
104116
"type": "cortex-debug",
105117
"request": "launch",
@@ -161,4 +173,4 @@
161173
"stm32cubeprogrammer": "/opt/st/stm32cubeclt_1.16.0/STM32CubeProgrammer/bin"
162174
}
163175
]
164-
}
176+
}

.vscode/settings.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 100}",
77
"C_Cpp.clang_format_sortIncludes": true,
88
"C_Cpp.intelliSenseCacheSize": 0,
9+
"cmake.testExplorerIntegrationEnabled": true,
10+
"cmake.defaultConfigurePreset": "simulator",
11+
"cmake.defaultBuildPreset": "simulator",
912
"files.associations": {
1013
"condition_variable": "cpp",
1114
"chrono": "cpp",
@@ -19,7 +22,6 @@
1922
"utility": "cpp",
2023
"variant": "cpp",
2124
"atomic": "cpp",
22-
<<<<<<< HEAD
2325
"string": "cpp",
2426
"string_view": "cpp",
2527
"ranges": "cpp",
@@ -28,13 +30,9 @@
2830
"initializer_list": "cpp",
2931
"stacktrace": "cpp",
3032
"regex": "cpp",
31-
"valarray": "cpp"
32-
=======
33-
"bitset": "cpp",
33+
"valarray": "cpp",
3434
"cstdlib": "cpp",
3535
"mutex": "cpp",
36-
"shared_mutex": "cpp",
37-
"regex": "cpp"
38-
>>>>>>> origin/main
36+
"shared_mutex": "cpp"
3937
}
4038
}

.vscode/tasks.json

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,45 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"label": "Start Debug Server for Simulator on emulated arch",
6-
"type": "shell",
7-
"command": "ROSETTA_DEBUGSERVER_PORT=1234 ./out/build/latest.elf",
8-
"problemMatcher": [],
9-
"isBackground": true
10-
},
11-
// {
12-
// "label": "Pre-flash check",
13-
// "type": "shell",
14-
// "command": "${workspaceFolder}/virtual/bin/python",
15-
// "windows": {
16-
// "command": "${workspaceFolder}/virtual/Scripts/python"
17-
// },
18-
// "args": [
19-
// "${workspaceFolder}/tools/preflash_check.py"
20-
// ],
21-
// "problemMatcher": [],
22-
// "presentation": {
23-
// "reveal": "always",
24-
// "panel": "shared"
25-
// }
26-
// },
27-
{
28-
"label": "CMake: build then pre-flash check",
29-
"dependsOn": ["CMake: build", "Pre-flash check"],
30-
"dependsOrder": "sequence",
31-
"problemMatcher": []
32-
}
33-
]
34-
}
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Start Debug Server for Simulator on emulated arch",
6+
"type": "shell",
7+
"command": "ROSETTA_DEBUGSERVER_PORT=1234 ./out/build/latest.elf",
8+
"problemMatcher": [],
9+
"isBackground": true
10+
},
11+
{
12+
"label": "Tests: Configure simulator",
13+
"type": "shell",
14+
"command": "cmake --preset simulator",
15+
"problemMatcher": []
16+
},
17+
{
18+
"label": "Tests: Build simulator",
19+
"type": "shell",
20+
"command": "cmake --build --preset simulator -j8",
21+
"dependsOn": [
22+
"Tests: Configure simulator"
23+
],
24+
"problemMatcher": []
25+
},
26+
{
27+
"label": "Tests: Run all (simulator)",
28+
"type": "shell",
29+
"command": "ctest --test-dir out/build/simulator/deps/ST-LIB --output-on-failure",
30+
"dependsOn": [
31+
"Tests: Build simulator"
32+
],
33+
"problemMatcher": []
34+
},
35+
{
36+
"label": "Tests: Run ADC (simulator)",
37+
"type": "shell",
38+
"command": "ctest --test-dir out/build/simulator/deps/ST-LIB -R ADCTest --output-on-failure",
39+
"dependsOn": [
40+
"Tests: Build simulator"
41+
],
42+
"problemMatcher": []
43+
}
44+
]
45+
}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14)
33
project(template-project LANGUAGES ASM C CXX)
44

55
set(EXECUTABLE ${PROJECT_NAME}.elf)
6-
set(Board "VCU") # User must change the Board name
6+
set(Board "TEST") # User must change the Board name
77
set(STLIB_DIR ${CMAKE_CURRENT_LIST_DIR}/deps/ST-LIB)
88
set(LD_SCRIPT ${STLIB_DIR}/STM32H723ZGTX_FLASH.ld)
99

Core/Inc/Code_generation/JSON_ADE

Core/Inc/main.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/* USER CODE BEGIN Header */
22
/**
3-
******************************************************************************
4-
* @file : main.h
5-
* @brief : Header for main.c file.
6-
* This file contains the common defines of the application.
7-
******************************************************************************
8-
* @attention
9-
*
10-
* Copyright (c) 2022 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-
*/
3+
******************************************************************************
4+
* @file : main.h
5+
* @brief : Header for main.c file.
6+
* This file contains the common defines of the application.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2022 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+
*/
1919
/* USER CODE END Header */
2020

2121
/* Define to prevent recursive inclusion -------------------------------------*/
@@ -49,7 +49,7 @@ extern "C" {
4949

5050
/* USER CODE END EM */
5151

52-
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
52+
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim);
5353

5454
/* Exported functions prototypes ---------------------------------------------*/
5555
void Error_Handler(void);

0 commit comments

Comments
 (0)