Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
110 changes: 33 additions & 77 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/W3_G4SPI_Receive.elf",
"name": "SPI Receive W3 WS",
"executable": "${command:cmake.buildDirectory}/G4HELLO.elf",
"name": "G4HELLO",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -49,8 +49,8 @@
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 115200,
"cpuFrequency": 170000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
Expand All @@ -65,8 +65,8 @@
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/W3_G4SPI_Transmit.elf",
"name": "SPI Transmit W3 WS",
"executable": "${command:cmake.buildDirectory}/G4BLINKY.elf",
"name": "G4BLINKY",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -77,27 +77,12 @@
"searchDir": [],
"preLaunchTask": "CMake: configure and build",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 115200,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd"
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/G4BLINKY.elf",
"name": "G4BLINKY",
"executable": "${command:cmake.buildDirectory}/U5BLINKY.elf",
"name": "U5BLINKY",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -108,27 +93,28 @@
"searchDir": [],
"preLaunchTask": "CMake: configure and build",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 115200,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
"svdPath": "${workspaceFolder}/Lib/Platform/STM32U5A9xJ/CompileDependencies/STM32U5A9.svd"
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/U5BLINKY.elf",
"name": "U5BLINKY",
"executable": "${command:cmake.buildDirectory}/L4BLINKY.elf",
"name": "L4BLINKY",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32l4x.cfg"
],
"searchDir": [],
"preLaunchTask": "CMake: configure and build",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32L476xG/CompileDependencies/STM32L476.svd"
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/W3_G4SPI_Receive.elf",
"name": "SPI Receive W3 WS",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -139,53 +125,23 @@
"searchDir": [],
"preLaunchTask": "CMake: configure and build",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32U5A9xJ/CompileDependencies/STM32U5A9.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 115200,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd"
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/L4BLINKY.elf",
"name": "L4BLINKY",
"executable": "${command:cmake.buildDirectory}/W3_G4SPI_Transmit.elf",
"name": "SPI Transmit W3 WS",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32l4x.cfg"
"target/stm32g4x.cfg"
],
"searchDir": [],
"preLaunchTask": "CMake: configure and build",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Platform/STM32L476xG/CompileDependencies/STM32L476.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 115200,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
"svdPath": "${workspaceFolder}/Lib/Platform/STM32G474xE/CompileDependencies/STM32G474.svd"
}
]
}
46 changes: 46 additions & 0 deletions BLINKY/G4HELLO/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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()

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

# 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})

# Questionable...
# set(TARGET_FLAGS "-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ")
# set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-T${CHIP_PATH}/CompileDependencies/STM32G474RETx_FLASH.ld")

add_library(${GR_PROJECT_NAME}_USER_CODE INTERFACE)
target_sources(
${GR_PROJECT_NAME}_USER_CODE
INTERFACE
Core/Src/main.c
Core/Src/stm32g4xx_it.c
Core/Src/stm32g4xx_hal_msp.c
Core/Src/system_stm32g4xx.c
Core/Src/sysmem.c
Core/Src/syscalls.c
)

target_link_libraries(${GR_PROJECT_NAME}_USER_CODE INTERFACE)

target_include_directories(${GR_PROJECT_NAME}_USER_CODE INTERFACE Core/Inc)
95 changes: 95 additions & 0 deletions BLINKY/G4HELLO/Core/Inc/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @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 __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

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

#include "stm32g4xx_ll_bus.h"
#include "stm32g4xx_ll_cortex.h"
#include "stm32g4xx_ll_crs.h"
#include "stm32g4xx_ll_dma.h"
#include "stm32g4xx_ll_exti.h"
#include "stm32g4xx_ll_gpio.h"
#include "stm32g4xx_ll_lpuart.h"
#include "stm32g4xx_ll_pwr.h"
#include "stm32g4xx_ll_rcc.h"
#include "stm32g4xx_ll_system.h"
#include "stm32g4xx_ll_utils.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

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

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define RCC_OSC32_IN_Pin LL_GPIO_PIN_14
#define RCC_OSC32_IN_GPIO_Port GPIOC
#define RCC_OSC32_OUT_Pin LL_GPIO_PIN_15
#define RCC_OSC32_OUT_GPIO_Port GPIOC
#define RCC_OSC_IN_Pin LL_GPIO_PIN_0
#define RCC_OSC_IN_GPIO_Port GPIOF
#define RCC_OSC_OUT_Pin LL_GPIO_PIN_1
#define RCC_OSC_OUT_GPIO_Port GPIOF
#define T_SWDIO_Pin LL_GPIO_PIN_13
#define T_SWDIO_GPIO_Port GPIOA
#define T_SWCLK_Pin LL_GPIO_PIN_14
#define T_SWCLK_GPIO_Port GPIOA
#define T_SWO_Pin LL_GPIO_PIN_3
#define T_SWO_GPIO_Port GPIOB

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
Loading