Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/G4ADCTESTING.elf",
"name": "G4ADCTESTING",
"name": "G4CANTESTING",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -234,7 +234,7 @@
"searchDir": [],
"preLaunchTask": "CMake: configure and build G4ADCTESTING",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Vendor/CMSIS_5/SVD/STM32G474.svd",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 170000000,
Expand All @@ -250,6 +250,37 @@
}
]
}
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/G4CANTESTING.elf",
"name": "G4CANTESTING",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32g4x.cfg"
],
"searchDir": [],
"preLaunchTask": "CMake: configure and build G4CANTESTING",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
}
]
}
17 changes: 13 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target CCU"
},
{
"label": "CMake: configure and build G4HELLO",
"label": "CMake: configure and build G4ADCTESTING",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"CMake: configure"
],
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4HELLO"
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4ADCTESTING"
},
{
"label": "CMake: configure and build G4PERTESTING",
Expand All @@ -46,13 +46,22 @@
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4PERTESTING"
},
{
"label": "CMake: configure and build G4ADCTESTING",
"label": "CMake: configure and build G4CANTESTING",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"CMake: configure"
],
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4ADCTESTING"
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4CANTESTING"
},
{
"label": "CMake: configure and build G4HELLO",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"CMake: configure"
],
"command": "cmake --build build/${command:cmake.activeBuildPresetName} --target G4HELLO"
},
{
"label": "CMake: configure and build G4BLINKY",
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ include("${lib_path}/Utils/BitManipulations/bit-utils.cmake")

# Peripherals
include("${lib_path}/Peripherals/USART/common.cmake")
include("${lib_path}/Peripherals/CAN/common.cmake")
include("${lib_path}/FancyLayers-RENAME/ADC/adc.cmake")

# FIXME Temporary holdover for CAN messages until URCA is ready for merge
Expand All @@ -67,6 +68,7 @@ add_gr_project(STM32G474xE CCU)
# Development
add_gr_project(STM32G474xE G4ADCTESTING)
add_gr_project(STM32G474xE G4PERTESTING)
add_gr_project(STM32G474xE G4CANTESTING)

# BLINKY Demos
add_gr_project(STM32G474xE BLINKY G4HELLO)
Expand Down
56 changes: 56 additions & 0 deletions G4CANTESTING/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
cmake_minimum_required(VERSION 3.25)

# Setup compiler settings
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

# Define the build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

# Enable compile command to ease indexing with e.g. clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

# Enable CMake support for ASM and C languages
enable_language(
C
ASM
)

# Core project settings
project(${CMAKE_PROJECT_NAME})

# what, does in fact not get the filename of somthing but rather the name of the project from the path
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)

add_library(${PROJECT_NAME}_USER_CODE INTERFACE)

target_sources(
${PROJECT_NAME}_USER_CODE
INTERFACE
Core/Src/adc.c
Core/Src/crc.c
Core/Src/dma.c
Core/Src/gpio.c
Core/Src/i2c.c
Core/Src/main.c
Core/Src/spi.c
Core/Src/stm32g4xx_hal_msp.c
Core/Src/stm32g4xx_it.c
Core/Src/syscalls.c
Core/Src/sysmem.c
Core/Src/system_stm32g4xx.c
Core/Src/tim.c
Core/Src/usart.c
)

target_link_libraries(${PROJECT_NAME}_USER_CODE INTERFACE PERIPHERAL_CAN_LIB)
target_link_libraries(
${PROJECT_NAME}_USER_CODE
INTERFACE
PERIPHERAL_CAN_TEST_LIB
)

target_include_directories(${PROJECT_NAME}_USER_CODE INTERFACE Core/Inc)
49 changes: 49 additions & 0 deletions G4CANTESTING/Core/Inc/adc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_H__
#define __ADC_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_ADC1_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __ADC_H__ */
51 changes: 51 additions & 0 deletions G4CANTESTING/Core/Inc/crc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file crc.h
* @brief This file contains all the function prototypes for
* the crc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CRC_H__
#define __CRC_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern CRC_HandleTypeDef hcrc;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_CRC_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __CRC_H__ */
51 changes: 51 additions & 0 deletions G4CANTESTING/Core/Inc/dma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file dma.h
* @brief This file contains all the function prototypes for
* the dma.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DMA_H__
#define __DMA_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* DMA memory to memory transfer handles -------------------------------------*/

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_DMA_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __DMA_H__ */
51 changes: 51 additions & 0 deletions G4CANTESTING/Core/Inc/fdcan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file fdcan.h
* @brief This file contains all the function prototypes for
* the fdcan.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __FDCAN_H__
#define __FDCAN_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern FDCAN_HandleTypeDef hfdcan2;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_FDCAN2_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __FDCAN_H__ */
Loading
Loading