From 7d41473a8ba2d6414ff0f6a37020c3f5f2a1c807 Mon Sep 17 00:00:00 2001 From: Hector van der Aa Date: Sat, 21 Mar 2026 17:37:43 +0100 Subject: [PATCH] Added copyright information --- .gitignore | 2 + STM32/CM4/Core/Inc/main.h | 20 +- STM32/CM4/Core/Inc/stm32h7xx_hal_conf.h | 451 +++++++++++++----------- STM32/CM4/Core/Inc/stm32h7xx_it.h | 19 +- STM32/CM4/Core/Src/main.c | 74 ++-- STM32/CM4/Core/Src/stm32h7xx_hal_msp.c | 27 +- STM32/CM4/Core/Src/stm32h7xx_it.c | 99 ++---- STM32/CM7/Core/Inc/main.h | 20 +- STM32/CM7/Core/Inc/stm32h7xx_hal_conf.h | 451 +++++++++++++----------- STM32/CM7/Core/Inc/stm32h7xx_it.h | 19 +- STM32/CM7/Core/Src/main.c | 163 ++++----- STM32/CM7/Core/Src/stm32h7xx_hal_msp.c | 27 +- STM32/CM7/Core/Src/stm32h7xx_it.c | 99 ++---- STM32/CM7/Core/Src/syscalls.c | 118 +++---- STM32/CM7/Core/Src/sysmem.c | 23 +- Zephyr/src/main.c | 4 + 16 files changed, 752 insertions(+), 864 deletions(-) diff --git a/.gitignore b/.gitignore index 21d0b89..8490c15 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .venv/ +.cache/ +**/.cache/ diff --git a/STM32/CM4/Core/Inc/main.h b/STM32/CM4/Core/Inc/main.h index 894fd4f..bc13285 100644 --- a/STM32/CM4/Core/Inc/main.h +++ b/STM32/CM4/Core/Inc/main.h @@ -1,21 +1,7 @@ /* 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) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ diff --git a/STM32/CM4/Core/Inc/stm32h7xx_hal_conf.h b/STM32/CM4/Core/Inc/stm32h7xx_hal_conf.h index 819056b..c059e36 100644 --- a/STM32/CM4/Core/Inc/stm32h7xx_hal_conf.h +++ b/STM32/CM4/Core/Inc/stm32h7xx_hal_conf.h @@ -1,28 +1,14 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_hal_conf.h - * @author MCD Application Team - * @brief HAL configuration file. - ****************************************************************************** - * @attention - * - * Copyright (c) 2017 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef STM32H7xx_HAL_CONF_H #define STM32H7xx_HAL_CONF_H #ifdef __cplusplus - extern "C" { +extern "C" { #endif /* Exported types ------------------------------------------------------------*/ @@ -30,11 +16,11 @@ /* ########################## Module Selection ############################## */ /** - * @brief This is the list of modules to be used in the HAL driver - */ + * @brief This is the list of modules to be used in the HAL driver + */ #define HAL_MODULE_ENABLED - /* #define HAL_ADC_MODULE_ENABLED */ +/* #define HAL_ADC_MODULE_ENABLED */ /* #define HAL_FDCAN_MODULE_ENABLED */ /* #define HAL_FMAC_MODULE_ENABLED */ /* #define HAL_CEC_MODULE_ENABLED */ @@ -99,291 +85,347 @@ #define HAL_CORTEX_MODULE_ENABLED #define HAL_HSEM_MODULE_ENABLED -/* ########################## Oscillator Values adaptation ####################*/ +/* ########################## Oscillator Values adaptation + * ####################*/ /** - * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. - * This value is used by the RCC HAL module to compute the system frequency - * (when HSE is used as system clock source, directly or through the PLL). - */ -#if !defined (HSE_VALUE) -#define HSE_VALUE (16000000UL) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */ -#endif /* HSE_VALUE */ + * @brief Adjust the value of External High Speed oscillator (HSE) used in your + * application. This value is used by the RCC HAL module to compute the system + * frequency (when HSE is used as system clock source, directly or through the + * PLL). + */ +#if !defined(HSE_VALUE) +#define HSE_VALUE \ + (16000000UL) /*!< Value of the External oscillator in Hz : FPGA case fixed \ + to 60MHZ */ +#endif /* HSE_VALUE */ -#if !defined (HSE_STARTUP_TIMEOUT) - #define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ -#endif /* HSE_STARTUP_TIMEOUT */ +#if !defined(HSE_STARTUP_TIMEOUT) +#define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ /** - * @brief Internal oscillator (CSI) default value. - * This value is the default CSI value after Reset. - */ -#if !defined (CSI_VALUE) - #define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/ -#endif /* CSI_VALUE */ + * @brief Internal oscillator (CSI) default value. + * This value is the default CSI value after Reset. + */ +#if !defined(CSI_VALUE) +#define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* CSI_VALUE */ /** - * @brief Internal High Speed oscillator (HSI) value. - * This value is used by the RCC HAL module to compute the system frequency - * (when HSI is used as system clock source, directly or through the PLL). - */ -#if !defined (HSI_VALUE) - #define HSI_VALUE (64000000UL) /*!< Value of the Internal oscillator in Hz*/ -#endif /* HSI_VALUE */ + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system + * frequency (when HSI is used as system clock source, directly or through the + * PLL). + */ +#if !defined(HSI_VALUE) +#define HSI_VALUE (64000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ /** - * @brief External Low Speed oscillator (LSE) value. - * This value is used by the UART, RTC HAL module to compute the system frequency - */ -#if !defined (LSE_VALUE) - #define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ -#endif /* LSE_VALUE */ + * @brief External Low Speed oscillator (LSE) value. + * This value is used by the UART, RTC HAL module to compute the system + * frequency + */ +#if !defined(LSE_VALUE) +#define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ -#if !defined (LSE_STARTUP_TIMEOUT) - #define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ -#endif /* LSE_STARTUP_TIMEOUT */ +#if !defined(LSE_STARTUP_TIMEOUT) +#define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ -#if !defined (LSI_VALUE) - #define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ -#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz - The real value may vary depending on the variations - in voltage and temperature.*/ +#if !defined(LSI_VALUE) +#define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz \ + The real value may vary depending on the variations \ + in voltage and temperature.*/ /** - * @brief External clock source for I2S peripheral - * This value is used by the I2S HAL module to compute the I2S clock source - * frequency, this source is inserted directly through I2S_CKIN pad. - */ -#if !defined (EXTERNAL_CLOCK_VALUE) - #define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in Hz*/ -#endif /* EXTERNAL_CLOCK_VALUE */ + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock + * source frequency, this source is inserted directly through I2S_CKIN pad. + */ +#if !defined(EXTERNAL_CLOCK_VALUE) +#define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in \ + Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ /* Tip: To avoid modifying this file each time you need to use different HSE, === you can define the HSE value in your toolchain compiler preprocessor. */ /* ########################### System Configuration ######################### */ /** - * @brief This is the HAL system configuration section - */ -#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ -#define TICK_INT_PRIORITY (15UL) /*!< tick interrupt priority */ -#define USE_RTOS 0 -#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */ -#define USE_SPI_CRC 0U /*!< use CRC in SPI */ + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY (15UL) /*!< tick interrupt priority */ +#define USE_RTOS 0 +#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */ +#define USE_SPI_CRC 0U /*!< use CRC in SPI */ -#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ -#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ -#define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */ -#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U /* CORDIC register callback disabled */ -#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ -#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ -#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ -#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ -#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ -#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ -#define USE_HAL_DTS_REGISTER_CALLBACKS 0U /* DTS register callback disabled */ -#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ -#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */ -#define USE_HAL_FMAC_REGISTER_CALLBACKS 0U /* FMAC register callback disabled */ -#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ -#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ -#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ -#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ -#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ -#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ -#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U /* GFXMMU register callback disabled */ -#define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */ -#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ -#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ -#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ -#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */ -#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ -#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ -#define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ -#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ -#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ -#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U /* OSPI register callback disabled */ -#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ -#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ -#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ -#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ -#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ -#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ -#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ -#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ -#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ -#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ -#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ -#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */ -#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ -#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ -#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ -#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ +#define USE_HAL_ADC_REGISTER_CALLBACKS \ + 0U /* ADC register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS \ + 0U /* CEC register callback disabled */ +#define USE_HAL_COMP_REGISTER_CALLBACKS \ + 0U /* COMP register callback disabled */ +#define USE_HAL_CORDIC_REGISTER_CALLBACKS \ + 0U /* CORDIC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS \ + 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS \ + 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS \ + 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS \ + 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS \ + 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS \ + 0U /* DSI register callback disabled */ +#define USE_HAL_DTS_REGISTER_CALLBACKS \ + 0U /* DTS register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS \ + 0U /* ETH register callback disabled */ +#define USE_HAL_FDCAN_REGISTER_CALLBACKS \ + 0U /* FDCAN register callback disabled */ +#define USE_HAL_FMAC_REGISTER_CALLBACKS \ + 0U /* FMAC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS \ + 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS \ + 0U /* NOR register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS \ + 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS \ + 0U /* SRAM register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS \ + 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS \ + 0U /* HCD register callback disabled */ +#define USE_HAL_GFXMMU_REGISTER_CALLBACKS \ + 0U /* GFXMMU register callback disabled */ +#define USE_HAL_HRTIM_REGISTER_CALLBACKS \ + 0U /* HRTIM register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS \ + 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS \ + 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS \ + 0U /* IRDA register callback disabled */ +#define USE_HAL_JPEG_REGISTER_CALLBACKS \ + 0U /* JPEG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS \ + 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS \ + 0U /* LTDC register callback disabled */ +#define USE_HAL_MDIOS_REGISTER_CALLBACKS \ + 0U /* MDIO register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS \ + 0U /* MMC register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS \ + 0U /* MDIO register callback disabled */ +#define USE_HAL_OSPI_REGISTER_CALLBACKS \ + 0U /* OSPI register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS \ + 0U /* OTFDEC register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS \ + 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS \ + 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS \ + 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS \ + 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS \ + 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS \ + 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS \ + 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS \ + 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS \ + 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS \ + 0U /* SPI register callback disabled */ +#define USE_HAL_SWPMI_REGISTER_CALLBACKS \ + 0U /* SWPMI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS \ + 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS \ + 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS \ + 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS \ + 0U /* WWDG register callback disabled */ -/* ########################### Ethernet Configuration ######################### */ -#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */ -#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */ +/* ########################### Ethernet Configuration ######################### + */ +#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */ +#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */ -#define ETH_MAC_ADDR0 (0x02UL) -#define ETH_MAC_ADDR1 (0x00UL) -#define ETH_MAC_ADDR2 (0x00UL) -#define ETH_MAC_ADDR3 (0x00UL) -#define ETH_MAC_ADDR4 (0x00UL) -#define ETH_MAC_ADDR5 (0x00UL) +#define ETH_MAC_ADDR0 (0x02UL) +#define ETH_MAC_ADDR1 (0x00UL) +#define ETH_MAC_ADDR2 (0x00UL) +#define ETH_MAC_ADDR3 (0x00UL) +#define ETH_MAC_ADDR4 (0x00UL) +#define ETH_MAC_ADDR5 (0x00UL) /* ########################## Assert Selection ############################## */ /** - * @brief Uncomment the line below to expanse the "assert_param" macro in the - * HAL drivers code - */ + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ /* #define USE_FULL_ASSERT 1U */ /* Includes ------------------------------------------------------------------*/ /** - * @brief Include module's header file - */ + * @brief Include module's header file + */ #ifdef HAL_RCC_MODULE_ENABLED - #include "stm32h7xx_hal_rcc.h" +#include "stm32h7xx_hal_rcc.h" #endif /* HAL_RCC_MODULE_ENABLED */ #ifdef HAL_GPIO_MODULE_ENABLED - #include "stm32h7xx_hal_gpio.h" +#include "stm32h7xx_hal_gpio.h" #endif /* HAL_GPIO_MODULE_ENABLED */ #ifdef HAL_DMA_MODULE_ENABLED - #include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_dma.h" #endif /* HAL_DMA_MODULE_ENABLED */ #ifdef HAL_MDMA_MODULE_ENABLED - #include "stm32h7xx_hal_mdma.h" +#include "stm32h7xx_hal_mdma.h" #endif /* HAL_MDMA_MODULE_ENABLED */ #ifdef HAL_HASH_MODULE_ENABLED - #include "stm32h7xx_hal_hash.h" +#include "stm32h7xx_hal_hash.h" #endif /* HAL_HASH_MODULE_ENABLED */ #ifdef HAL_DCMI_MODULE_ENABLED - #include "stm32h7xx_hal_dcmi.h" +#include "stm32h7xx_hal_dcmi.h" #endif /* HAL_DCMI_MODULE_ENABLED */ #ifdef HAL_DMA2D_MODULE_ENABLED - #include "stm32h7xx_hal_dma2d.h" +#include "stm32h7xx_hal_dma2d.h" #endif /* HAL_DMA2D_MODULE_ENABLED */ #ifdef HAL_DSI_MODULE_ENABLED - #include "stm32h7xx_hal_dsi.h" +#include "stm32h7xx_hal_dsi.h" #endif /* HAL_DSI_MODULE_ENABLED */ #ifdef HAL_DFSDM_MODULE_ENABLED - #include "stm32h7xx_hal_dfsdm.h" +#include "stm32h7xx_hal_dfsdm.h" #endif /* HAL_DFSDM_MODULE_ENABLED */ #ifdef HAL_DTS_MODULE_ENABLED - #include "stm32h7xx_hal_dts.h" +#include "stm32h7xx_hal_dts.h" #endif /* HAL_DTS_MODULE_ENABLED */ #ifdef HAL_ETH_MODULE_ENABLED - #include "stm32h7xx_hal_eth.h" +#include "stm32h7xx_hal_eth.h" #endif /* HAL_ETH_MODULE_ENABLED */ #ifdef HAL_ETH_LEGACY_MODULE_ENABLED - #include "stm32h7xx_hal_eth_legacy.h" +#include "stm32h7xx_hal_eth_legacy.h" #endif /* HAL_ETH_LEGACY_MODULE_ENABLED */ #ifdef HAL_EXTI_MODULE_ENABLED - #include "stm32h7xx_hal_exti.h" +#include "stm32h7xx_hal_exti.h" #endif /* HAL_EXTI_MODULE_ENABLED */ #ifdef HAL_CORTEX_MODULE_ENABLED - #include "stm32h7xx_hal_cortex.h" +#include "stm32h7xx_hal_cortex.h" #endif /* HAL_CORTEX_MODULE_ENABLED */ #ifdef HAL_ADC_MODULE_ENABLED - #include "stm32h7xx_hal_adc.h" +#include "stm32h7xx_hal_adc.h" #endif /* HAL_ADC_MODULE_ENABLED */ #ifdef HAL_FDCAN_MODULE_ENABLED - #include "stm32h7xx_hal_fdcan.h" +#include "stm32h7xx_hal_fdcan.h" #endif /* HAL_FDCAN_MODULE_ENABLED */ #ifdef HAL_CEC_MODULE_ENABLED - #include "stm32h7xx_hal_cec.h" +#include "stm32h7xx_hal_cec.h" #endif /* HAL_CEC_MODULE_ENABLED */ #ifdef HAL_COMP_MODULE_ENABLED - #include "stm32h7xx_hal_comp.h" +#include "stm32h7xx_hal_comp.h" #endif /* HAL_COMP_MODULE_ENABLED */ #ifdef HAL_CORDIC_MODULE_ENABLED - #include "stm32h7xx_hal_cordic.h" +#include "stm32h7xx_hal_cordic.h" #endif /* HAL_CORDIC_MODULE_ENABLED */ #ifdef HAL_CRC_MODULE_ENABLED - #include "stm32h7xx_hal_crc.h" +#include "stm32h7xx_hal_crc.h" #endif /* HAL_CRC_MODULE_ENABLED */ #ifdef HAL_CRYP_MODULE_ENABLED - #include "stm32h7xx_hal_cryp.h" +#include "stm32h7xx_hal_cryp.h" #endif /* HAL_CRYP_MODULE_ENABLED */ #ifdef HAL_DAC_MODULE_ENABLED - #include "stm32h7xx_hal_dac.h" +#include "stm32h7xx_hal_dac.h" #endif /* HAL_DAC_MODULE_ENABLED */ #ifdef HAL_FLASH_MODULE_ENABLED - #include "stm32h7xx_hal_flash.h" +#include "stm32h7xx_hal_flash.h" #endif /* HAL_FLASH_MODULE_ENABLED */ #ifdef HAL_GFXMMU_MODULE_ENABLED - #include "stm32h7xx_hal_gfxmmu.h" +#include "stm32h7xx_hal_gfxmmu.h" #endif /* HAL_GFXMMU_MODULE_ENABLED */ #ifdef HAL_FMAC_MODULE_ENABLED - #include "stm32h7xx_hal_fmac.h" +#include "stm32h7xx_hal_fmac.h" #endif /* HAL_FMAC_MODULE_ENABLED */ #ifdef HAL_HRTIM_MODULE_ENABLED - #include "stm32h7xx_hal_hrtim.h" +#include "stm32h7xx_hal_hrtim.h" #endif /* HAL_HRTIM_MODULE_ENABLED */ #ifdef HAL_HSEM_MODULE_ENABLED - #include "stm32h7xx_hal_hsem.h" +#include "stm32h7xx_hal_hsem.h" #endif /* HAL_HSEM_MODULE_ENABLED */ #ifdef HAL_SRAM_MODULE_ENABLED - #include "stm32h7xx_hal_sram.h" +#include "stm32h7xx_hal_sram.h" #endif /* HAL_SRAM_MODULE_ENABLED */ #ifdef HAL_NOR_MODULE_ENABLED - #include "stm32h7xx_hal_nor.h" +#include "stm32h7xx_hal_nor.h" #endif /* HAL_NOR_MODULE_ENABLED */ #ifdef HAL_NAND_MODULE_ENABLED - #include "stm32h7xx_hal_nand.h" +#include "stm32h7xx_hal_nand.h" #endif /* HAL_NAND_MODULE_ENABLED */ #ifdef HAL_I2C_MODULE_ENABLED - #include "stm32h7xx_hal_i2c.h" +#include "stm32h7xx_hal_i2c.h" #endif /* HAL_I2C_MODULE_ENABLED */ #ifdef HAL_I2S_MODULE_ENABLED - #include "stm32h7xx_hal_i2s.h" +#include "stm32h7xx_hal_i2s.h" #endif /* HAL_I2S_MODULE_ENABLED */ #ifdef HAL_IWDG_MODULE_ENABLED - #include "stm32h7xx_hal_iwdg.h" +#include "stm32h7xx_hal_iwdg.h" #endif /* HAL_IWDG_MODULE_ENABLED */ #ifdef HAL_JPEG_MODULE_ENABLED - #include "stm32h7xx_hal_jpeg.h" +#include "stm32h7xx_hal_jpeg.h" #endif /* HAL_JPEG_MODULE_ENABLED */ #ifdef HAL_MDIOS_MODULE_ENABLED - #include "stm32h7xx_hal_mdios.h" +#include "stm32h7xx_hal_mdios.h" #endif /* HAL_MDIOS_MODULE_ENABLED */ #ifdef HAL_MMC_MODULE_ENABLED - #include "stm32h7xx_hal_mmc.h" +#include "stm32h7xx_hal_mmc.h" #endif /* HAL_MMC_MODULE_ENABLED */ #ifdef HAL_LPTIM_MODULE_ENABLED @@ -399,7 +441,7 @@ #endif /* HAL_OPAMP_MODULE_ENABLED */ #ifdef HAL_OSPI_MODULE_ENABLED - #include "stm32h7xx_hal_ospi.h" +#include "stm32h7xx_hal_ospi.h" #endif /* HAL_OSPI_MODULE_ENABLED */ #ifdef HAL_OTFDEC_MODULE_ENABLED @@ -407,104 +449,105 @@ #endif /* HAL_OTFDEC_MODULE_ENABLED */ #ifdef HAL_PSSI_MODULE_ENABLED - #include "stm32h7xx_hal_pssi.h" +#include "stm32h7xx_hal_pssi.h" #endif /* HAL_PSSI_MODULE_ENABLED */ #ifdef HAL_PWR_MODULE_ENABLED - #include "stm32h7xx_hal_pwr.h" +#include "stm32h7xx_hal_pwr.h" #endif /* HAL_PWR_MODULE_ENABLED */ #ifdef HAL_QSPI_MODULE_ENABLED - #include "stm32h7xx_hal_qspi.h" +#include "stm32h7xx_hal_qspi.h" #endif /* HAL_QSPI_MODULE_ENABLED */ #ifdef HAL_RAMECC_MODULE_ENABLED - #include "stm32h7xx_hal_ramecc.h" +#include "stm32h7xx_hal_ramecc.h" #endif /* HAL_RAMECC_MODULE_ENABLED */ #ifdef HAL_RNG_MODULE_ENABLED - #include "stm32h7xx_hal_rng.h" +#include "stm32h7xx_hal_rng.h" #endif /* HAL_RNG_MODULE_ENABLED */ #ifdef HAL_RTC_MODULE_ENABLED - #include "stm32h7xx_hal_rtc.h" +#include "stm32h7xx_hal_rtc.h" #endif /* HAL_RTC_MODULE_ENABLED */ #ifdef HAL_SAI_MODULE_ENABLED - #include "stm32h7xx_hal_sai.h" +#include "stm32h7xx_hal_sai.h" #endif /* HAL_SAI_MODULE_ENABLED */ #ifdef HAL_SD_MODULE_ENABLED - #include "stm32h7xx_hal_sd.h" +#include "stm32h7xx_hal_sd.h" #endif /* HAL_SD_MODULE_ENABLED */ #ifdef HAL_SDRAM_MODULE_ENABLED - #include "stm32h7xx_hal_sdram.h" +#include "stm32h7xx_hal_sdram.h" #endif /* HAL_SDRAM_MODULE_ENABLED */ #ifdef HAL_SPI_MODULE_ENABLED - #include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_spi.h" #endif /* HAL_SPI_MODULE_ENABLED */ #ifdef HAL_SPDIFRX_MODULE_ENABLED - #include "stm32h7xx_hal_spdifrx.h" +#include "stm32h7xx_hal_spdifrx.h" #endif /* HAL_SPDIFRX_MODULE_ENABLED */ #ifdef HAL_SWPMI_MODULE_ENABLED - #include "stm32h7xx_hal_swpmi.h" +#include "stm32h7xx_hal_swpmi.h" #endif /* HAL_SWPMI_MODULE_ENABLED */ #ifdef HAL_TIM_MODULE_ENABLED - #include "stm32h7xx_hal_tim.h" +#include "stm32h7xx_hal_tim.h" #endif /* HAL_TIM_MODULE_ENABLED */ #ifdef HAL_UART_MODULE_ENABLED - #include "stm32h7xx_hal_uart.h" +#include "stm32h7xx_hal_uart.h" #endif /* HAL_UART_MODULE_ENABLED */ #ifdef HAL_USART_MODULE_ENABLED - #include "stm32h7xx_hal_usart.h" +#include "stm32h7xx_hal_usart.h" #endif /* HAL_USART_MODULE_ENABLED */ #ifdef HAL_IRDA_MODULE_ENABLED - #include "stm32h7xx_hal_irda.h" +#include "stm32h7xx_hal_irda.h" #endif /* HAL_IRDA_MODULE_ENABLED */ #ifdef HAL_SMARTCARD_MODULE_ENABLED - #include "stm32h7xx_hal_smartcard.h" +#include "stm32h7xx_hal_smartcard.h" #endif /* HAL_SMARTCARD_MODULE_ENABLED */ #ifdef HAL_SMBUS_MODULE_ENABLED - #include "stm32h7xx_hal_smbus.h" +#include "stm32h7xx_hal_smbus.h" #endif /* HAL_SMBUS_MODULE_ENABLED */ #ifdef HAL_WWDG_MODULE_ENABLED - #include "stm32h7xx_hal_wwdg.h" +#include "stm32h7xx_hal_wwdg.h" #endif /* HAL_WWDG_MODULE_ENABLED */ #ifdef HAL_PCD_MODULE_ENABLED - #include "stm32h7xx_hal_pcd.h" +#include "stm32h7xx_hal_pcd.h" #endif /* HAL_PCD_MODULE_ENABLED */ #ifdef HAL_HCD_MODULE_ENABLED - #include "stm32h7xx_hal_hcd.h" +#include "stm32h7xx_hal_hcd.h" #endif /* HAL_HCD_MODULE_ENABLED */ /* Exported macro ------------------------------------------------------------*/ -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** - * @brief The assert_param macro is used for function's parameters check. - * @param expr: If expr is false, it calls assert_failed function - * which reports the name of the source file and the source - * line number of the call that failed. - * If expr is true, it returns no value. - * @retval None - */ - #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) \ + ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ - void assert_failed(uint8_t *file, uint32_t line); +void assert_failed(uint8_t *file, uint32_t line); #else - #define assert_param(expr) ((void)0U) +#define assert_param(expr) ((void)0U) #endif /* USE_FULL_ASSERT */ #ifdef __cplusplus diff --git a/STM32/CM4/Core/Inc/stm32h7xx_it.h b/STM32/CM4/Core/Inc/stm32h7xx_it.h index 9fc4283..4146c7a 100644 --- a/STM32/CM4/Core/Inc/stm32h7xx_it.h +++ b/STM32/CM4/Core/Inc/stm32h7xx_it.h @@ -1,20 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_it.h - * @brief This file contains the headers of the interrupt handlers. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ diff --git a/STM32/CM4/Core/Src/main.c b/STM32/CM4/Core/Src/main.c index 529d921..cc6103c 100644 --- a/STM32/CM4/Core/Src/main.c +++ b/STM32/CM4/Core/Src/main.c @@ -1,20 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file : main.c - * @brief : Main program body - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" @@ -68,11 +55,10 @@ /* USER CODE END 0 */ /** - * @brief The application entry point. - * @retval int - */ -int main(void) -{ + * @brief The application entry point. + * @retval int + */ +int main(void) { /* USER CODE BEGIN 1 */ @@ -86,18 +72,21 @@ int main(void) HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); /* Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to - perform system initialization (system clock config, external memory configuration.. ) + perform system initialization (system clock config, external memory + configuration.. ) */ HAL_PWREx_ClearPendingEvent(); - HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN); + HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, + PWR_D2_DOMAIN); /* Clear HSEM flag */ __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); #endif /* DUAL_CORE_BOOT_SYNC_SEQUENCE */ -/* USER CODE END Boot_Mode_Sequence_1 */ + /* USER CODE END Boot_Mode_Sequence_1 */ /* MCU Configuration--------------------------------------------------------*/ - /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + /* Reset of all peripherals, Initializes the Flash interface and the Systick. + */ HAL_Init(); /* USER CODE BEGIN Init */ @@ -115,8 +104,7 @@ int main(void) /* Infinite loop */ /* USER CODE BEGIN WHILE */ - while (1) - { + while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ @@ -129,32 +117,30 @@ int main(void) /* USER CODE END 4 */ /** - * @brief This function is executed in case of error occurrence. - * @retval None - */ -void Error_Handler(void) -{ + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ __disable_irq(); - while (1) - { + while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ -void assert_failed(uint8_t *file, uint32_t line) -{ + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ - /* User can add his own implementation to report the file name and line number, - ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* User can add his own implementation to report the file name and line + number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, + line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ diff --git a/STM32/CM4/Core/Src/stm32h7xx_hal_msp.c b/STM32/CM4/Core/Src/stm32h7xx_hal_msp.c index 8fc7789..21df3d1 100644 --- a/STM32/CM4/Core/Src/stm32h7xx_hal_msp.c +++ b/STM32/CM4/Core/Src/stm32h7xx_hal_msp.c @@ -1,21 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_hal_msp.c - * @brief This file provides code for the MSP Initialization - * and de-Initialization codes. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" @@ -57,10 +43,9 @@ /* USER CODE END 0 */ /** - * Initializes the Global MSP. - */ -void HAL_MspInit(void) -{ + * Initializes the Global MSP. + */ +void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ diff --git a/STM32/CM4/Core/Src/stm32h7xx_it.c b/STM32/CM4/Core/Src/stm32h7xx_it.c index 430a6ac..1532983 100644 --- a/STM32/CM4/Core/Src/stm32h7xx_it.c +++ b/STM32/CM4/Core/Src/stm32h7xx_it.c @@ -1,25 +1,12 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_it.c - * @brief Interrupt Service Routines. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ -#include "main.h" #include "stm32h7xx_it.h" +#include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ @@ -64,85 +51,74 @@ /* Cortex Processor Interruption and Exception Handlers */ /******************************************************************************/ /** - * @brief This function handles Non maskable interrupt. - */ -void NMI_Handler(void) -{ + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) { /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ /* USER CODE END NonMaskableInt_IRQn 0 */ /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ - while (1) - { + while (1) { } /* USER CODE END NonMaskableInt_IRQn 1 */ } /** - * @brief This function handles Hard fault interrupt. - */ -void HardFault_Handler(void) -{ + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) { /* USER CODE BEGIN HardFault_IRQn 0 */ /* USER CODE END HardFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_HardFault_IRQn 0 */ /* USER CODE END W1_HardFault_IRQn 0 */ } } /** - * @brief This function handles Memory management fault. - */ -void MemManage_Handler(void) -{ + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) { /* USER CODE BEGIN MemoryManagement_IRQn 0 */ /* USER CODE END MemoryManagement_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ /* USER CODE END W1_MemoryManagement_IRQn 0 */ } } /** - * @brief This function handles Pre-fetch fault, memory access fault. - */ -void BusFault_Handler(void) -{ + * @brief This function handles Pre-fetch fault, memory access fault. + */ +void BusFault_Handler(void) { /* USER CODE BEGIN BusFault_IRQn 0 */ /* USER CODE END BusFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_BusFault_IRQn 0 */ /* USER CODE END W1_BusFault_IRQn 0 */ } } /** - * @brief This function handles Undefined instruction or illegal state. - */ -void UsageFault_Handler(void) -{ + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) { /* USER CODE BEGIN UsageFault_IRQn 0 */ /* USER CODE END UsageFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ /* USER CODE END W1_UsageFault_IRQn 0 */ } } /** - * @brief This function handles System service call via SWI instruction. - */ -void SVC_Handler(void) -{ + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) { /* USER CODE BEGIN SVCall_IRQn 0 */ /* USER CODE END SVCall_IRQn 0 */ @@ -152,10 +128,9 @@ void SVC_Handler(void) } /** - * @brief This function handles Debug monitor. - */ -void DebugMon_Handler(void) -{ + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) { /* USER CODE BEGIN DebugMonitor_IRQn 0 */ /* USER CODE END DebugMonitor_IRQn 0 */ @@ -165,10 +140,9 @@ void DebugMon_Handler(void) } /** - * @brief This function handles Pendable request for system service. - */ -void PendSV_Handler(void) -{ + * @brief This function handles Pendable request for system service. + */ +void PendSV_Handler(void) { /* USER CODE BEGIN PendSV_IRQn 0 */ /* USER CODE END PendSV_IRQn 0 */ @@ -178,10 +152,9 @@ void PendSV_Handler(void) } /** - * @brief This function handles System tick timer. - */ -void SysTick_Handler(void) -{ + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) { /* USER CODE BEGIN SysTick_IRQn 0 */ /* USER CODE END SysTick_IRQn 0 */ diff --git a/STM32/CM7/Core/Inc/main.h b/STM32/CM7/Core/Inc/main.h index f289643..e4b8793 100644 --- a/STM32/CM7/Core/Inc/main.h +++ b/STM32/CM7/Core/Inc/main.h @@ -1,21 +1,7 @@ /* 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) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ diff --git a/STM32/CM7/Core/Inc/stm32h7xx_hal_conf.h b/STM32/CM7/Core/Inc/stm32h7xx_hal_conf.h index 819056b..c059e36 100644 --- a/STM32/CM7/Core/Inc/stm32h7xx_hal_conf.h +++ b/STM32/CM7/Core/Inc/stm32h7xx_hal_conf.h @@ -1,28 +1,14 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_hal_conf.h - * @author MCD Application Team - * @brief HAL configuration file. - ****************************************************************************** - * @attention - * - * Copyright (c) 2017 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef STM32H7xx_HAL_CONF_H #define STM32H7xx_HAL_CONF_H #ifdef __cplusplus - extern "C" { +extern "C" { #endif /* Exported types ------------------------------------------------------------*/ @@ -30,11 +16,11 @@ /* ########################## Module Selection ############################## */ /** - * @brief This is the list of modules to be used in the HAL driver - */ + * @brief This is the list of modules to be used in the HAL driver + */ #define HAL_MODULE_ENABLED - /* #define HAL_ADC_MODULE_ENABLED */ +/* #define HAL_ADC_MODULE_ENABLED */ /* #define HAL_FDCAN_MODULE_ENABLED */ /* #define HAL_FMAC_MODULE_ENABLED */ /* #define HAL_CEC_MODULE_ENABLED */ @@ -99,291 +85,347 @@ #define HAL_CORTEX_MODULE_ENABLED #define HAL_HSEM_MODULE_ENABLED -/* ########################## Oscillator Values adaptation ####################*/ +/* ########################## Oscillator Values adaptation + * ####################*/ /** - * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. - * This value is used by the RCC HAL module to compute the system frequency - * (when HSE is used as system clock source, directly or through the PLL). - */ -#if !defined (HSE_VALUE) -#define HSE_VALUE (16000000UL) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */ -#endif /* HSE_VALUE */ + * @brief Adjust the value of External High Speed oscillator (HSE) used in your + * application. This value is used by the RCC HAL module to compute the system + * frequency (when HSE is used as system clock source, directly or through the + * PLL). + */ +#if !defined(HSE_VALUE) +#define HSE_VALUE \ + (16000000UL) /*!< Value of the External oscillator in Hz : FPGA case fixed \ + to 60MHZ */ +#endif /* HSE_VALUE */ -#if !defined (HSE_STARTUP_TIMEOUT) - #define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ -#endif /* HSE_STARTUP_TIMEOUT */ +#if !defined(HSE_STARTUP_TIMEOUT) +#define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ /** - * @brief Internal oscillator (CSI) default value. - * This value is the default CSI value after Reset. - */ -#if !defined (CSI_VALUE) - #define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/ -#endif /* CSI_VALUE */ + * @brief Internal oscillator (CSI) default value. + * This value is the default CSI value after Reset. + */ +#if !defined(CSI_VALUE) +#define CSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* CSI_VALUE */ /** - * @brief Internal High Speed oscillator (HSI) value. - * This value is used by the RCC HAL module to compute the system frequency - * (when HSI is used as system clock source, directly or through the PLL). - */ -#if !defined (HSI_VALUE) - #define HSI_VALUE (64000000UL) /*!< Value of the Internal oscillator in Hz*/ -#endif /* HSI_VALUE */ + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system + * frequency (when HSI is used as system clock source, directly or through the + * PLL). + */ +#if !defined(HSI_VALUE) +#define HSI_VALUE (64000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ /** - * @brief External Low Speed oscillator (LSE) value. - * This value is used by the UART, RTC HAL module to compute the system frequency - */ -#if !defined (LSE_VALUE) - #define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ -#endif /* LSE_VALUE */ + * @brief External Low Speed oscillator (LSE) value. + * This value is used by the UART, RTC HAL module to compute the system + * frequency + */ +#if !defined(LSE_VALUE) +#define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ -#if !defined (LSE_STARTUP_TIMEOUT) - #define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ -#endif /* LSE_STARTUP_TIMEOUT */ +#if !defined(LSE_STARTUP_TIMEOUT) +#define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ -#if !defined (LSI_VALUE) - #define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ -#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz - The real value may vary depending on the variations - in voltage and temperature.*/ +#if !defined(LSI_VALUE) +#define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz \ + The real value may vary depending on the variations \ + in voltage and temperature.*/ /** - * @brief External clock source for I2S peripheral - * This value is used by the I2S HAL module to compute the I2S clock source - * frequency, this source is inserted directly through I2S_CKIN pad. - */ -#if !defined (EXTERNAL_CLOCK_VALUE) - #define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in Hz*/ -#endif /* EXTERNAL_CLOCK_VALUE */ + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock + * source frequency, this source is inserted directly through I2S_CKIN pad. + */ +#if !defined(EXTERNAL_CLOCK_VALUE) +#define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in \ + Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ /* Tip: To avoid modifying this file each time you need to use different HSE, === you can define the HSE value in your toolchain compiler preprocessor. */ /* ########################### System Configuration ######################### */ /** - * @brief This is the HAL system configuration section - */ -#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ -#define TICK_INT_PRIORITY (15UL) /*!< tick interrupt priority */ -#define USE_RTOS 0 -#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */ -#define USE_SPI_CRC 0U /*!< use CRC in SPI */ + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY (15UL) /*!< tick interrupt priority */ +#define USE_RTOS 0 +#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */ +#define USE_SPI_CRC 0U /*!< use CRC in SPI */ -#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ -#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ -#define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */ -#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U /* CORDIC register callback disabled */ -#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ -#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ -#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ -#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ -#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ -#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ -#define USE_HAL_DTS_REGISTER_CALLBACKS 0U /* DTS register callback disabled */ -#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ -#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */ -#define USE_HAL_FMAC_REGISTER_CALLBACKS 0U /* FMAC register callback disabled */ -#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ -#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ -#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ -#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ -#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ -#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ -#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U /* GFXMMU register callback disabled */ -#define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */ -#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ -#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ -#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ -#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */ -#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ -#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ -#define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ -#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ -#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ -#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U /* OSPI register callback disabled */ -#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ -#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ -#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ -#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ -#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ -#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ -#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ -#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ -#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ -#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ -#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ -#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */ -#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ -#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ -#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ -#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ +#define USE_HAL_ADC_REGISTER_CALLBACKS \ + 0U /* ADC register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS \ + 0U /* CEC register callback disabled */ +#define USE_HAL_COMP_REGISTER_CALLBACKS \ + 0U /* COMP register callback disabled */ +#define USE_HAL_CORDIC_REGISTER_CALLBACKS \ + 0U /* CORDIC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS \ + 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS \ + 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS \ + 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS \ + 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS \ + 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS \ + 0U /* DSI register callback disabled */ +#define USE_HAL_DTS_REGISTER_CALLBACKS \ + 0U /* DTS register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS \ + 0U /* ETH register callback disabled */ +#define USE_HAL_FDCAN_REGISTER_CALLBACKS \ + 0U /* FDCAN register callback disabled */ +#define USE_HAL_FMAC_REGISTER_CALLBACKS \ + 0U /* FMAC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS \ + 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS \ + 0U /* NOR register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS \ + 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS \ + 0U /* SRAM register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS \ + 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS \ + 0U /* HCD register callback disabled */ +#define USE_HAL_GFXMMU_REGISTER_CALLBACKS \ + 0U /* GFXMMU register callback disabled */ +#define USE_HAL_HRTIM_REGISTER_CALLBACKS \ + 0U /* HRTIM register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS \ + 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS \ + 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS \ + 0U /* IRDA register callback disabled */ +#define USE_HAL_JPEG_REGISTER_CALLBACKS \ + 0U /* JPEG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS \ + 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS \ + 0U /* LTDC register callback disabled */ +#define USE_HAL_MDIOS_REGISTER_CALLBACKS \ + 0U /* MDIO register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS \ + 0U /* MMC register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS \ + 0U /* MDIO register callback disabled */ +#define USE_HAL_OSPI_REGISTER_CALLBACKS \ + 0U /* OSPI register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS \ + 0U /* OTFDEC register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS \ + 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS \ + 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS \ + 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS \ + 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS \ + 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS \ + 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS \ + 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS \ + 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS \ + 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS \ + 0U /* SPI register callback disabled */ +#define USE_HAL_SWPMI_REGISTER_CALLBACKS \ + 0U /* SWPMI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS \ + 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS \ + 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS \ + 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS \ + 0U /* WWDG register callback disabled */ -/* ########################### Ethernet Configuration ######################### */ -#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */ -#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */ +/* ########################### Ethernet Configuration ######################### + */ +#define ETH_TX_DESC_CNT 4U /* number of Ethernet Tx DMA descriptors */ +#define ETH_RX_DESC_CNT 4U /* number of Ethernet Rx DMA descriptors */ -#define ETH_MAC_ADDR0 (0x02UL) -#define ETH_MAC_ADDR1 (0x00UL) -#define ETH_MAC_ADDR2 (0x00UL) -#define ETH_MAC_ADDR3 (0x00UL) -#define ETH_MAC_ADDR4 (0x00UL) -#define ETH_MAC_ADDR5 (0x00UL) +#define ETH_MAC_ADDR0 (0x02UL) +#define ETH_MAC_ADDR1 (0x00UL) +#define ETH_MAC_ADDR2 (0x00UL) +#define ETH_MAC_ADDR3 (0x00UL) +#define ETH_MAC_ADDR4 (0x00UL) +#define ETH_MAC_ADDR5 (0x00UL) /* ########################## Assert Selection ############################## */ /** - * @brief Uncomment the line below to expanse the "assert_param" macro in the - * HAL drivers code - */ + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ /* #define USE_FULL_ASSERT 1U */ /* Includes ------------------------------------------------------------------*/ /** - * @brief Include module's header file - */ + * @brief Include module's header file + */ #ifdef HAL_RCC_MODULE_ENABLED - #include "stm32h7xx_hal_rcc.h" +#include "stm32h7xx_hal_rcc.h" #endif /* HAL_RCC_MODULE_ENABLED */ #ifdef HAL_GPIO_MODULE_ENABLED - #include "stm32h7xx_hal_gpio.h" +#include "stm32h7xx_hal_gpio.h" #endif /* HAL_GPIO_MODULE_ENABLED */ #ifdef HAL_DMA_MODULE_ENABLED - #include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_dma.h" #endif /* HAL_DMA_MODULE_ENABLED */ #ifdef HAL_MDMA_MODULE_ENABLED - #include "stm32h7xx_hal_mdma.h" +#include "stm32h7xx_hal_mdma.h" #endif /* HAL_MDMA_MODULE_ENABLED */ #ifdef HAL_HASH_MODULE_ENABLED - #include "stm32h7xx_hal_hash.h" +#include "stm32h7xx_hal_hash.h" #endif /* HAL_HASH_MODULE_ENABLED */ #ifdef HAL_DCMI_MODULE_ENABLED - #include "stm32h7xx_hal_dcmi.h" +#include "stm32h7xx_hal_dcmi.h" #endif /* HAL_DCMI_MODULE_ENABLED */ #ifdef HAL_DMA2D_MODULE_ENABLED - #include "stm32h7xx_hal_dma2d.h" +#include "stm32h7xx_hal_dma2d.h" #endif /* HAL_DMA2D_MODULE_ENABLED */ #ifdef HAL_DSI_MODULE_ENABLED - #include "stm32h7xx_hal_dsi.h" +#include "stm32h7xx_hal_dsi.h" #endif /* HAL_DSI_MODULE_ENABLED */ #ifdef HAL_DFSDM_MODULE_ENABLED - #include "stm32h7xx_hal_dfsdm.h" +#include "stm32h7xx_hal_dfsdm.h" #endif /* HAL_DFSDM_MODULE_ENABLED */ #ifdef HAL_DTS_MODULE_ENABLED - #include "stm32h7xx_hal_dts.h" +#include "stm32h7xx_hal_dts.h" #endif /* HAL_DTS_MODULE_ENABLED */ #ifdef HAL_ETH_MODULE_ENABLED - #include "stm32h7xx_hal_eth.h" +#include "stm32h7xx_hal_eth.h" #endif /* HAL_ETH_MODULE_ENABLED */ #ifdef HAL_ETH_LEGACY_MODULE_ENABLED - #include "stm32h7xx_hal_eth_legacy.h" +#include "stm32h7xx_hal_eth_legacy.h" #endif /* HAL_ETH_LEGACY_MODULE_ENABLED */ #ifdef HAL_EXTI_MODULE_ENABLED - #include "stm32h7xx_hal_exti.h" +#include "stm32h7xx_hal_exti.h" #endif /* HAL_EXTI_MODULE_ENABLED */ #ifdef HAL_CORTEX_MODULE_ENABLED - #include "stm32h7xx_hal_cortex.h" +#include "stm32h7xx_hal_cortex.h" #endif /* HAL_CORTEX_MODULE_ENABLED */ #ifdef HAL_ADC_MODULE_ENABLED - #include "stm32h7xx_hal_adc.h" +#include "stm32h7xx_hal_adc.h" #endif /* HAL_ADC_MODULE_ENABLED */ #ifdef HAL_FDCAN_MODULE_ENABLED - #include "stm32h7xx_hal_fdcan.h" +#include "stm32h7xx_hal_fdcan.h" #endif /* HAL_FDCAN_MODULE_ENABLED */ #ifdef HAL_CEC_MODULE_ENABLED - #include "stm32h7xx_hal_cec.h" +#include "stm32h7xx_hal_cec.h" #endif /* HAL_CEC_MODULE_ENABLED */ #ifdef HAL_COMP_MODULE_ENABLED - #include "stm32h7xx_hal_comp.h" +#include "stm32h7xx_hal_comp.h" #endif /* HAL_COMP_MODULE_ENABLED */ #ifdef HAL_CORDIC_MODULE_ENABLED - #include "stm32h7xx_hal_cordic.h" +#include "stm32h7xx_hal_cordic.h" #endif /* HAL_CORDIC_MODULE_ENABLED */ #ifdef HAL_CRC_MODULE_ENABLED - #include "stm32h7xx_hal_crc.h" +#include "stm32h7xx_hal_crc.h" #endif /* HAL_CRC_MODULE_ENABLED */ #ifdef HAL_CRYP_MODULE_ENABLED - #include "stm32h7xx_hal_cryp.h" +#include "stm32h7xx_hal_cryp.h" #endif /* HAL_CRYP_MODULE_ENABLED */ #ifdef HAL_DAC_MODULE_ENABLED - #include "stm32h7xx_hal_dac.h" +#include "stm32h7xx_hal_dac.h" #endif /* HAL_DAC_MODULE_ENABLED */ #ifdef HAL_FLASH_MODULE_ENABLED - #include "stm32h7xx_hal_flash.h" +#include "stm32h7xx_hal_flash.h" #endif /* HAL_FLASH_MODULE_ENABLED */ #ifdef HAL_GFXMMU_MODULE_ENABLED - #include "stm32h7xx_hal_gfxmmu.h" +#include "stm32h7xx_hal_gfxmmu.h" #endif /* HAL_GFXMMU_MODULE_ENABLED */ #ifdef HAL_FMAC_MODULE_ENABLED - #include "stm32h7xx_hal_fmac.h" +#include "stm32h7xx_hal_fmac.h" #endif /* HAL_FMAC_MODULE_ENABLED */ #ifdef HAL_HRTIM_MODULE_ENABLED - #include "stm32h7xx_hal_hrtim.h" +#include "stm32h7xx_hal_hrtim.h" #endif /* HAL_HRTIM_MODULE_ENABLED */ #ifdef HAL_HSEM_MODULE_ENABLED - #include "stm32h7xx_hal_hsem.h" +#include "stm32h7xx_hal_hsem.h" #endif /* HAL_HSEM_MODULE_ENABLED */ #ifdef HAL_SRAM_MODULE_ENABLED - #include "stm32h7xx_hal_sram.h" +#include "stm32h7xx_hal_sram.h" #endif /* HAL_SRAM_MODULE_ENABLED */ #ifdef HAL_NOR_MODULE_ENABLED - #include "stm32h7xx_hal_nor.h" +#include "stm32h7xx_hal_nor.h" #endif /* HAL_NOR_MODULE_ENABLED */ #ifdef HAL_NAND_MODULE_ENABLED - #include "stm32h7xx_hal_nand.h" +#include "stm32h7xx_hal_nand.h" #endif /* HAL_NAND_MODULE_ENABLED */ #ifdef HAL_I2C_MODULE_ENABLED - #include "stm32h7xx_hal_i2c.h" +#include "stm32h7xx_hal_i2c.h" #endif /* HAL_I2C_MODULE_ENABLED */ #ifdef HAL_I2S_MODULE_ENABLED - #include "stm32h7xx_hal_i2s.h" +#include "stm32h7xx_hal_i2s.h" #endif /* HAL_I2S_MODULE_ENABLED */ #ifdef HAL_IWDG_MODULE_ENABLED - #include "stm32h7xx_hal_iwdg.h" +#include "stm32h7xx_hal_iwdg.h" #endif /* HAL_IWDG_MODULE_ENABLED */ #ifdef HAL_JPEG_MODULE_ENABLED - #include "stm32h7xx_hal_jpeg.h" +#include "stm32h7xx_hal_jpeg.h" #endif /* HAL_JPEG_MODULE_ENABLED */ #ifdef HAL_MDIOS_MODULE_ENABLED - #include "stm32h7xx_hal_mdios.h" +#include "stm32h7xx_hal_mdios.h" #endif /* HAL_MDIOS_MODULE_ENABLED */ #ifdef HAL_MMC_MODULE_ENABLED - #include "stm32h7xx_hal_mmc.h" +#include "stm32h7xx_hal_mmc.h" #endif /* HAL_MMC_MODULE_ENABLED */ #ifdef HAL_LPTIM_MODULE_ENABLED @@ -399,7 +441,7 @@ #endif /* HAL_OPAMP_MODULE_ENABLED */ #ifdef HAL_OSPI_MODULE_ENABLED - #include "stm32h7xx_hal_ospi.h" +#include "stm32h7xx_hal_ospi.h" #endif /* HAL_OSPI_MODULE_ENABLED */ #ifdef HAL_OTFDEC_MODULE_ENABLED @@ -407,104 +449,105 @@ #endif /* HAL_OTFDEC_MODULE_ENABLED */ #ifdef HAL_PSSI_MODULE_ENABLED - #include "stm32h7xx_hal_pssi.h" +#include "stm32h7xx_hal_pssi.h" #endif /* HAL_PSSI_MODULE_ENABLED */ #ifdef HAL_PWR_MODULE_ENABLED - #include "stm32h7xx_hal_pwr.h" +#include "stm32h7xx_hal_pwr.h" #endif /* HAL_PWR_MODULE_ENABLED */ #ifdef HAL_QSPI_MODULE_ENABLED - #include "stm32h7xx_hal_qspi.h" +#include "stm32h7xx_hal_qspi.h" #endif /* HAL_QSPI_MODULE_ENABLED */ #ifdef HAL_RAMECC_MODULE_ENABLED - #include "stm32h7xx_hal_ramecc.h" +#include "stm32h7xx_hal_ramecc.h" #endif /* HAL_RAMECC_MODULE_ENABLED */ #ifdef HAL_RNG_MODULE_ENABLED - #include "stm32h7xx_hal_rng.h" +#include "stm32h7xx_hal_rng.h" #endif /* HAL_RNG_MODULE_ENABLED */ #ifdef HAL_RTC_MODULE_ENABLED - #include "stm32h7xx_hal_rtc.h" +#include "stm32h7xx_hal_rtc.h" #endif /* HAL_RTC_MODULE_ENABLED */ #ifdef HAL_SAI_MODULE_ENABLED - #include "stm32h7xx_hal_sai.h" +#include "stm32h7xx_hal_sai.h" #endif /* HAL_SAI_MODULE_ENABLED */ #ifdef HAL_SD_MODULE_ENABLED - #include "stm32h7xx_hal_sd.h" +#include "stm32h7xx_hal_sd.h" #endif /* HAL_SD_MODULE_ENABLED */ #ifdef HAL_SDRAM_MODULE_ENABLED - #include "stm32h7xx_hal_sdram.h" +#include "stm32h7xx_hal_sdram.h" #endif /* HAL_SDRAM_MODULE_ENABLED */ #ifdef HAL_SPI_MODULE_ENABLED - #include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_spi.h" #endif /* HAL_SPI_MODULE_ENABLED */ #ifdef HAL_SPDIFRX_MODULE_ENABLED - #include "stm32h7xx_hal_spdifrx.h" +#include "stm32h7xx_hal_spdifrx.h" #endif /* HAL_SPDIFRX_MODULE_ENABLED */ #ifdef HAL_SWPMI_MODULE_ENABLED - #include "stm32h7xx_hal_swpmi.h" +#include "stm32h7xx_hal_swpmi.h" #endif /* HAL_SWPMI_MODULE_ENABLED */ #ifdef HAL_TIM_MODULE_ENABLED - #include "stm32h7xx_hal_tim.h" +#include "stm32h7xx_hal_tim.h" #endif /* HAL_TIM_MODULE_ENABLED */ #ifdef HAL_UART_MODULE_ENABLED - #include "stm32h7xx_hal_uart.h" +#include "stm32h7xx_hal_uart.h" #endif /* HAL_UART_MODULE_ENABLED */ #ifdef HAL_USART_MODULE_ENABLED - #include "stm32h7xx_hal_usart.h" +#include "stm32h7xx_hal_usart.h" #endif /* HAL_USART_MODULE_ENABLED */ #ifdef HAL_IRDA_MODULE_ENABLED - #include "stm32h7xx_hal_irda.h" +#include "stm32h7xx_hal_irda.h" #endif /* HAL_IRDA_MODULE_ENABLED */ #ifdef HAL_SMARTCARD_MODULE_ENABLED - #include "stm32h7xx_hal_smartcard.h" +#include "stm32h7xx_hal_smartcard.h" #endif /* HAL_SMARTCARD_MODULE_ENABLED */ #ifdef HAL_SMBUS_MODULE_ENABLED - #include "stm32h7xx_hal_smbus.h" +#include "stm32h7xx_hal_smbus.h" #endif /* HAL_SMBUS_MODULE_ENABLED */ #ifdef HAL_WWDG_MODULE_ENABLED - #include "stm32h7xx_hal_wwdg.h" +#include "stm32h7xx_hal_wwdg.h" #endif /* HAL_WWDG_MODULE_ENABLED */ #ifdef HAL_PCD_MODULE_ENABLED - #include "stm32h7xx_hal_pcd.h" +#include "stm32h7xx_hal_pcd.h" #endif /* HAL_PCD_MODULE_ENABLED */ #ifdef HAL_HCD_MODULE_ENABLED - #include "stm32h7xx_hal_hcd.h" +#include "stm32h7xx_hal_hcd.h" #endif /* HAL_HCD_MODULE_ENABLED */ /* Exported macro ------------------------------------------------------------*/ -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** - * @brief The assert_param macro is used for function's parameters check. - * @param expr: If expr is false, it calls assert_failed function - * which reports the name of the source file and the source - * line number of the call that failed. - * If expr is true, it returns no value. - * @retval None - */ - #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) \ + ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ - void assert_failed(uint8_t *file, uint32_t line); +void assert_failed(uint8_t *file, uint32_t line); #else - #define assert_param(expr) ((void)0U) +#define assert_param(expr) ((void)0U) #endif /* USE_FULL_ASSERT */ #ifdef __cplusplus diff --git a/STM32/CM7/Core/Inc/stm32h7xx_it.h b/STM32/CM7/Core/Inc/stm32h7xx_it.h index 9fc4283..4146c7a 100644 --- a/STM32/CM7/Core/Inc/stm32h7xx_it.h +++ b/STM32/CM7/Core/Inc/stm32h7xx_it.h @@ -1,20 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_it.h - * @brief This file contains the headers of the interrupt handlers. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ diff --git a/STM32/CM7/Core/Src/main.c b/STM32/CM7/Core/Src/main.c index 2219102..94b6471 100644 --- a/STM32/CM7/Core/Src/main.c +++ b/STM32/CM7/Core/Src/main.c @@ -1,20 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file : main.c - * @brief : Main program body - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" @@ -71,11 +58,10 @@ static void MX_GPIO_Init(void); /* USER CODE END 0 */ /** - * @brief The application entry point. - * @retval int - */ -int main(void) -{ + * @brief The application entry point. + * @retval int + */ +int main(void) { /* USER CODE BEGIN 1 */ @@ -84,7 +70,7 @@ int main(void) #if defined(DUAL_CORE_BOOT_SYNC_SEQUENCE) int32_t timeout; #endif /* DUAL_CORE_BOOT_SYNC_SEQUENCE */ -/* USER CODE END Boot_Mode_Sequence_0 */ + /* USER CODE END Boot_Mode_Sequence_0 */ /* MPU Configuration--------------------------------------------------------*/ MPU_Config(); @@ -93,16 +79,17 @@ int main(void) #if defined(DUAL_CORE_BOOT_SYNC_SEQUENCE) /* Wait until CPU2 boots and enters in stop mode or timeout*/ timeout = 0xFFFF; - while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0)); - if ( timeout < 0 ) - { - Error_Handler(); + while ((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0)) + ; + if (timeout < 0) { + Error_Handler(); } #endif /* DUAL_CORE_BOOT_SYNC_SEQUENCE */ -/* USER CODE END Boot_Mode_Sequence_1 */ + /* USER CODE END Boot_Mode_Sequence_1 */ /* MCU Configuration--------------------------------------------------------*/ - /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + /* Reset of all peripherals, Initializes the Flash interface and the Systick. + */ HAL_Init(); /* USER CODE BEGIN Init */ @@ -113,23 +100,23 @@ int main(void) SystemClock_Config(); /* USER CODE BEGIN Boot_Mode_Sequence_2 */ #if defined(DUAL_CORE_BOOT_SYNC_SEQUENCE) -/* When system initialization is finished, Cortex-M7 will release Cortex-M4 by means of -HSEM notification */ -/*HW semaphore Clock enable*/ -__HAL_RCC_HSEM_CLK_ENABLE(); -/*Take HSEM */ -HAL_HSEM_FastTake(HSEM_ID_0); -/*Release HSEM in order to notify the CPU2(CM4)*/ -HAL_HSEM_Release(HSEM_ID_0,0); -/* wait until CPU2 wakes up from stop mode */ -timeout = 0xFFFF; -while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0)); -if ( timeout < 0 ) -{ -Error_Handler(); -} + /* When system initialization is finished, Cortex-M7 will release Cortex-M4 by + means of HSEM notification */ + /*HW semaphore Clock enable*/ + __HAL_RCC_HSEM_CLK_ENABLE(); + /*Take HSEM */ + HAL_HSEM_FastTake(HSEM_ID_0); + /*Release HSEM in order to notify the CPU2(CM4)*/ + HAL_HSEM_Release(HSEM_ID_0, 0); + /* wait until CPU2 wakes up from stop mode */ + timeout = 0xFFFF; + while ((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0)) + ; + if (timeout < 0) { + Error_Handler(); + } #endif /* DUAL_CORE_BOOT_SYNC_SEQUENCE */ -/* USER CODE END Boot_Mode_Sequence_2 */ + /* USER CODE END Boot_Mode_Sequence_2 */ /* USER CODE BEGIN SysInit */ @@ -143,8 +130,7 @@ Error_Handler(); /* Infinite loop */ /* USER CODE BEGIN WHILE */ - while (1) - { + while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ @@ -153,27 +139,27 @@ Error_Handler(); } /** - * @brief System Clock Configuration - * @retval None - */ -void SystemClock_Config(void) -{ + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Supply configuration update enable - */ + */ HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); /** Configure the main internal regulator output voltage - */ + */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); - while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) { + } /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ + * in the RCC_OscInitTypeDef structure. + */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; @@ -186,16 +172,15 @@ void SystemClock_Config(void) RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3; RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; RCC_OscInitStruct.PLL.PLLFRACN = 0; - if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) - { + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB buses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK - |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 - |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | + RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | + RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; @@ -204,19 +189,17 @@ void SystemClock_Config(void) RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; - if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) - { + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) { Error_Handler(); } } /** - * @brief GPIO Initialization Function - * @param None - * @retval None - */ -static void MX_GPIO_Init(void) -{ + * @brief GPIO Initialization Function + * @param None + * @retval None + */ +static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* USER CODE BEGIN MX_GPIO_Init_1 */ @@ -244,17 +227,16 @@ static void MX_GPIO_Init(void) /* USER CODE END 4 */ - /* MPU Configuration */ +/* MPU Configuration */ -void MPU_Config(void) -{ +void MPU_Config(void) { MPU_Region_InitTypeDef MPU_InitStruct = {0}; /* Disables the MPU */ HAL_MPU_Disable(); /** Initializes and configures the Region and the memory to be protected - */ + */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.BaseAddress = 0x0; @@ -270,36 +252,33 @@ void MPU_Config(void) HAL_MPU_ConfigRegion(&MPU_InitStruct); /* Enables the MPU */ HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); - } /** - * @brief This function is executed in case of error occurrence. - * @retval None - */ -void Error_Handler(void) -{ + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ __disable_irq(); - while (1) - { + while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ -void assert_failed(uint8_t *file, uint32_t line) -{ + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ - /* User can add his own implementation to report the file name and line number, - ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* User can add his own implementation to report the file name and line + number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, + line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ diff --git a/STM32/CM7/Core/Src/stm32h7xx_hal_msp.c b/STM32/CM7/Core/Src/stm32h7xx_hal_msp.c index 8fc7789..21df3d1 100644 --- a/STM32/CM7/Core/Src/stm32h7xx_hal_msp.c +++ b/STM32/CM7/Core/Src/stm32h7xx_hal_msp.c @@ -1,21 +1,7 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_hal_msp.c - * @brief This file provides code for the MSP Initialization - * and de-Initialization codes. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" @@ -57,10 +43,9 @@ /* USER CODE END 0 */ /** - * Initializes the Global MSP. - */ -void HAL_MspInit(void) -{ + * Initializes the Global MSP. + */ +void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ diff --git a/STM32/CM7/Core/Src/stm32h7xx_it.c b/STM32/CM7/Core/Src/stm32h7xx_it.c index 430a6ac..1532983 100644 --- a/STM32/CM7/Core/Src/stm32h7xx_it.c +++ b/STM32/CM7/Core/Src/stm32h7xx_it.c @@ -1,25 +1,12 @@ /* USER CODE BEGIN Header */ -/** - ****************************************************************************** - * @file stm32h7xx_it.c - * @brief Interrupt Service Routines. - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 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. - * - ****************************************************************************** - */ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ -#include "main.h" #include "stm32h7xx_it.h" +#include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ @@ -64,85 +51,74 @@ /* Cortex Processor Interruption and Exception Handlers */ /******************************************************************************/ /** - * @brief This function handles Non maskable interrupt. - */ -void NMI_Handler(void) -{ + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) { /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ /* USER CODE END NonMaskableInt_IRQn 0 */ /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ - while (1) - { + while (1) { } /* USER CODE END NonMaskableInt_IRQn 1 */ } /** - * @brief This function handles Hard fault interrupt. - */ -void HardFault_Handler(void) -{ + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) { /* USER CODE BEGIN HardFault_IRQn 0 */ /* USER CODE END HardFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_HardFault_IRQn 0 */ /* USER CODE END W1_HardFault_IRQn 0 */ } } /** - * @brief This function handles Memory management fault. - */ -void MemManage_Handler(void) -{ + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) { /* USER CODE BEGIN MemoryManagement_IRQn 0 */ /* USER CODE END MemoryManagement_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ /* USER CODE END W1_MemoryManagement_IRQn 0 */ } } /** - * @brief This function handles Pre-fetch fault, memory access fault. - */ -void BusFault_Handler(void) -{ + * @brief This function handles Pre-fetch fault, memory access fault. + */ +void BusFault_Handler(void) { /* USER CODE BEGIN BusFault_IRQn 0 */ /* USER CODE END BusFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_BusFault_IRQn 0 */ /* USER CODE END W1_BusFault_IRQn 0 */ } } /** - * @brief This function handles Undefined instruction or illegal state. - */ -void UsageFault_Handler(void) -{ + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) { /* USER CODE BEGIN UsageFault_IRQn 0 */ /* USER CODE END UsageFault_IRQn 0 */ - while (1) - { + while (1) { /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ /* USER CODE END W1_UsageFault_IRQn 0 */ } } /** - * @brief This function handles System service call via SWI instruction. - */ -void SVC_Handler(void) -{ + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) { /* USER CODE BEGIN SVCall_IRQn 0 */ /* USER CODE END SVCall_IRQn 0 */ @@ -152,10 +128,9 @@ void SVC_Handler(void) } /** - * @brief This function handles Debug monitor. - */ -void DebugMon_Handler(void) -{ + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) { /* USER CODE BEGIN DebugMonitor_IRQn 0 */ /* USER CODE END DebugMonitor_IRQn 0 */ @@ -165,10 +140,9 @@ void DebugMon_Handler(void) } /** - * @brief This function handles Pendable request for system service. - */ -void PendSV_Handler(void) -{ + * @brief This function handles Pendable request for system service. + */ +void PendSV_Handler(void) { /* USER CODE BEGIN PendSV_IRQn 0 */ /* USER CODE END PendSV_IRQn 0 */ @@ -178,10 +152,9 @@ void PendSV_Handler(void) } /** - * @brief This function handles System tick timer. - */ -void SysTick_Handler(void) -{ + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) { /* USER CODE BEGIN SysTick_IRQn 0 */ /* USER CODE END SysTick_IRQn 0 */ diff --git a/STM32/CM7/Core/Src/syscalls.c b/STM32/CM7/Core/Src/syscalls.c index e10d76f..d81cfb1 100644 --- a/STM32/CM7/Core/Src/syscalls.c +++ b/STM32/CM7/Core/Src/syscalls.c @@ -21,153 +21,127 @@ */ /* Includes */ -#include -#include #include -#include #include -#include +#include +#include +#include #include #include - +#include /* Variables */ extern int __io_putchar(int ch) __attribute__((weak)); extern int __io_getchar(void) __attribute__((weak)); - -char *__env[1] = { 0 }; +char *__env[1] = {0}; char **environ = __env; - /* Functions */ -void initialise_monitor_handles() -{ -} +void initialise_monitor_handles() {} -int _getpid(void) -{ - return 1; -} +int _getpid(void) { return 1; } -int _kill(int pid, int sig) -{ +int _kill(int pid, int sig) { (void)pid; (void)sig; errno = EINVAL; return -1; } -void _exit (int status) -{ +void _exit(int status) { _kill(status, -1); - while (1) {} /* Make sure we hang here */ + while (1) { + } /* Make sure we hang here */ } -__attribute__((weak)) int _read(int file, char *ptr, int len) -{ +__attribute__((weak)) int _read(int file, char *ptr, int len) { (void)file; int DataIdx; - for (DataIdx = 0; DataIdx < len; DataIdx++) - { + for (DataIdx = 0; DataIdx < len; DataIdx++) { *ptr++ = __io_getchar(); } return len; } -__attribute__((weak)) int _write(int file, char *ptr, int len) -{ +__attribute__((weak)) int _write(int file, char *ptr, int len) { (void)file; int DataIdx; - for (DataIdx = 0; DataIdx < len; DataIdx++) - { + for (DataIdx = 0; DataIdx < len; DataIdx++) { __io_putchar(*ptr++); } return len; } -int _close(int file) -{ +int _close(int file) { (void)file; return -1; } - -int _fstat(int file, struct stat *st) -{ +int _fstat(int file, struct stat *st) { (void)file; st->st_mode = S_IFCHR; return 0; } -int _isatty(int file) -{ +int _isatty(int file) { (void)file; return 1; } -int _lseek(int file, int ptr, int dir) -{ +int _lseek(int file, int ptr, int dir) { (void)file; (void)ptr; (void)dir; return 0; } -int _open(char *path, int flags, ...) -{ +int _open(char *path, int flags, ...) { (void)path; (void)flags; /* Pretend like we always fail */ return -1; } -int _wait(int *status) -{ +int _wait(int *status) { (void)status; errno = ECHILD; return -1; } -int _unlink(char *name) -{ +int _unlink(char *name) { (void)name; errno = ENOENT; return -1; } -clock_t _times(struct tms *buf) -{ +clock_t _times(struct tms *buf) { (void)buf; return -1; } -int _stat(const char *file, struct stat *st) -{ +int _stat(const char *file, struct stat *st) { (void)file; st->st_mode = S_IFCHR; return 0; } -int _link(char *old, char *new) -{ +int _link(char *old, char *new) { (void)old; (void)new; errno = EMLINK; return -1; } -int _fork(void) -{ +int _fork(void) { errno = EAGAIN; return -1; } -int _execve(char *name, char **argv, char **env) -{ +int _execve(char *name, char **argv, char **env) { (void)name; (void)argv; (void)env; @@ -185,11 +159,10 @@ int _execve(char *name, char **argv, char **env) * @param file FILE stream pointer (ignored). * @retval int The character written. */ -static int starm_putc(char c, FILE *file) -{ - (void) file; +static int starm_putc(char c, FILE *file) { + (void)file; __io_putchar(c); - return c; + return c; } /** @@ -198,31 +171,30 @@ static int starm_putc(char c, FILE *file) * @param file FILE stream pointer (ignored). * @retval int The character read, cast to an unsigned char then int. */ -static int starm_getc(FILE *file) -{ - unsigned char c; - (void) file; +static int starm_getc(FILE *file) { + unsigned char c; + (void)file; c = __io_getchar(); - return c; + return c; } // Define and initialize the standard I/O streams for Picolibc. -// FDEV_SETUP_STREAM connects the starm_putc and starm_getc helper functions to a FILE structure. -// _FDEV_SETUP_RW indicates the stream is for reading and writing. -static FILE __stdio = FDEV_SETUP_STREAM(starm_putc, - starm_getc, - NULL, - _FDEV_SETUP_RW); +// FDEV_SETUP_STREAM connects the starm_putc and starm_getc helper functions to +// a FILE structure. _FDEV_SETUP_RW indicates the stream is for reading and +// writing. +static FILE __stdio = + FDEV_SETUP_STREAM(starm_putc, starm_getc, NULL, _FDEV_SETUP_RW); -// Assign the standard stream pointers (stdin, stdout, stderr) to the initialized stream. -// Picolibc uses these pointers for standard I/O operations (printf, scanf, etc.). +// Assign the standard stream pointers (stdin, stdout, stderr) to the +// initialized stream. Picolibc uses these pointers for standard I/O operations +// (printf, scanf, etc.). FILE *const stdin = &__stdio; __strong_reference(stdin, stdout); __strong_reference(stdin, stderr); -// Create strong aliases mapping standard C library function names (without underscore) -// to the implemented system call stubs (with underscore). Picolibc uses these -// standard names internally, so this linking is required. +// Create strong aliases mapping standard C library function names (without +// underscore) to the implemented system call stubs (with underscore). Picolibc +// uses these standard names internally, so this linking is required. __strong_reference(_read, read); __strong_reference(_write, write); __strong_reference(_times, times); diff --git a/STM32/CM7/Core/Src/sysmem.c b/STM32/CM7/Core/Src/sysmem.c index a875d42..80988ae 100644 --- a/STM32/CM7/Core/Src/sysmem.c +++ b/STM32/CM7/Core/Src/sysmem.c @@ -22,8 +22,8 @@ /* Includes */ #include -#include #include +#include /** * Pointer to the current high watermark of the heap usage @@ -51,24 +51,21 @@ static uint8_t *__sbrk_heap_end = NULL; * @param incr Memory size * @return Pointer to allocated memory */ -void *_sbrk(ptrdiff_t incr) -{ - extern uint8_t _end; /* Symbol defined in the linker script */ - extern uint8_t _estack; /* Symbol defined in the linker script */ +void *_sbrk(ptrdiff_t incr) { + extern uint8_t _end; /* Symbol defined in the linker script */ + extern uint8_t _estack; /* Symbol defined in the linker script */ extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */ const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size; const uint8_t *max_heap = (uint8_t *)stack_limit; uint8_t *prev_heap_end; /* Initialize heap end at first call */ - if (NULL == __sbrk_heap_end) - { + if (NULL == __sbrk_heap_end) { __sbrk_heap_end = &_end; } /* Protect heap from growing into the reserved MSP stack */ - if (__sbrk_heap_end + incr > max_heap) - { + if (__sbrk_heap_end + incr > max_heap) { errno = ENOMEM; return (void *)-1; } @@ -80,8 +77,8 @@ void *_sbrk(ptrdiff_t incr) } #if defined(__PICOLIBC__) - // Picolibc expects syscalls without the leading underscore. - // This creates a strong alias so that - // calls to `sbrk()` are resolved to our `_sbrk()` implementation. - __strong_reference(_sbrk, sbrk); +// Picolibc expects syscalls without the leading underscore. +// This creates a strong alias so that +// calls to `sbrk()` are resolved to our `_sbrk()` implementation. +__strong_reference(_sbrk, sbrk); #endif diff --git a/Zephyr/src/main.c b/Zephyr/src/main.c index e657d28..5496741 100644 --- a/Zephyr/src/main.c +++ b/Zephyr/src/main.c @@ -1,3 +1,7 @@ +// Copyright (C) 2026 Hector van der Aa +// Copyright (C) 2026 Association Exergie +// SPDX-License-Identifier: GPL-3.0-or-later + #include #include