Configure clang tools and update build settings

- Added `.clang-tidy` with custom checks to enforce code style.
- Created `.clangd` with specific compile flag additions and removals.
- Updated `.gitignore` to include new cache, metadata, and configuration files.
- Updated `platformio.ini`:
  - Bumped `Simple FOC` to version 2.3.4 and `STM32_CAN` to version 1.1.2.
  - Added `gen_compile_commands.py` as an extra script.
This commit is contained in:
Ilya Uraev 2025-01-18 18:26:45 +03:00
parent 328dd0e0aa
commit 0199c1e38f
6 changed files with 53 additions and 2 deletions

View file

@ -0,0 +1 @@
Checks: '-*, -misc-definitions-in-headers'

View file

@ -0,0 +1,18 @@
CompileFlags:
Add:
[
# -mlong-calls,
-DSSIZE_MAX,
-DLWIP_NO_UNISTD_H=1,
-Dssize_t=long,
-D_SSIZE_T_DECLARED,
]
Remove:
[
-fno-tree-switch-conversion,
-mtext-section-literals,
-mlongcalls,
-fstrict-volatile-bitfields,
-free,
-fipa-pta,
]

View file

@ -3,3 +3,7 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.cache/
.metadata/
cubemx_config/
compile_commands.json

View file

@ -0,0 +1,19 @@
Import("env")
# Получаем путь к компилятору из окружения PlatformIO
gcc_path = env.subst("$CC")
# Выполняем команду для получения версии компилятора
import subprocess
try:
result = subprocess.run([gcc_path, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
print(f"GCC version: {result.stdout}")
else:
print(f"Failed to get GCC version: {result.stderr}")
except Exception as e:
print(f"Error while getting GCC version: {e}")
# Дополнительно проверяем путь к компилятору
print(f"Compiler path: {gcc_path}")

View file

@ -0,0 +1,8 @@
import os
Import("env")
# include toolchain paths
env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True)
# override compilation DB path
env.Replace(COMPILATIONDB_PATH="compile_commands.json")

View file

@ -23,5 +23,6 @@ build_flags =
-D HAL_CAN_MODULE_ENABLED
-D SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH
lib_deps =
askuric/Simple FOC@^2.3.2
pazi88/STM32_CAN@^1.1.0
askuric/Simple FOC@^2.3.4
pazi88/STM32_CAN@^1.1.2
extra_scripts = pre:gen_compile_commands.py