From 1dd8b736734ebe674624ac8e8743f128bae17c66 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Mon, 9 Aug 2021 19:16:09 +0200 Subject: [PATCH 001/119] target CMSIS:: will not include any template --- cmake/FindCMSIS.cmake | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index 41431c56..ce4ff82b 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -183,28 +183,28 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) set(CMSIS_${COMP}_VERSION ${CMSIS_${FAMILY}${CORE_U}_VERSION}) set(CMSIS_VERSION ${CMSIS_${COMP}_VERSION}) + if(NOT (TARGET CMSIS::STM32::${FAMILY}${CORE_C})) + message(TRACE "FindCMSIS: creating library CMSIS::STM32::${FAMILY}${CORE_C}") + add_library(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED) + #STM32::${FAMILY}${CORE_C} contains compile options and is define in .cmake + target_link_libraries(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C}) + target_include_directories(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_CORE_PATH}/Include") + target_include_directories(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_PATH}/Include") + endif() + # search for system_stm32[XX]xx.c - find_file(CMSIS_${FAMILY}${CORE_U}_SOURCE + find_file(CMSIS_${FAMILY}${CORE_U}_SYSTEM NAMES system_stm32${FAMILY_L}xx.c PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates" NO_DEFAULT_PATH ) - list(APPEND CMSIS_SOURCES "${CMSIS_${FAMILY}${CORE_U}_SOURCE}") + list(APPEND CMSIS_SOURCES "${CMSIS_${FAMILY}${CORE_U}_SYSTEM}") - if(NOT CMSIS_${FAMILY}${CORE_U}_SOURCE) + if(NOT CMSIS_${FAMILY}${CORE_U}_SYSTEM) message(VERBOSE "FindCMSIS: system_stm32${FAMILY_L}xx.c for ${FAMILY}${CORE_U} has not been found") continue() endif() - - if(NOT (TARGET CMSIS::STM32::${FAMILY}${CORE_C})) - message(TRACE "FindCMSIS: creating library CMSIS::STM32::${FAMILY}${CORE_C}") - add_library(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED) - target_link_libraries(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C}) - target_include_directories(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_CORE_PATH}/Include") - target_include_directories(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_PATH}/Include") - target_sources(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_SOURCE}") - endif() - + set(STM_DEVICES_FOUND TRUE) foreach(DEVICE ${STM_DEVICES}) message(TRACE "FindCMSIS: Iterating DEVICE ${DEVICE}") @@ -236,6 +236,7 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) add_library(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE IMPORTED) target_link_libraries(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE CMSIS::STM32::${FAMILY}${CORE_C} STM32::${TYPE}${CORE_C}) target_sources(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP}") + target_sources(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_SYSTEM}") endif() add_library(CMSIS::STM32::${DEVICE}${CORE_C} INTERFACE IMPORTED) From d67a3d5564cf2d9f9d46b517e85c817ea222e985 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 10 Aug 2021 14:31:33 +0200 Subject: [PATCH 002/119] Using HINTS for STM Toolchain Path This causes toolchains found via the STM32_TOOLCHAIN_PATH variable to take precedence over a toolchain in the system path --- README.md | 4 +++- cmake/stm32/common.cmake | 10 +++++----- cmake/stm32_gcc.cmake | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b40fc373..957eaf28 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,14 @@ The most important set of variables which needs to be set can be found in the fo These configuration options need to be set for the build process to work properly: -* `STM32_TOOLCHAIN_PATH` - where toolchain is located, **default**: `/usr` * `STM32_CUBE__PATH` - path to STM32Cube directory, where `` is one of `F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 WB WL` **default**: `/opt/STM32Cube` These configuration variables are optional: +* `STM32_TOOLCHAIN_PATH` - where toolchain is located, **default**: `/usr`. Alternatively + you can add the folder containing the toolchain binaries to the system path. If both are given, + the `STM32_TOOLCHAIN_PATH` setting takes precedence * `TARGET_TRIPLET` - toolchain target triplet, **default**: `arm-none-eabi` * `FREERTOS_PATH` - Path to the FreeRTOS kernel when compiling with a RTOS. Does not need to be specified when using CMSIS diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 63a4fda1..9953f5d9 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -43,11 +43,11 @@ set(TOOLCHAIN_BIN_PATH "${STM32_TOOLCHAIN_PATH}/bin") set(TOOLCHAIN_INC_PATH "${STM32_TOOLCHAIN_PATH}/${STM32_TARGET_TRIPLET}/include") set(TOOLCHAIN_LIB_PATH "${STM32_TOOLCHAIN_PATH}/${STM32_TARGET_TRIPLET}/lib") -find_program(CMAKE_OBJCOPY NAMES ${STM32_TARGET_TRIPLET}-objcopy PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_OBJDUMP NAMES ${STM32_TARGET_TRIPLET}-objdump PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_SIZE NAMES ${STM32_TARGET_TRIPLET}-size PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_OBJCOPY NAMES ${STM32_TARGET_TRIPLET}-objcopy HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_OBJDUMP NAMES ${STM32_TARGET_TRIPLET}-objdump HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_SIZE NAMES ${STM32_TARGET_TRIPLET}-size HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt HINTS ${TOOLCHAIN_BIN_PATH}) function(stm32_print_size_of_target TARGET) add_custom_target(${TARGET}_always_display_size diff --git a/cmake/stm32_gcc.cmake b/cmake/stm32_gcc.cmake index bdf5a305..174375d7 100644 --- a/cmake/stm32_gcc.cmake +++ b/cmake/stm32_gcc.cmake @@ -5,9 +5,10 @@ include(stm32/common) include(stm32/devices) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -find_program(CMAKE_C_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_CXX_COMPILER NAMES ${STM32_TARGET_TRIPLET}-g++ PATHS ${TOOLCHAIN_BIN_PATH}) -find_program(CMAKE_ASM_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc PATHS ${TOOLCHAIN_BIN_PATH}) + +find_program(CMAKE_C_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_CXX_COMPILER NAMES ${STM32_TARGET_TRIPLET}-g++ HINTS ${TOOLCHAIN_BIN_PATH}) +find_program(CMAKE_ASM_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc HINTS ${TOOLCHAIN_BIN_PATH}) set(CMAKE_EXECUTABLE_SUFFIX_C .elf) set(CMAKE_EXECUTABLE_SUFFIX_CXX .elf) From db19f66276b31e313c59a14d0ecdc9ce115815fe Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Tue, 10 Aug 2021 18:40:27 +0200 Subject: [PATCH 003/119] partially support freertos with armv8-m only in No Trust Zone mode --- cmake/FindFreeRTOS.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index c1e3b827..a0d0ba71 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -1,5 +1,5 @@ # For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html -set(FreeRTOS_PORTS ARM_CM0 ARM_CM3 ARM_CM4F ARM_CM7 ARM_CM4_MPU ARM_CM3_MPU ARM_CM7_MPU) +set(FreeRTOS_PORTS ARM_CM0 ARM_CM3 ARM_CM3_MPU ARM_CM4_MPU ARM_CM4F ARM_CM7 ARM_CM7_MPU ARM_CM23_NTZ ARM_CM33_NTZ) if(NOT FreeRTOS_FIND_COMPONENTS) set(FreeRTOS_FIND_COMPONENTS ${FreeRTOS_PORTS}) @@ -129,10 +129,12 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) NAMES portmacro.h PATHS "${FREERTOS_PATH}" "${FREERTOS_PATH}/FreeRTOS" PATH_SUFFIXES - "portable/GCC/${PORT}/r0p1" "portable/GCC/${PORT}" + "portable/GCC/${PORT}/r0p1" + "portable/GCC/${PORT}/non_secure" "Source/portable/GCC/${PORT}" "Source/portable/GCC/${PORT}/r0p1" + "Source/portable/GCC/${PORT}/non_secure" NO_DEFAULT_PATH ) From 62f7d4ca9682187033ee6ca8940edac47825c9c6 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Tue, 10 Aug 2021 19:03:52 +0200 Subject: [PATCH 004/119] add freeRTOS example for an M33 --- examples/freertos/CMakeLists.txt | 54 ++- examples/freertos/FreeRTOSConfig.h | 7 + examples/freertos/main.cpp | 7 + examples/freertos/stm32l5xx_hal_conf.h | 439 +++++++++++++++++++++++++ 4 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 examples/freertos/stm32l5xx_hal_conf.h diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index 11a6f46f..662f667a 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.16) set(PROJ_NAME stm32-freertos) set(STM32_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..) +set(CMAKE_MESSAGE_LOG_LEVEL trace) + # Please note: When using CMSIS, it is recommended to use the FreeRTOS version supplied in the # Cube repository because more recent kernels might be incompatible to the CMSIS # implementation provided by STM @@ -37,8 +39,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) set(SUPPORTED_BOARDS F407VG H743ZI) option(FREERTOS_F407VG_EXAMPLE "Compile FreeRTOS example for the F407VG board" OFF) option(FREERTOS_H743ZI_EXAMPLE "Compile FreeRTOS example for the H743ZI board" OFF) +option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the F407VG board" ON) -if(NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE) +if(NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE AND NOT FREERTOS_L552ZE_EXAMPLE) message(FATAL_ERROR "Please select at least one target to compile by passing FREERTOS__EXAMPLE=ON\n" "Supported boards: ${SUPPORTED_BOARDS}" @@ -83,6 +86,19 @@ if(FREERTOS_F407VG_EXAMPLE) endif() endif() +if(FREERTOS_L552ZE_EXAMPLE) + list(APPEND CMSIS_COMP_LIST STM32L552ZE) + list(APPEND HAL_COMP_LIST STM32L552ZE) + list(APPEND FREERTOS_COMP_LIST ARM_CM33_NTZ) + if(USE_CUBE_FREERTOS) + # The device family needs to be supplied as a component to use the Cube FreeRTOS sources + list(APPEND FREERTOS_COMP_LIST STM32L5) + set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::L5) + else() + set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}) + endif() +endif() + find_package(CMSIS COMPONENTS ${CMSIS_COMP_LIST} REQUIRED) find_package(HAL COMPONENTS ${HAL_COMP_LIST} REQUIRED) find_package(FreeRTOS COMPONENTS ${FREERTOS_COMP_LIST} REQUIRED) @@ -168,3 +184,39 @@ if(FREERTOS_F407VG_EXAMPLE) stm32_generate_binary_file(${TARGET_NAME}) stm32_generate_hex_file(${TARGET_NAME}) endif() + +if(FREERTOS_L552ZE_EXAMPLE) + set(TARGET_NAME ${PROJ_NAME}-l552ze) + add_executable(${TARGET_NAME}) + + target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) + target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} PRIVATE + ${FREERTOS_L5_NAMESPACE}::Timers + ${FREERTOS_L5_NAMESPACE}::Heap::1 + ${FREERTOS_L5_NAMESPACE}::ARM_CM33_NTZ + HAL::STM32::L5::RCC + HAL::STM32::L5::GPIO + HAL::STM32::L5::CORTEX + CMSIS::STM32::L552ZE + STM32::NoSys + ) + if(USE_CMSIS_RTOS) + target_link_libraries(${TARGET_NAME} PRIVATE + CMSIS::STM32::L5::RTOS + ) + endif() + if(USE_CMSIS_RTOS_V2) + target_link_libraries(${TARGET_NAME} PRIVATE + CMSIS::STM32::L5::RTOS_V2 + ) + target_compile_definitions(${TARGET_NAME} PRIVATE + USE_CMSIS_RTOS_V2 + CMSIS_RTOS_V2_DEVICE_HEADER="stm32l5xx_hal.h" + ) + endif() + + stm32_print_size_of_target(${TARGET_NAME}) + stm32_generate_binary_file(${TARGET_NAME}) + stm32_generate_hex_file(${TARGET_NAME}) +endif() \ No newline at end of file diff --git a/examples/freertos/FreeRTOSConfig.h b/examples/freertos/FreeRTOSConfig.h index a67e23bd..38240cae 100644 --- a/examples/freertos/FreeRTOSConfig.h +++ b/examples/freertos/FreeRTOSConfig.h @@ -44,6 +44,13 @@ #include extern uint32_t SystemCoreClock; +#if defined STM32L5 + #define configENABLE_TRUSTZONE 0 + #define configRUN_FREERTOS_SECURE_ONLY 0 + #define configENABLE_FPU 1 + #define configENABLE_MPU 0 +#endif + #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 1 diff --git a/examples/freertos/main.cpp b/examples/freertos/main.cpp index df43c03a..08079008 100644 --- a/examples/freertos/main.cpp +++ b/examples/freertos/main.cpp @@ -17,6 +17,13 @@ #define LED_PORT GPIOD #define LED_PIN GPIO_PIN_12 #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE +#elif defined STM32L5 + #include + + // NUCLEO-L552ZE-Q blue led - PB7 + #define LED_PORT GPIOB + #define LED_PIN GPIO_PIN_7 + #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE #endif static void blinky::blinkTask(void *arg) diff --git a/examples/freertos/stm32l5xx_hal_conf.h b/examples/freertos/stm32l5xx_hal_conf.h new file mode 100644 index 00000000..104ab9d5 --- /dev/null +++ b/examples/freertos/stm32l5xx_hal_conf.h @@ -0,0 +1,439 @@ +/** + ****************************************************************************** + * @file stm32l5xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32l5xx_hal_conf.h. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32L5xx_HAL_CONF_H +#define STM32L5xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_COMP_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DFSDM_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_GTZC_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_ICACHE_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_MMC_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_OSPI_MODULE_ENABLED +#define HAL_OTFDEC_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PKA_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_TSC_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED + + +/* ########################## 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 */ +#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 */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) +#define MSI_VALUE 4000000UL /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_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 16000000UL /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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 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 /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for SAI1 peripheral + * This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source + * frequency. + */ +#if !defined (EXTERNAL_SAI1_CLOCK_VALUE) +#define EXTERNAL_SAI1_CLOCK_VALUE 48000UL /*!< Value of the SAI1 External clock source in Hz*/ +#endif /* EXTERNAL_SAI1_CLOCK_VALUE */ + +/** + * @brief External clock source for SAI2 peripheral + * This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source + * frequency. + */ +#if !defined (EXTERNAL_SAI2_CLOCK_VALUE) +#define EXTERNAL_SAI2_CLOCK_VALUE 48000UL /*!< Value of the SAI2 External clock source in Hz*/ +#endif /* EXTERNAL_SAI2_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 ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Register callback feature configuration ############### */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32l5xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U +#define USE_HAL_COMP_REGISTER_CALLBACKS 0U +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U +#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U +#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U +#define USE_HAL_PKA_REGISTER_CALLBACKS 0U +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U +#define USE_HAL_SD_REGISTER_CALLBACKS 0U +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U +#define USE_HAL_TSC_REGISTER_CALLBACKS 0U +#define USE_HAL_UART_REGISTER_CALLBACKS 0U +#define USE_HAL_USART_REGISTER_CALLBACKS 0U +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ + +#define USE_SPI_CRC 1U + +/* ################## CRYP peripheral configuration ########################## */ + +#define USE_HAL_CRYP_SUSPEND_RESUME 1U + +/* ################## SDMMC peripheral configuration ######################### */ + +#define USE_SD_TRANSCEIVER 0U + + + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32l5xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32l5xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32l5xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32l5xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32l5xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32l5xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32l5xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32l5xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32l5xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32l5xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32l5xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED +#include "stm32l5xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32l5xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_GTZC_MODULE_ENABLED +#include "stm32l5xx_hal_gtzc.h" +#endif /* HAL_GTZC_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32l5xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32l5xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_ICACHE_MODULE_ENABLED +#include "stm32l5xx_hal_icache.h" +#endif /* HAL_ICACHE_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32l5xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32l5xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32l5xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32l5xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32l5xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32l5xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32l5xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OSPI_MODULE_ENABLED +#include "stm32l5xx_hal_ospi.h" +#endif /* HAL_OSPI_MODULE_ENABLED */ + +#ifdef HAL_OTFDEC_MODULE_ENABLED +#include "stm32l5xx_hal_otfdec.h" +#endif /* HAL_OTFDEC_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32l5xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED +#include "stm32l5xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32l5xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32l5xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32l5xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32l5xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32l5xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32l5xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32l5xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32l5xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32l5xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32l5xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED +#include "stm32l5xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32l5xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32l5xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32l5xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32L5xx_HAL_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ From 5419d70efa6c75458be42e69a47edd9e299c2436 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Wed, 11 Aug 2021 14:42:46 +0200 Subject: [PATCH 005/119] fix finFreeRTOS for M33 with NTZ --- cmake/FindFreeRTOS.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index a0d0ba71..114d21a2 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -155,6 +155,16 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_SOURCE}") target_include_directories(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_PATH}") endif() + + # armv8-m needs additional file even if using "No Trust Zone" port + if(${PORT} STREQUAL ARM_CM23_NTZ OR ${PORT} STREQUAL ARM_CM33_NTZ) + find_file(FreeRTOS_${PORT}_ASM + NAMES portasm.c + PATHS "${FreeRTOS_${PORT}_PATH}" + NO_DEFAULT_PATH + ) + target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_ASM}") + endif() if(FreeRTOS_${PORT}_PATH AND FreeRTOS_${PORT}_SOURCE AND From 7184bc3fc054808dc6746725b0fcaecb84fb1aa4 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Wed, 11 Aug 2021 16:51:16 +0200 Subject: [PATCH 006/119] support all CM33 targets with trust zone --- cmake/FindFreeRTOS.cmake | 47 ++++++++++++++++++++---------- examples/freertos/CMakeLists.txt | 4 +-- examples/freertos/FreeRTOSConfig.h | 3 ++ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index 114d21a2..5f53f003 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -1,5 +1,5 @@ # For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html -set(FreeRTOS_PORTS ARM_CM0 ARM_CM3 ARM_CM3_MPU ARM_CM4_MPU ARM_CM4F ARM_CM7 ARM_CM7_MPU ARM_CM23_NTZ ARM_CM33_NTZ) +set(FreeRTOS_PORTS ARM_CM0 ARM_CM3 ARM_CM3_MPU ARM_CM4_MPU ARM_CM4F ARM_CM7 ARM_CM7_MPU ARM_CM23 ARM_CM23_NTZ ARM_CM33 ARM_CM33_NTZ) if(NOT FreeRTOS_FIND_COMPONENTS) set(FreeRTOS_FIND_COMPONENTS ${FreeRTOS_PORTS}) @@ -125,6 +125,10 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) endforeach() foreach(PORT ${FreeRTOS_FIND_COMPONENTS_PORTS}) + if(${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + set(ARMv8_NON_SECURE "::NON_SECURE") + endif() + find_path(FreeRTOS_${PORT}_PATH NAMES portmacro.h PATHS "${FREERTOS_PATH}" "${FREERTOS_PATH}/FreeRTOS" @@ -149,21 +153,34 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) PATHS "${FreeRTOS_${PORT}_PATH}" NO_DEFAULT_PATH ) - if(NOT (TARGET ${FreeRTOS_NAMESPACE}::${PORT})) - add_library(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE IMPORTED) - target_link_libraries(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE FreeRTOS) - target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_SOURCE}") - target_include_directories(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_PATH}") - endif() + if(NOT (TARGET ${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE})) + add_library(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE IMPORTED) + target_link_libraries(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE FreeRTOS) + target_sources(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_SOURCE}") + target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}") + message(trace "FindFreeRTOS: creating target ${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE}") + + # armv8-m needs additional file even if using "No Trust Zone" port + if(${PORT} STREQUAL ARM_CM23_NTZ OR ${PORT} STREQUAL ARM_CM33_NTZ OR ${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + target_sources(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}/portasm.c") + endif() + + if(${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + # create the secure target + add_library(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE IMPORTED) + # ::SECURE doesn't link FreeRTOS like ::NON_SECURE does + target_sources(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE "${FreeRTOS_${PORT}_PATH}/../secure/secure_context.c" + "${FreeRTOS_${PORT}_PATH}/../secure/secure_context_port.c" + "${FreeRTOS_${PORT}_PATH}/../secure/secure_heap.c" + "${FreeRTOS_${PORT}_PATH}/../secure/secure_init.c") + message(trace "FindFreeRTOS: creating target ${FreeRTOS_NAMESPACE}::${PORT}::SECURE") - # armv8-m needs additional file even if using "No Trust Zone" port - if(${PORT} STREQUAL ARM_CM23_NTZ OR ${PORT} STREQUAL ARM_CM33_NTZ) - find_file(FreeRTOS_${PORT}_ASM - NAMES portasm.c - PATHS "${FreeRTOS_${PORT}_PATH}" - NO_DEFAULT_PATH - ) - target_sources(${FreeRTOS_NAMESPACE}::${PORT} INTERFACE "${FreeRTOS_${PORT}_ASM}") + # non-secure part needs declaratation from secure includes + target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}/../secure") + # secure part needs declaratation from non-secure includes and common freeRTOS includes + target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE "${FreeRTOS_${PORT}_PATH}" + "${FreeRTOS_COMMON_INCLUDE}") + endif() endif() if(FreeRTOS_${PORT}_PATH AND diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index 662f667a..fc7b6dc5 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.16) set(PROJ_NAME stm32-freertos) set(STM32_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..) -set(CMAKE_MESSAGE_LOG_LEVEL trace) - # Please note: When using CMSIS, it is recommended to use the FreeRTOS version supplied in the # Cube repository because more recent kernels might be incompatible to the CMSIS # implementation provided by STM @@ -39,7 +37,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) set(SUPPORTED_BOARDS F407VG H743ZI) option(FREERTOS_F407VG_EXAMPLE "Compile FreeRTOS example for the F407VG board" OFF) option(FREERTOS_H743ZI_EXAMPLE "Compile FreeRTOS example for the H743ZI board" OFF) -option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the F407VG board" ON) +option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the L552ZE board" OFF) if(NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE AND NOT FREERTOS_L552ZE_EXAMPLE) message(FATAL_ERROR diff --git a/examples/freertos/FreeRTOSConfig.h b/examples/freertos/FreeRTOSConfig.h index 38240cae..708bbc03 100644 --- a/examples/freertos/FreeRTOSConfig.h +++ b/examples/freertos/FreeRTOSConfig.h @@ -46,6 +46,9 @@ extern uint32_t SystemCoreClock; #if defined STM32L5 #define configENABLE_TRUSTZONE 0 + #if configENABLE_TRUSTZONE + #define configMINIMAL_SECURE_STACK_SIZE ((uint16_t)1024) + #endif #define configRUN_FREERTOS_SECURE_ONLY 0 #define configENABLE_FPU 1 #define configENABLE_MPU 0 From ded4cac0a78c725cdab69fde87fe9c3ed3990e63 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Wed, 11 Aug 2021 17:19:54 +0200 Subject: [PATCH 007/119] add associated documentation --- README.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c1a036f6..21862621 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ device family also has to be specified as a component for the `FreeRTOS` package CMSIS RTOS can be used by specifying a `CMSIS` target and by finding the CMSIS `RTOS` package. The following section will show a few example configurations for the H7 and F4 family. -You can also find example code for the `H743ZI` and `F407VG` devices in the `examples` +You can also find example code for several devices in the [examples](https://github.com/ObKo/stm32-cmake/tree/master/examples/freertos) folder. Typical usage for a H7 device when using the M7 core, using an external kernel without CMSIS @@ -250,6 +250,30 @@ target_link_libraries(${TARGET_NAME} PRIVATE ) ``` +For ARMv8-M architecture (CM23 and CM33) you can choose "No Trust Zone" port: + +```cmake +find_package(FreeRTOS COMPONENTS ARM_CM33_NTZ REQUIRED) +target_link_libraries(${TARGET_NAME} PRIVATE + ... + FreeRTOS::ARM_CM33_NTZ +) +``` + +Or you can use the trust zone with: + +```cmake +find_package(FreeRTOS COMPONENTS ARM_CM33 REQUIRED) +target_link_libraries(${SECURE_TARGET_NAME} PRIVATE + ... + FreeRTOS::ARM_CM33::SECURE +) +target_link_libraries(${NON_SECURE_TARGET_NAME} PRIVATE + ... + FreeRTOS::ARM_CM33::NON_SECURE +) +``` + Another typical usage using the FreeRTOS provided in the Cube repository and the CMSIS support. The FreeRTOS namespace is set to `FreeRTOS::STM32::`, the `ARM_CM7` port is used and the device family is specified as a `FreeRTOS` component with `STM32H7`: @@ -277,8 +301,9 @@ in the Cube repository For the multi-core architectures, both family and core need to be specified like shown in the example above. -The following FreeRTOS ports are supported in general: `ARM_CM0`, `ARM_CM3`, `ARM_CM4F`, `ARM_CM7`, -`ARM_CM3_MPU`, `ARM_CM4_MPU`, `ARM_CM7_MPU`. +The following FreeRTOS ports are supported in general: `ARM_CM0`, `ARM_CM3`, +`ARM_CM3_MPU`, `ARM_CM4F`, `ARM_CM4_MPU`, `ARM_CM7`, `ARM_CM7_MPU`, +`ARM_CM23`, `ARM_CM23_NTZ`, `ARM_CM33`, `ARM_CM33_NTZ`. Other FreeRTOS libraries, with `FREERTOS_NAMESPACE` being set as specified in the examples above: From bc7791618d1935f0d9112b2f364e4b8afd276a3f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 18 Aug 2021 17:32:36 +0200 Subject: [PATCH 008/119] Added .gitignore for repository Ignore build folders --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..567609b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ From 7bc8f50af7ac909a4dbf7d711299e58624249b65 Mon Sep 17 00:00:00 2001 From: Benjamin Martens Date: Thu, 19 Aug 2021 12:07:35 +0200 Subject: [PATCH 009/119] Added stm32_generate_srec_file to generate Motorola S-record files --- README.md | 10 +++++---- cmake/stm32/common.cmake | 44 ++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5b3fc12b..f0786d3a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Tests](https://github.com/ObKo/stm32-cmake/workflows/Tests/badge.svg) -This project is used to develop applications for the STM32 - ST's ARM Cortex-Mx MCUs. +This project is used to develop applications for the STM32 - ST's ARM Cortex-Mx MCUs. It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL device families. ## Requirements @@ -35,7 +35,7 @@ It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports F0 F1 F2 F3 generation call. * `freertos` ([examples/freertos](examples/freertos)) - blink led using STM32 HAL library and FreeRTOS. You need to specify at least one board by passing `FREERTOS__EXAMPLE=ON` to CMake. - Currently, the example can be built for the `H743ZI` and `F407VG` board targets. + Currently, the example can be built for the `H743ZI` and `F407VG` board targets. You can opt to use the FreeRTOS CMSIS implementation provided by the Cube repository by supplying `USE_CMSIS_RTOS=ON` or `USE_CMSIS_RTOS_V2` to CMake. @@ -168,12 +168,12 @@ Here is typical usage: ```cmake add_executable(stm32-blinky-f4 blinky.c stm32f4xx_hal_conf.h) -target_link_libraries(stm32-blinky-f4 +target_link_libraries(stm32-blinky-f4 HAL::STM32::F4::RCC HAL::STM32::F4::GPIO HAL::STM32::F4::CORTEX CMSIS::STM32::F407VG - STM32::NoSys + STM32::NoSys ) ``` @@ -194,8 +194,10 @@ CMSIS package will generate linker script for your device automatically (target * `stm32_get_memory_info((CHIP )|(DEVICE TYPE ) [FLASH|RAM|CCRAM|STACK|HEAP] [SIZE ] [ORIGIN ])` - get information about device memories (into `` and ``). Linker script generator uses values from this function * `stm32_print_size_of_target()` - Print the application sizes for all formats * `stm32_generate_binary_file()` - Generate the binary file for the given target +* `stm32_generate_srec_file()` - Generate the srec file for the given target * `stm32_generate_hex_file()` - Generate the hex file for the given target + In the following functions, you can also specify mutiple families. * `stm32_get_devices_by_family(STM_DEVICES [FAMILY families...])` - return into `STM_DEVICES` all diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index d7800310..410f6cc4 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -68,6 +68,16 @@ function(stm32_generate_binary_file TARGET) ) endfunction() +function(stm32_generate_srec_file TARGET) + add_custom_command( + TARGET ${TARGET} + POST_BUILD + COMMAND ${CMAKE_OBJCOPY} -O srec ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.srec + BYPRODUCTS ${TARGET}.hex + COMMENT "Generating srec file ${CMAKE_PROJECT_NAME}.srec" + ) +endfunction() + function(stm32_generate_hex_file TARGET) add_custom_command( TARGET ${TARGET} @@ -78,7 +88,7 @@ function(stm32_generate_hex_file TARGET) ) endfunction() -# This function takes FAMILY (e.g. L4) and DEVICE (e.g. L496VG) to output TYPE (e.g. L496xx) +# This function takes FAMILY (e.g. L4) and DEVICE (e.g. L496VG) to output TYPE (e.g. L496xx) function(stm32_get_chip_type FAMILY DEVICE TYPE) set(INDEX 0) foreach(C_TYPE ${STM32_${FAMILY}_TYPES}) @@ -99,15 +109,15 @@ function(stm32_get_chip_info CHIP) set(ARG_SINGLE FAMILY DEVICE TYPE) set(ARG_MULTIPLE "") cmake_parse_arguments(PARSE_ARGV 1 ARG "${ARG_OPTIONS}" "${ARG_SINGLE}" "${ARG_MULTIPLE}") - + string(TOUPPER ${CHIP} CHIP) - + string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP}) - + if((NOT CMAKE_MATCH_1) OR (NOT CMAKE_MATCH_2)) message(FATAL_ERROR "Unknown chip ${CHIP}") endif() - + set(STM32_FAMILY ${CMAKE_MATCH_1}) set(STM32_DEVICE "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") @@ -117,7 +127,7 @@ function(stm32_get_chip_info CHIP) endif() stm32_get_chip_type(${STM32_FAMILY} ${STM32_DEVICE} STM32_TYPE) - + if(ARG_FAMILY) set(${ARG_FAMILY} ${STM32_FAMILY} PARENT_SCOPE) endif() @@ -134,7 +144,7 @@ function(stm32_get_cores CORES) set(ARG_SINGLE CHIP FAMILY DEVICE) set(ARG_MULTIPLE "") cmake_parse_arguments(PARSE_ARGV 1 ARG "${ARG_OPTIONS}" "${ARG_SINGLE}" "${ARG_MULTIPLE}") - + if(ARG_CHIP) # TODO: I don't get why stm32_get_chip_info is called in stm32_get_cores stm32_get_chip_info(${ARG_CHIP} FAMILY ARG_FAMILY TYPE ARG_TYPE DEVICE ARG_DEVICE) @@ -155,7 +165,7 @@ function(stm32_get_cores CORES) else() message(FATAL_ERROR "Either CHIP or FAMILY or FAMILY/DEVICE should be specified for stm32_get_cores()") endif() - + # TODO following is the only part really used by FindCMSIS. Maybe a cleanup is needed if(${ARG_FAMILY} STREQUAL "H7") stm32h7_get_device_cores(${ARG_DEVICE} ${ARG_TYPE} CORE_LIST) @@ -177,15 +187,15 @@ function(stm32_get_memory_info) if((NOT INFO_CHIP) AND ((NOT INFO_FAMILY) OR (NOT INFO_DEVICE))) message(FATAL_ERROR "Either CHIP or FAMILY/DEVICE is required for stm32_get_memory_info()") endif() - + if(INFO_CHIP) stm32_get_chip_info(${INFO_CHIP} FAMILY INFO_FAMILY TYPE INFO_TYPE DEVICE INFO_DEVICE) else() stm32_get_chip_type(${INFO_FAMILY} ${INFO_DEVICE} INFO_TYPE) endif() - + string(REGEX REPLACE "^[FGHLUW][0-9BL][0-9A-Z][0-9M].([3468BCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE}) - + if(SIZE_CODE STREQUAL "3") set(FLASH "8K") elseif(SIZE_CODE STREQUAL "4") @@ -210,7 +220,7 @@ function(stm32_get_memory_info) set(FLASH "1536K") elseif(SIZE_CODE STREQUAL "I") set(FLASH "2048K") - elseif(SIZE_CODE STREQUAL "Y") + elseif(SIZE_CODE STREQUAL "Y") set(FLASH "640K") elseif(SIZE_CODE STREQUAL "Z") set(FLASH "192K") @@ -218,7 +228,7 @@ function(stm32_get_memory_info) set(FLASH "16K") message(WARNING "Unknow flash size for device ${DEVICE}. Set to ${FLASH}") endif() - + list(FIND STM32_${INFO_FAMILY}_TYPES ${INFO_TYPE} TYPE_INDEX) list(GET STM32_${INFO_FAMILY}_RAM_SIZES ${TYPE_INDEX} RAM) list(GET STM32_${INFO_FAMILY}_CCRAM_SIZES ${TYPE_INDEX} CCRAM) @@ -248,9 +258,9 @@ function(stm32_get_memory_info) if(TWO_FLASH_BANKS) string(REGEX MATCH "([0-9]+)K" FLASH_KB ${FLASH}) math(EXPR FLASH_KB "${CMAKE_MATCH_1} / 2") - set(FLASH "${FLASH_KB}K") + set(FLASH "${FLASH_KB}K") endif() - + if(INFO_FLASH) set(SIZE ${FLASH}) set(ORIGIN ${FLASH_ORIGIN}) @@ -278,7 +288,7 @@ function(stm32_get_memory_info) endif() set(ORIGIN ${RAM_ORIGIN}) #TODO: Real heap pointer? endif() - + if(INFO_SIZE) set(${INFO_SIZE} ${SIZE} PARENT_SCOPE) endif() @@ -298,7 +308,7 @@ function(stm32_add_linker_script TARGET VISIBILITY SCRIPT) get_target_property(LINK_DEPENDS ${TARGET} ${INTERFACE_PREFIX}LINK_DEPENDS) if(LINK_DEPENDS) - list(APPEND LINK_DEPENDS "${SCRIPT}") + list(APPEND LINK_DEPENDS "${SCRIPT}") else() set(LINK_DEPENDS "${SCRIPT}") endif() From bdc8dfdfc5bf65220cf51b92c88f6e8dd888a14b Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Mon, 23 Aug 2021 08:15:11 +0200 Subject: [PATCH 010/119] correct BYPRODUCTS --- cmake/stm32/common.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 410f6cc4..c696f343 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -73,7 +73,8 @@ function(stm32_generate_srec_file TARGET) TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -O srec ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.srec - BYPRODUCTS ${TARGET}.hex + BYPRODUCTS ${TARGET}.srec + COMMENT "Generating srec file ${CMAKE_PROJECT_NAME}.srec" ) endfunction() From a333953446dcc4e05dcc5174f45f0c1b63fb6658 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Wed, 25 Aug 2021 13:41:37 +0200 Subject: [PATCH 011/119] use IN_LIST for armv8 --- cmake/FindFreeRTOS.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index 5f53f003..ba75614d 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -1,5 +1,7 @@ # For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html set(FreeRTOS_PORTS ARM_CM0 ARM_CM3 ARM_CM3_MPU ARM_CM4_MPU ARM_CM4F ARM_CM7 ARM_CM7_MPU ARM_CM23 ARM_CM23_NTZ ARM_CM33 ARM_CM33_NTZ) +set(FreeRTOS_armv8_PORTS ARM_CM23_NTZ ARM_CM33_NTZ ARM_CM23 ARM_CM33) +set(FreeRTOS_armv8_trustZone_PORTS ARM_CM23 ARM_CM33) if(NOT FreeRTOS_FIND_COMPONENTS) set(FreeRTOS_FIND_COMPONENTS ${FreeRTOS_PORTS}) @@ -125,7 +127,7 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) endforeach() foreach(PORT ${FreeRTOS_FIND_COMPONENTS_PORTS}) - if(${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + if(${PORT} IN_LIST FreeRTOS_armv8_trustZone_PORTS) set(ARMv8_NON_SECURE "::NON_SECURE") endif() @@ -161,11 +163,11 @@ macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) message(trace "FindFreeRTOS: creating target ${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE}") # armv8-m needs additional file even if using "No Trust Zone" port - if(${PORT} STREQUAL ARM_CM23_NTZ OR ${PORT} STREQUAL ARM_CM33_NTZ OR ${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + if(${PORT} IN_LIST FreeRTOS_armv8_PORTS) target_sources(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}/portasm.c") endif() - if(${PORT} STREQUAL ARM_CM23 OR ${PORT} STREQUAL ARM_CM33) + if(${PORT} IN_LIST FreeRTOS_armv8_trustZone_PORTS) # create the secure target add_library(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE IMPORTED) # ::SECURE doesn't link FreeRTOS like ::NON_SECURE does From f79b606c26dbc201bf823ee2a2cc9c661fcc3d2e Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Wed, 29 Sep 2021 07:39:58 +0200 Subject: [PATCH 012/119] add missing supported board --- examples/freertos/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index fc7b6dc5..2bbd7481 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -34,7 +34,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) # stm32_print_devices_by_family(FAMILY H7) # stm32_print_devices_by_family(FAMILY F4) -set(SUPPORTED_BOARDS F407VG H743ZI) +set(SUPPORTED_BOARDS F407VG H743ZI L552ZE) option(FREERTOS_F407VG_EXAMPLE "Compile FreeRTOS example for the F407VG board" OFF) option(FREERTOS_H743ZI_EXAMPLE "Compile FreeRTOS example for the H743ZI board" OFF) option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the L552ZE board" OFF) @@ -217,4 +217,4 @@ if(FREERTOS_L552ZE_EXAMPLE) stm32_print_size_of_target(${TARGET_NAME}) stm32_generate_binary_file(${TARGET_NAME}) stm32_generate_hex_file(${TARGET_NAME}) -endif() \ No newline at end of file +endif() From 5c93163878f449d2e724107d0bb93b6418d2eeb6 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Sat, 29 Jan 2022 11:19:00 +0100 Subject: [PATCH 013/119] fix the STM32_TOOLCHAIN_PATH not taken into account from env vars --- cmake/stm32/common.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index c696f343..13a771de 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -18,15 +18,16 @@ if(NOT STM32_TOOLCHAIN_PATH) message(STATUS "Detected toolchain path STM32_TOOLCHAIN_PATH in environmental variables: ") message(STATUS "$ENV{STM32_TOOLCHAIN_PATH}") set(STM32_TOOLCHAIN_PATH $ENV{STM32_TOOLCHAIN_PATH}) - endif() - if(NOT CMAKE_C_COMPILER) - set(STM32_TOOLCHAIN_PATH "/usr") - message(STATUS "No STM32_TOOLCHAIN_PATH specified, using default: " ${STM32_TOOLCHAIN_PATH}) else() - # keep only directory of compiler - get_filename_component(STM32_TOOLCHAIN_PATH ${CMAKE_C_COMPILER} DIRECTORY) - # remove the last /bin directory - get_filename_component(STM32_TOOLCHAIN_PATH ${STM32_TOOLCHAIN_PATH} DIRECTORY) + if(NOT CMAKE_C_COMPILER) + set(STM32_TOOLCHAIN_PATH "/usr") + message(STATUS "No STM32_TOOLCHAIN_PATH specified, using default: " ${STM32_TOOLCHAIN_PATH}) + else() + # keep only directory of compiler + get_filename_component(STM32_TOOLCHAIN_PATH ${CMAKE_C_COMPILER} DIRECTORY) + # remove the last /bin directory + get_filename_component(STM32_TOOLCHAIN_PATH ${STM32_TOOLCHAIN_PATH} DIRECTORY) + endif() endif() file(TO_CMAKE_PATH "${STM32_TOOLCHAIN_PATH}" STM32_TOOLCHAIN_PATH) endif() From e9098ab3566b82db05630543df20351ba5553647 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Thu, 27 Jan 2022 12:25:51 +0100 Subject: [PATCH 014/119] Integrated changes from faramax/mp1 --- .github/workflows/cmake.yml | 2 +- cmake/FindBSP.cmake | 2 +- cmake/FindCMSIS.cmake | 4 ++-- cmake/FindHAL.cmake | 18 ++++++++++++++++-- cmake/stm32/common.cmake | 12 ++++++++---- cmake/stm32/devices.cmake | 6 ++++++ cmake/stm32/mp1.cmake | 26 ++++++++++++++++++++++++++ 7 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 cmake/stm32/mp1.cmake diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c5fe5f31..51deb665 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - family: [F0, F1, F2, F3, F4, F7, G0, G4, H7, L0, L1, L4, L5, U5, WB, WL] + family: [F0, F1, F2, F3, F4, F7, G0, G4, H7, L0, L1, L4, L5, U5, WB, WL, MP1] fail-fast: false steps: diff --git a/cmake/FindBSP.cmake b/cmake/FindBSP.cmake index 45dabb2e..0392c146 100644 --- a/cmake/FindBSP.cmake +++ b/cmake/FindBSP.cmake @@ -288,7 +288,7 @@ foreach(COMP ${BSP_FIND_COMPONENTS}) string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(NOT CMAKE_MATCH_1) message(FATAL_ERROR "Unknown BSP component: ${COMP}") endif() diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index ce4ff82b..a0711bbd 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -38,7 +38,7 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS}) endif() # Component is not RTOS component, so check whether it is a family component - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) if(CMAKE_MATCH_1) list(APPEND CMSIS_FIND_COMPONENTS_FAMILIES ${COMP}) endif() @@ -96,7 +96,7 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) # CMAKE_MATCH_ contains n'th subexpression # CMAKE_MATCH_0 contains full match diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 04e3cbf0..5db0e3f7 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -173,6 +173,20 @@ set(HAL_LL_DRIVERS_L5 rng rtc sdmmc spi tim ucpd usart usb utils ) +set(HAL_DRIVERS_MP1 + adc cec cortex crc cryp dac dcmi dfsdm dma exti fdcan gpio hash hsem i2c + ipcc lptim mdios mdma pwr qspi rcc rng rtc sai sd smartcard smbus spdifrx + spi sram tim uart usart wwdg +) +set(HAL_EX_DRIVERS_MP1 + adc crc cryp dac dfsdm dma hash i2c pwr rcc rtc sai sd smartcard spi tim + uart usart +) +set(HAL_LL_DRIVERS_MP1 + adc delayblock dma exti fmc gpio i2c lptim pwr rcc rtc sdmmc spi tim usart + utils +) + set(HAL_DRIVERS_U5 adc comp cordic cortex crc cryp dac dcache dcmi dma dma2d exti fdcan flash fmac gpio gtzc hash hcd i2c icache irda iwdg lptim mdf mmc nand nor opamp ospi otfdec pcd pka pssi pwr ramcfg rcc @@ -226,7 +240,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS}) string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(CMAKE_MATCH_1) list(APPEND HAL_FIND_COMPONENTS_FAMILIES ${COMP}) message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_FAMILIES") @@ -283,7 +297,7 @@ message(STATUS "Search for HAL LL drivers: ${HAL_FIND_COMPONENTS_DRIVERS_LL}") foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(CMAKE_MATCH_3) set(CORE ${CMAKE_MATCH_3}) set(CORE_C "::${CORE}") diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index c696f343..9888537a 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -4,11 +4,12 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5 STM32U5 - STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS ) + STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS + STM32MP1 ) foreach(FAMILY ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) # append short names (F0, F1, H7_M4, ...) to STM32_SUPPORTED_FAMILIES_SHORT_NAME - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])_?(M0PLUS|M4|M7)?" FAMILY ${FAMILY}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])_?(M0PLUS|M4|M7)?" FAMILY ${FAMILY}) list(APPEND STM32_SUPPORTED_FAMILIES_SHORT_NAME ${CMAKE_MATCH_1}) endforeach() list(REMOVE_DUPLICATES STM32_SUPPORTED_FAMILIES_SHORT_NAME) @@ -113,7 +114,7 @@ function(stm32_get_chip_info CHIP) string(TOUPPER ${CHIP} CHIP) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP}) if((NOT CMAKE_MATCH_1) OR (NOT CMAKE_MATCH_2)) message(FATAL_ERROR "Unknown chip ${CHIP}") @@ -195,7 +196,7 @@ function(stm32_get_memory_info) stm32_get_chip_type(${INFO_FAMILY} ${INFO_DEVICE} INFO_TYPE) endif() - string(REGEX REPLACE "^[FGHLUW][0-9BL][0-9A-Z][0-9M].([3468BCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE}) + string(REGEX REPLACE "^[FGHLMUW]P?[0-9BL][0-9A-Z][0-9M].([3468ABCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE}) if(SIZE_CODE STREQUAL "3") set(FLASH "8K") @@ -205,6 +206,8 @@ function(stm32_get_memory_info) set(FLASH "32K") elseif(SIZE_CODE STREQUAL "8") set(FLASH "64K") + elseif(SIZE_CODE STREQUAL "A") + set(FLASH "0K") elseif(SIZE_CODE STREQUAL "B") set(FLASH "128K") elseif(SIZE_CODE STREQUAL "C") @@ -361,3 +364,4 @@ include(stm32/l5) include(stm32/u5) include(stm32/wb) include(stm32/wl) +include(stm32/mp1) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index 10ebf7b4..c0dcad63 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1097,10 +1097,16 @@ set(STM32_ALL_DEVICES L562ZE MP151A MP151C + MP151D + MP151F MP153A MP153C + MP153D + MP153F MP157A MP157C + MP157D + MP157F U575CG U575CI U585CI diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake new file mode 100644 index 00000000..3695ab2f --- /dev/null +++ b/cmake/stm32/mp1.cmake @@ -0,0 +1,26 @@ +set(STM32_MP1_TYPES + MP151Axx MP151Cxx MP151Dxx MP151Fxx + MP153Axx MP153Cxx MP153Dxx MP153Fxx + MP157Axx MP157Cxx MP157Dxx MP157Fxx) + +set(STM32_MP1_TYPE_MATCH + "MP151AA." "MP151CA." "MP151DA." "MP151FA." + "MP153AA." "MP153CA." "MP153DA." "MP153FA." + "MP157AA." "MP157CA." "MP157DA." "MP157FA.") + +set(STM32_MP1_RAM_SIZES + 384K 384K 384K 384K + 384K 384K 384K 384K + 384K 384K 384K 384K) + +set(STM32_MP1_CCRAM_SIZES + 0K 0K 0K 0K + 0K 0K 0K 0K + 0K 0K 0K 0K) + +stm32_util_create_family_targets(MP1 M4) + +target_compile_options(STM32::MP1 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) +target_link_options(STM32::MP1 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) +target_compile_definitions(STM32::MP1 INTERFACE -DCORE_CM4) + From c025c5981207e3b9e852d4fb785a1226ee4e5f06 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Fri, 4 Feb 2022 16:22:41 +0100 Subject: [PATCH 015/119] Added support for fetching MP1 CMSIS and HAL --- cmake/FindCMSIS.cmake | 15 ++++- cmake/FindHAL.cmake | 7 ++- cmake/stm32/common.cmake | 6 +- cmake/stm32/devices.cmake | 24 ++++---- cmake/stm32/mp1.cmake | 12 ++-- cmake/stm32/utilities.cmake | 115 +++++++++++++++++++----------------- tests/fetch/CMakeLists.txt | 2 +- 7 files changed, 104 insertions(+), 77 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index a0711bbd..b5756b29 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -24,6 +24,11 @@ if(STM32WL IN_LIST CMSIS_FIND_COMPONENTS) list(APPEND CMSIS_FIND_COMPONENTS STM32WL_M4 STM32WL_M0PLUS) endif() +if(STM32MP1 IN_LIST CMSIS_FIND_COMPONENTS) + list(REMOVE_ITEM CMSIS_FIND_COMPONENTS STM32MP1) + list(APPEND CMSIS_FIND_COMPONENTS STM32MP1_M4) +endif() + list(REMOVE_DUPLICATES CMSIS_FIND_COMPONENTS) # This section fills the RTOS or family components list @@ -218,9 +223,17 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) stm32_get_chip_type(${FAMILY} ${DEVICE} TYPE) string(TOLOWER ${DEVICE} DEVICE_L) string(TOLOWER ${TYPE} TYPE_L) + + set(STARTUP_NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s) + if(${FAMILY} STREQUAL "MP1") + # There are stm32mp15?axx.s and stm32mp15?cxx.s files but no stm32mp15?dxx.s nor stm32mp15?fxx.s. No idea why. + # I think that stm32mp15xx.s should be compatible with all stm32mp15 devices anyway. + # This might need refinement if devices other stm32mp15 are released. + list(APPEND STARTUP_NAMES startup_stm32mp15xx.s) + endif() find_file(CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP - NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s + NAMES ${STARTUP_NAMES} PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates/gcc" NO_DEFAULT_PATH ) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 5db0e3f7..6924cbb7 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -279,6 +279,11 @@ if(STM32WL IN_LIST HAL_FIND_COMPONENTS_FAMILIES) list(APPEND HAL_FIND_COMPONENTS_FAMILIES STM32WL_M4 STM32WL_M0PLUS) endif() +if(STM32MP1 IN_LIST HAL_FIND_COMPONENTS_FAMILIES) + list(REMOVE_ITEM HAL_FIND_COMPONENTS_FAMILIES STM32MP1) + list(APPEND HAL_FIND_COMPONENTS_FAMILIES STM32MP1_M4) +endif() + list(REMOVE_DUPLICATES HAL_FIND_COMPONENTS_FAMILIES) # when no explicit driver and driver_ll is given to find_component(HAL ) @@ -310,7 +315,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) set(FAMILY ${CMAKE_MATCH_1}) string(TOLOWER ${FAMILY} FAMILY_L) - + if((NOT STM32_HAL_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH) AND (DEFINED ENV{STM32_CUBE_${FAMILY}_PATH})) set(STM32_CUBE_${FAMILY}_PATH $ENV{STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}") message(STATUS "ENV STM32_CUBE_${FAMILY}_PATH specified, using STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 9888537a..343f91be 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -5,7 +5,7 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32L0 STM32L1 STM32L4 STM32L5 STM32U5 STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS - STM32MP1 ) + STM32MP1_M4 ) foreach(FAMILY ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) # append short names (F0, F1, H7_M4, ...) to STM32_SUPPORTED_FAMILIES_SHORT_NAME @@ -160,6 +160,8 @@ function(stm32_get_cores CORES) set(${CORES} M4 PARENT_SCOPE) elseif(${ARG_FAMILY} STREQUAL "WL") set(${CORES} M4 M0PLUS PARENT_SCOPE) + elseif(${ARG_FAMILY} STREQUAL "MP1") + set(${CORES} M4 PARENT_SCOPE) else() set(${CORES} "" PARENT_SCOPE) endif() @@ -174,6 +176,8 @@ function(stm32_get_cores CORES) elseif(${ARG_FAMILY} STREQUAL "WB") # note STM32WB have an M0 core but in current state of the art it runs ST stacks and is not needed/allowed to build for customer set(CORE_LIST M4) + elseif(${ARG_FAMILY} STREQUAL "MP1") + set(CORE_LIST M4) elseif(${ARG_FAMILY} STREQUAL "WL") stm32wl_get_device_cores(${ARG_DEVICE} ${ARG_TYPE} CORE_LIST) endif() diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index c0dcad63..6ea5fd80 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1095,18 +1095,18 @@ set(STM32_ALL_DEVICES L562RE L562VE L562ZE - MP151A - MP151C - MP151D - MP151F - MP153A - MP153C - MP153D - MP153F - MP157A - MP157C - MP157D - MP157F + MP151AA + MP151CA + MP151DA + MP151FA + MP153AA + MP153CA + MP153DA + MP153FA + MP157AA + MP157CA + MP157DA + MP157FA U575CG U575CI U585CI diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 3695ab2f..83947125 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -4,9 +4,9 @@ set(STM32_MP1_TYPES MP157Axx MP157Cxx MP157Dxx MP157Fxx) set(STM32_MP1_TYPE_MATCH - "MP151AA." "MP151CA." "MP151DA." "MP151FA." - "MP153AA." "MP153CA." "MP153DA." "MP153FA." - "MP157AA." "MP157CA." "MP157DA." "MP157FA.") + "MP151AA.?" "MP151CA.?" "MP151DA.?" "MP151FA.?" + "MP153AA.?" "MP153CA.?" "MP153DA.?" "MP153FA.?" + "MP157AA.?" "MP157CA.?" "MP157DA.?" "MP157FA.?") set(STM32_MP1_RAM_SIZES 384K 384K 384K 384K @@ -20,7 +20,7 @@ set(STM32_MP1_CCRAM_SIZES stm32_util_create_family_targets(MP1 M4) -target_compile_options(STM32::MP1 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) -target_link_options(STM32::MP1 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) -target_compile_definitions(STM32::MP1 INTERFACE -DCORE_CM4) +target_compile_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) +target_link_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) +target_compile_definitions(STM32::MP1::M4 INTERFACE -DCORE_CM4) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index e27390ad..855c5fc7 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -44,10 +44,11 @@ endfunction() include(FetchContent) -set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 v1.0.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 v1.0.0 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 v1.0.0 v1.9.0 v1.1.0) +# A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository +set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) +set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) FetchContent_Declare( STM32-CMSIS @@ -69,18 +70,29 @@ foreach(FAMILY ${STM32_FETCH_FAMILIES}) GIT_TAG ${CUBE_VERSION} GIT_PROGRESS TRUE ) - FetchContent_Declare( - STM32-CMSIS-${FAMILY} - GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L}/ - GIT_TAG ${CMSIS_VERSION} - GIT_PROGRESS TRUE - ) - FetchContent_Declare( - STM32-HAL-${FAMILY} - GIT_REPOSITORY https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/ - GIT_TAG ${HAL_VERSION} - GIT_PROGRESS TRUE - ) + + if(CMSIS_VERSION STREQUAL cube) + set(STM32_USE_CMSIS_FROM_CUBE_${FAMILY} ON) + else() + FetchContent_Declare( + STM32-CMSIS-${FAMILY} + GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L}/ + GIT_TAG ${CMSIS_VERSION} + GIT_PROGRESS TRUE + ) + endif() + + if(HAL_VERSION STREQUAL cube) + set(STM32_USE_HAL_FROM_CUBE_${FAMILY} ON) + else() + FetchContent_Declare( + STM32-HAL-${FAMILY} + GIT_REPOSITORY https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/ + GIT_TAG ${HAL_VERSION} + GIT_PROGRESS TRUE + ) + endif() + math(EXPR IDX "${IDX} + 1") endforeach() @@ -94,62 +106,55 @@ function(stm32_fetch_cube) continue() endif() - FetchContent_GetProperties(${CUBE_NAME} POPULATED CUBE_POPULATED) - if(NOT CUBE_POPULATED) - set(FETCHCONTENT_QUIET FALSE) # To see progress - FetchContent_Populate(${CUBE_NAME}) - endif() - + FetchContent_MakeAvailable(${CUBE_NAME}) set(STM32_CUBE_${FAMILY}_PATH ${${CUBE_NAME_L}_SOURCE_DIR} PARENT_SCOPE) endforeach() endfunction() function(stm32_fetch_cmsis) if(NOT STM32_CMSIS_PATH) - if(NOT STM32-CMSIS_POPULATED) - set(FETCHCONTENT_QUIET FALSE) # To see progress - FetchContent_Populate(STM32-CMSIS) - endif() - + FetchContent_MakeAvailable(STM32-CMSIS) set(STM32_CMSIS_PATH ${stm32-cmsis_SOURCE_DIR} PARENT_SCOPE) else() message(INFO "STM32_CMSIS_PATH specified, skipping fetch for STM32-CMSIS") endif() + foreach(FAMILY ${ARGV}) - set(CMSIS_NAME STM32-CMSIS-${FAMILY}) - string(TOLOWER ${CMSIS_NAME} CMSIS_NAME_L) - - if(STM32_CMSIS_${FAMILY}_PATH) - message(INFO "STM32_CMSIS_${FAMILY}_PATH specified, skipping fetch for ${CMSIS_NAME}") - continue() - endif() - - FetchContent_GetProperties(${CMSIS_NAME_L} POPULATED CMSIS_POPULATED) - if(NOT CMSIS_POPULATED) - set(FETCHCONTENT_QUIET FALSE) # To see progress - FetchContent_Populate(${CMSIS_NAME}) + if(STM32_USE_CMSIS_FROM_CUBE_${FAMILY}) + stm32_fetch_cube(${FAMILY}) + set(STM32_CMSIS_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx PARENT_SCOPE) + else() + set(CMSIS_NAME STM32-CMSIS-${FAMILY}) + string(TOLOWER ${CMSIS_NAME} CMSIS_NAME_L) + + if(STM32_CMSIS_${FAMILY}_PATH) + message(INFO "STM32_CMSIS_${FAMILY}_PATH specified, skipping fetch for ${CMSIS_NAME}") + continue() + endif() + + FetchContent_MakeAvailable(${CMSIS_NAME}) + set(STM32_CMSIS_${FAMILY}_PATH ${${CMSIS_NAME_L}_SOURCE_DIR} PARENT_SCOPE) endif() - - set(STM32_CMSIS_${FAMILY}_PATH ${${CMSIS_NAME_L}_SOURCE_DIR} PARENT_SCOPE) endforeach() endfunction() function(stm32_fetch_hal) foreach(FAMILY ${ARGV}) - set(HAL_NAME STM32-HAL-${FAMILY}) - string(TOLOWER ${HAL_NAME} HAL_NAME_L) - - if(STM32_HAL_${FAMILY}_PATH) - message(INFO "STM32_HAL_${FAMILY}_PATH specified, skipping fetch for ${HAL_NAME}") - continue() + if(STM32_USE_HAL_FROM_CUBE_${FAMILY}) + stm32_fetch_cube(${FAMILY}) + message("Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") + set(STM32_HAL_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver PARENT_SCOPE) + else() + set(HAL_NAME STM32-HAL-${FAMILY}) + string(TOLOWER ${HAL_NAME} HAL_NAME_L) + + if(STM32_HAL_${FAMILY}_PATH) + message(INFO "STM32_HAL_${FAMILY}_PATH specified, skipping fetch for ${HAL_NAME}") + continue() + endif() + + FetchContent_MakeAvailable(${HAL_NAME}) + set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE) endif() - - FetchContent_GetProperties(${HAL_NAME} POPULATED HAL_POPULATED) - if(NOT HAL_POPULATED) - set(FETCHCONTENT_QUIET FALSE) # To see progress - FetchContent_Populate(${HAL_NAME}) - endif() - - set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE) endforeach() endfunction() diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index f1d727fe..1ab40c51 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) + set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() project(fetch-test C ASM) From 55236cd021d1bda3462cf3f239936e1350da2bb6 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Fri, 4 Feb 2022 16:22:57 +0100 Subject: [PATCH 016/119] Added testing hal conf for MP1 --- tests/fetch/stm32mp1xx_hal_conf.h | 346 ++++++++++++++++++++++++++++++ tests/hal/stm32mp1xx_hal_conf.h | 346 ++++++++++++++++++++++++++++++ 2 files changed, 692 insertions(+) create mode 100644 tests/fetch/stm32mp1xx_hal_conf.h create mode 100644 tests/hal/stm32mp1xx_hal_conf.h diff --git a/tests/fetch/stm32mp1xx_hal_conf.h b/tests/fetch/stm32mp1xx_hal_conf.h new file mode 100644 index 00000000..228f2a05 --- /dev/null +++ b/tests/fetch/stm32mp1xx_hal_conf.h @@ -0,0 +1,346 @@ +/** + ****************************************************************************** + * @file stm32mp1xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2019 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32MP1xx_HAL_CONF_H +#define STM32MP1xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DFSDM_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HSEM_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_IPCC_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_QSPI_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPDIFRX_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_MDMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Register Callbacks selection ############################## */ +/** + * @brief This is the list of modules where register callback can be used + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0u +#define USE_HAL_CEC_REGISTER_CALLBACKS 0u +#define USE_HAL_DAC_REGISTER_CALLBACKS 0u +#define USE_HAL_I2C_REGISTER_CALLBACKS 0u +#define USE_HAL_RNG_REGISTER_CALLBACKS 0u +#define USE_HAL_SPI_REGISTER_CALLBACKS 0u +#define USE_HAL_UART_REGISTER_CALLBACKS 0u +#define USE_HAL_USART_REGISTER_CALLBACKS 0u +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u + +/* ########################## 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 (24000000U) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */ +#endif /* HSE_VALUE */ + +/** + * @brief In the following line adjust the External High Speed oscillator (HSE) Startup + * Timeout value + */ +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @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 (64000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup + * Timeout value + */ +#if !defined (HSI_STARTUP_TIMEOUT) + #define HSI_STARTUP_TIMEOUT 5000U /*!< Time out for HSI start up */ +#endif /* HSI_STARTUP_TIMEOUT */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U +#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 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 ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +/** + * @brief Time out for LSE start up value in ms. + */ +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal oscillator (CSI) default value. + * This value is the default CSI value after Reset. + */ +#if !defined (CSI_VALUE) + #define CSI_VALUE 4000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* CSI_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 12288000U /*!< 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY 1U /*!< tick interrupt priority (lowest by default) */ + /* Warning: Must be set to higher priority for HAL_Delay() */ + /* and HAL_GetTick() usage under interrupt context */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 0U +#define DATA_CACHE_ENABLE 0U + +/* ########################## Assert Selection ############################## */ +/** + * @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 + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32mp1xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED + #include "stm32mp1xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32mp1xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_HSEM_MODULE_ENABLED + #include "stm32mp1xx_hal_hsem.h" +#endif /* HAL_HSEM_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32mp1xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_MDMA_MODULE_ENABLED + #include "stm32mp1xx_hal_mdma.h" +#endif /* HAL_MDMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32mp1xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32mp1xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED + #include "stm32mp1xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32mp1xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32mp1xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32mp1xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED + #include "stm32mp1xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED + #include "stm32mp1xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED + #include "stm32mp1xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED + #include "stm32mp1xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32mp1xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IPCC_MODULE_ENABLED + #include "stm32mp1xx_hal_ipcc.h" +#endif /* HAL_IPCC_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED + #include "stm32mp1xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32mp1xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED + #include "stm32mp1xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32mp1xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32mp1xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED + #include "stm32mp1xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED + #include "stm32mp1xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32mp1xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32mp1xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED + #include "stm32mp1xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32mp1xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED + #include "stm32mp1xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32mp1xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32mp1xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32mp1xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32mp1xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t* file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32MP1xx_HAL_CONF_H */ + diff --git a/tests/hal/stm32mp1xx_hal_conf.h b/tests/hal/stm32mp1xx_hal_conf.h new file mode 100644 index 00000000..228f2a05 --- /dev/null +++ b/tests/hal/stm32mp1xx_hal_conf.h @@ -0,0 +1,346 @@ +/** + ****************************************************************************** + * @file stm32mp1xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2019 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32MP1xx_HAL_CONF_H +#define STM32MP1xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DFSDM_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HSEM_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_IPCC_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_QSPI_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPDIFRX_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_MDMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Register Callbacks selection ############################## */ +/** + * @brief This is the list of modules where register callback can be used + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0u +#define USE_HAL_CEC_REGISTER_CALLBACKS 0u +#define USE_HAL_DAC_REGISTER_CALLBACKS 0u +#define USE_HAL_I2C_REGISTER_CALLBACKS 0u +#define USE_HAL_RNG_REGISTER_CALLBACKS 0u +#define USE_HAL_SPI_REGISTER_CALLBACKS 0u +#define USE_HAL_UART_REGISTER_CALLBACKS 0u +#define USE_HAL_USART_REGISTER_CALLBACKS 0u +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u + +/* ########################## 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 (24000000U) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */ +#endif /* HSE_VALUE */ + +/** + * @brief In the following line adjust the External High Speed oscillator (HSE) Startup + * Timeout value + */ +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @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 (64000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup + * Timeout value + */ +#if !defined (HSI_STARTUP_TIMEOUT) + #define HSI_STARTUP_TIMEOUT 5000U /*!< Time out for HSI start up */ +#endif /* HSI_STARTUP_TIMEOUT */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U +#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 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 ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +/** + * @brief Time out for LSE start up value in ms. + */ +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal oscillator (CSI) default value. + * This value is the default CSI value after Reset. + */ +#if !defined (CSI_VALUE) + #define CSI_VALUE 4000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* CSI_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 12288000U /*!< 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY 1U /*!< tick interrupt priority (lowest by default) */ + /* Warning: Must be set to higher priority for HAL_Delay() */ + /* and HAL_GetTick() usage under interrupt context */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 0U +#define DATA_CACHE_ENABLE 0U + +/* ########################## Assert Selection ############################## */ +/** + * @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 + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32mp1xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED + #include "stm32mp1xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32mp1xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_HSEM_MODULE_ENABLED + #include "stm32mp1xx_hal_hsem.h" +#endif /* HAL_HSEM_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32mp1xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_MDMA_MODULE_ENABLED + #include "stm32mp1xx_hal_mdma.h" +#endif /* HAL_MDMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32mp1xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32mp1xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED + #include "stm32mp1xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32mp1xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32mp1xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32mp1xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED + #include "stm32mp1xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED + #include "stm32mp1xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED + #include "stm32mp1xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED + #include "stm32mp1xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32mp1xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IPCC_MODULE_ENABLED + #include "stm32mp1xx_hal_ipcc.h" +#endif /* HAL_IPCC_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED + #include "stm32mp1xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32mp1xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED + #include "stm32mp1xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32mp1xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32mp1xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED + #include "stm32mp1xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED + #include "stm32mp1xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32mp1xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32mp1xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED + #include "stm32mp1xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32mp1xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED + #include "stm32mp1xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32mp1xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32mp1xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32mp1xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32mp1xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t* file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32MP1xx_HAL_CONF_H */ + From 23c674c6ab8779a97031f3811969725b1196482c Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Tue, 8 Feb 2022 11:51:08 +0100 Subject: [PATCH 017/119] Added default linker script for MP1 --- cmake/FindCMSIS.cmake | 36 +++++----- cmake/stm32/mp15xx.ld | 153 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+), 15 deletions(-) create mode 100644 cmake/stm32/mp15xx.ld diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index b5756b29..c2b55704 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -77,21 +77,27 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} HEAP SIZE HEAP_SIZE) stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} STACK SIZE STACK_SIZE) - add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" - COMMAND ${CMAKE_COMMAND} - -DFLASH_ORIGIN="${FLASH_ORIGIN}" - -DRAM_ORIGIN="${RAM_ORIGIN}" - -DCCRAM_ORIGIN="${CCRAM_ORIGIN}" - -DRAM_SHARE_ORIGIN="${RAM_SHARE_ORIGIN}" - -DFLASH_SIZE="${FLASH_SIZE}" - -DRAM_SIZE="${RAM_SIZE}" - -DCCRAM_SIZE="${CCRAM_SIZE}" - -DRAM_SHARE_SIZE="${RAM_SHARE_SIZE}" - -DSTACK_SIZE="${STACK_SIZE}" - -DHEAP_SIZE="${HEAP_SIZE}" - -DLINKER_SCRIPT="${OUTPUT_LD_FILE}" - -P "${STM32_CMAKE_DIR}/stm32/linker_ld.cmake" - ) + if(${FAMILY} STREQUAL MP1) + add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" + COMMAND ${CMAKE_COMMAND} + -E copy ${CMAKE_CURRENT_LIST_DIR}/mp15xx.ld ${OUTPUT_LD_FILE}) + else() + add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" + COMMAND ${CMAKE_COMMAND} + -DFLASH_ORIGIN="${FLASH_ORIGIN}" + -DRAM_ORIGIN="${RAM_ORIGIN}" + -DCCRAM_ORIGIN="${CCRAM_ORIGIN}" + -DRAM_SHARE_ORIGIN="${RAM_SHARE_ORIGIN}" + -DFLASH_SIZE="${FLASH_SIZE}" + -DRAM_SIZE="${RAM_SIZE}" + -DCCRAM_SIZE="${CCRAM_SIZE}" + -DRAM_SHARE_SIZE="${RAM_SHARE_SIZE}" + -DSTACK_SIZE="${STACK_SIZE}" + -DHEAP_SIZE="${HEAP_SIZE}" + -DLINKER_SCRIPT="${OUTPUT_LD_FILE}" + -P "${STM32_CMAKE_DIR}/stm32/linker_ld.cmake" + ) + endif() add_custom_target(CMSIS_LD_${DEVICE}${CORE_U} DEPENDS "${OUTPUT_LD_FILE}") add_dependencies(CMSIS::STM32::${DEVICE}${CORE_C} CMSIS_LD_${DEVICE}${CORE_U}) stm32_add_linker_script(CMSIS::STM32::${DEVICE}${CORE_C} INTERFACE "${OUTPUT_LD_FILE}") diff --git a/cmake/stm32/mp15xx.ld b/cmake/stm32/mp15xx.ld new file mode 100644 index 00000000..72d87dd3 --- /dev/null +++ b/cmake/stm32/mp15xx.ld @@ -0,0 +1,153 @@ +ENTRY(Reset_Handler) + +_estack = ORIGIN(DataSRAM) + LENGTH(DataSRAM); + +_Min_Heap_Size = 0x200 ; +_Min_Stack_Size = 0x400 ; + +MEMORY +{ + RetentionRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 0x00000600 + TextSRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 128K + DataSRAM (xrw) : ORIGIN = 0x10020000, LENGTH = 128K + SharedSRAM (xrw) : ORIGIN = 0x10040000, LENGTH = 64K + DmaSRAM (xrw) : ORIGIN = 0x10050000, LENGTH = 64K +} + +__OPENAMP_region_start__ = ORIGIN(SharedSRAM); +__OPENAMP_region_end__ = ORIGIN(SharedSRAM) + LENGTH(SharedSRAM); + +SECTIONS +{ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) + . = ALIGN(4); + } >RetentionRAM + + .text : + { + . = ALIGN(4); + *(.text) + *(.text*) + *(.glue_7) + *(.glue_7t) + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; + } >TextSRAM + + .rodata : + { + . = ALIGN(4); + *(.rodata) + *(.rodata*) + . = ALIGN(4); + } >TextSRAM + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >TextSRAM + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >TextSRAM + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >TextSRAM + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >TextSRAM + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >TextSRAM + + __DATA_ROM = .; + _sidata = LOADADDR(.data); + + .data : AT(__DATA_ROM) + { + . = ALIGN(4); + _sdata = .; + *(.data) + *(.data*) + + . = ALIGN(4); + _edata = .; + } >DataSRAM + + __DATA_END = __DATA_ROM + (_edata - _sdata); + text_end = ORIGIN(TextSRAM) + LENGTH(TextSRAM); + ASSERT(__DATA_END <= text_end, "region TextSRAM overflowed with text and data") + + .resource_table : + { + . = ALIGN(4); + KEEP (*(.resource_table*)) + . = ALIGN(4); + } >DataSRAM + + . = ALIGN(4); + .bss : + { + _sbss = .; + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; + __bss_end__ = _ebss; + } >DataSRAM + + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >DataSRAM + + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} From 9961af06ce31f4ae135de1d614d2c28d43fa6a39 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Wed, 9 Feb 2022 17:22:53 +0100 Subject: [PATCH 018/119] Fixed mp15xx.ld copying --- cmake/FindCMSIS.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index c2b55704..bb37fc80 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -80,7 +80,7 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) if(${FAMILY} STREQUAL MP1) add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} - -E copy ${CMAKE_CURRENT_LIST_DIR}/mp15xx.ld ${OUTPUT_LD_FILE}) + -E copy ${STM32_CMAKE_DIR}/stm32/mp15xx.ld ${OUTPUT_LD_FILE}) else() add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} From 7f9e90991541497f3f894d64ec3625d98eb4a96e Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Wed, 9 Feb 2022 17:23:30 +0100 Subject: [PATCH 019/119] Changed message(INFO...) to message(VERBOSE...) --- cmake/stm32/utilities.cmake | 2 +- tests/cmsis/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 855c5fc7..9c8c948e 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -102,7 +102,7 @@ function(stm32_fetch_cube) string(TOLOWER ${CUBE_NAME} CUBE_NAME_L) if(STM32_CUBE_${FAMILY}_PATH) - message(INFO "STM32_CUBE_${FAMILY}_PATH specified, skipping fetch for ${CUBE_NAME}") + message(VERBOSE "STM32_CUBE_${FAMILY}_PATH specified, skipping fetch for ${CUBE_NAME}") continue() endif() diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index 0013f3d7..a62179d5 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -5,6 +5,10 @@ if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) endif() +if("MP1" IN_LIST TEST_FAMILIES) + message(WARNING "CMSIS for MP1 devices requires HAL, this test is expected to fail for the MP1 family") +endif() + project(cmsis-test C ASM) if(FETCH_ST_SOURCES) From 18555217bdbba065d9d2b22dd126e6c1accda2c3 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Thu, 10 Feb 2022 15:04:27 +0100 Subject: [PATCH 020/119] Added HAL support for MP1 --- cmake/FindHAL.cmake | 1 + cmake/stm32/mp1.cmake | 2 +- tests/hal/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 6924cbb7..40f02f1e 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -378,6 +378,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) STM32::${FAMILY}${CORE_C} CMSIS::STM32::${FAMILY}${CORE_C}) target_include_directories(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_INCLUDE}") + target_compile_definitions(HAL::STM32::${FAMILY}${CORE_C} INTERFACE USE_HAL_DRIVER) target_sources(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_SOURCE}") endif() diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 83947125..39b45dbb 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -22,5 +22,5 @@ stm32_util_create_family_targets(MP1 M4) target_compile_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) target_link_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) -target_compile_definitions(STM32::MP1::M4 INTERFACE -DCORE_CM4) +target_compile_definitions(STM32::MP1::M4 INTERFACE CORE_CM4) diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index d4592ac1..9719ae21 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -31,6 +31,7 @@ foreach(FAMILY ${TEST_FAMILIES}) endif() add_executable(hal-test-${FAMILY} ${SOURCES}) + target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_FULL_LL_DRIVER) foreach(DRIVER ${HAL_DRIVERS_${FAMILY}}) string(TOUPPER ${DRIVER} DRIVER) From 11f1d02adcf508556c823778e9da74780ea2c703 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Thu, 10 Feb 2022 16:21:51 +0100 Subject: [PATCH 021/119] Excluding CMSIS test for MP1 in actions --- .github/workflows/cmake.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 51deb665..df1b0b5c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -35,16 +35,19 @@ jobs: - name: Create build directory for tests/cmsis run: cmake -E make_directory ${{runner.workspace}}/tests/cmsis/build + if: ${{ matrix.family != 'MP1' }} - name: Configure tests/cmsis shell: bash working-directory: ${{runner.workspace}}/tests/cmsis/build run: cmake -DTEST_FAMILIES=${{ matrix.family }} -DFETCH_ST_SOURCES=TRUE $GITHUB_WORKSPACE/tests/cmsis/ + if: ${{ matrix.family != 'MP1' }} - name: Build tests/cmsis working-directory: ${{runner.workspace}}/tests/cmsis/build shell: bash run: cmake --build . --config $BUILD_TYPE + if: ${{ matrix.family != 'MP1' }} - name: Create build directory for tests/hal run: cmake -E make_directory ${{runner.workspace}}/tests/hal/build From e07a8a4fc151d050b37b141c96e954a5376113db Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 12:57:31 +0100 Subject: [PATCH 022/119] Fixed regices in FindFreeRTOS.cmake --- cmake/FindFreeRTOS.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index ba75614d..a7dbe25b 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -44,7 +44,7 @@ endif() # This section fills the family and ports components list foreach(COMP ${FreeRTOS_FIND_COMPONENTS}) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP}) # Valid family component, so add it (e.g. STM32H7) if(CMAKE_MATCH_1) list(APPEND FreeRTOS_FIND_COMPONENTS_FAMILIES ${FAMILY_COMP}) @@ -207,7 +207,7 @@ else() string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLUW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) if((NOT CMAKE_MATCH_1) AND (NOT CMAKE_MATCH_2)) message(FATAL_ERROR "Unknown FreeRTOS component: ${COMP}") From 43c3f1719a68841914f21e2f5b5802515ad65241 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 13:16:58 +0100 Subject: [PATCH 023/119] Fixed startup script selection --- cmake/FindCMSIS.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index bb37fc80..a7c30a87 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -232,10 +232,10 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) set(STARTUP_NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s) if(${FAMILY} STREQUAL "MP1") - # There are stm32mp15?axx.s and stm32mp15?cxx.s files but no stm32mp15?dxx.s nor stm32mp15?fxx.s. No idea why. - # I think that stm32mp15xx.s should be compatible with all stm32mp15 devices anyway. - # This might need refinement if devices other stm32mp15 are released. - list(APPEND STARTUP_NAMES startup_stm32mp15xx.s) + # stm32mp15?dxx.s uses stm32mp15?axx.s + # stm32mp15?fxx.s uses stm32mp15?cxx.s + string(REPLACE "dxx" "axx" STARTUP_NAMES ${STARTUP_NAMES}) + string(REPLACE "fxx" "cxx" STARTUP_NAMES ${STARTUP_NAMES}) endif() find_file(CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP From b5081b5f238eea8270c1c5cfc6d2aee91cc6d565 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 13:22:20 +0100 Subject: [PATCH 024/119] Linker script now taken from CMSIS --- cmake/FindCMSIS.cmake | 8 ++- cmake/stm32/mp15xx.ld | 153 ------------------------------------------ 2 files changed, 7 insertions(+), 154 deletions(-) delete mode 100644 cmake/stm32/mp15xx.ld diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index a7c30a87..9db28cc0 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -78,9 +78,15 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} STACK SIZE STACK_SIZE) if(${FAMILY} STREQUAL MP1) + string(TOLOWER ${FAMILY} FAMILY_L) + find_file(CMSIS_${FAMILY}${CORE_U}_LD_SCRIPT + NAMES stm32mp15xx_m4.ld + PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates/gcc/linker" + NO_DEFAULT_PATH + ) add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} - -E copy ${STM32_CMAKE_DIR}/stm32/mp15xx.ld ${OUTPUT_LD_FILE}) + -E copy ${CMSIS_${FAMILY}${CORE_U}_LD_SCRIPT} ${OUTPUT_LD_FILE}) else() add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} diff --git a/cmake/stm32/mp15xx.ld b/cmake/stm32/mp15xx.ld deleted file mode 100644 index 72d87dd3..00000000 --- a/cmake/stm32/mp15xx.ld +++ /dev/null @@ -1,153 +0,0 @@ -ENTRY(Reset_Handler) - -_estack = ORIGIN(DataSRAM) + LENGTH(DataSRAM); - -_Min_Heap_Size = 0x200 ; -_Min_Stack_Size = 0x400 ; - -MEMORY -{ - RetentionRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 0x00000600 - TextSRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 128K - DataSRAM (xrw) : ORIGIN = 0x10020000, LENGTH = 128K - SharedSRAM (xrw) : ORIGIN = 0x10040000, LENGTH = 64K - DmaSRAM (xrw) : ORIGIN = 0x10050000, LENGTH = 64K -} - -__OPENAMP_region_start__ = ORIGIN(SharedSRAM); -__OPENAMP_region_end__ = ORIGIN(SharedSRAM) + LENGTH(SharedSRAM); - -SECTIONS -{ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) - . = ALIGN(4); - } >RetentionRAM - - .text : - { - . = ALIGN(4); - *(.text) - *(.text*) - *(.glue_7) - *(.glue_7t) - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; - } >TextSRAM - - .rodata : - { - . = ALIGN(4); - *(.rodata) - *(.rodata*) - . = ALIGN(4); - } >TextSRAM - - .ARM.extab : { - . = ALIGN(4); - *(.ARM.extab* .gnu.linkonce.armextab.*) - . = ALIGN(4); - } >TextSRAM - - .ARM : { - . = ALIGN(4); - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - . = ALIGN(4); - } >TextSRAM - - .preinit_array : - { - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - } >TextSRAM - - .init_array : - { - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - } >TextSRAM - - .fini_array : - { - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - } >TextSRAM - - __DATA_ROM = .; - _sidata = LOADADDR(.data); - - .data : AT(__DATA_ROM) - { - . = ALIGN(4); - _sdata = .; - *(.data) - *(.data*) - - . = ALIGN(4); - _edata = .; - } >DataSRAM - - __DATA_END = __DATA_ROM + (_edata - _sdata); - text_end = ORIGIN(TextSRAM) + LENGTH(TextSRAM); - ASSERT(__DATA_END <= text_end, "region TextSRAM overflowed with text and data") - - .resource_table : - { - . = ALIGN(4); - KEEP (*(.resource_table*)) - . = ALIGN(4); - } >DataSRAM - - . = ALIGN(4); - .bss : - { - _sbss = .; - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; - __bss_end__ = _ebss; - } >DataSRAM - - ._user_heap_stack : - { - . = ALIGN(8); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(8); - } >DataSRAM - - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} From 05dd74cede8cc51eb69aa3f74c51cc0201967cfd Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 19 Feb 2022 13:22:07 +0100 Subject: [PATCH 025/119] Duplicated blinky.c file to blinky.cpp file --- examples/blinky/blinky.cpp | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 examples/blinky/blinky.cpp diff --git a/examples/blinky/blinky.cpp b/examples/blinky/blinky.cpp new file mode 100644 index 00000000..0cc1ff6d --- /dev/null +++ b/examples/blinky/blinky.cpp @@ -0,0 +1,62 @@ +#if defined STM32L0 + #include + + // STM32L0538-Discovery green led - PB4 + #define LED_PORT GPIOB + #define LED_PIN GPIO_PIN_4 + #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE +#elif defined STM32F1 + #include + + // STM32VL-Discovery green led - PC9 + #define LED_PORT GPIOC + #define LED_PIN GPIO_PIN_9 + #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE +#elif defined STM32F4 + #include + + // STM32F4-Discovery green led - PD12 + #define LED_PORT GPIOD + #define LED_PIN GPIO_PIN_12 + #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE +#endif + +//This prevent name mangling for functions used in C/assembly files. +extern "C" +{ + void SysTick_Handler(void) + { + HAL_IncTick(); + + // 1 Hz blinking + if ((HAL_GetTick() % 500) == 0) + HAL_GPIO_TogglePin(LED_PORT, LED_PIN); + } +} + +void initGPIO() +{ + GPIO_InitTypeDef GPIO_Config; + + GPIO_Config.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_Config.Pull = GPIO_NOPULL; + GPIO_Config.Speed = GPIO_SPEED_FREQ_HIGH; + + GPIO_Config.Pin = LED_PIN; + + LED_PORT_CLK_ENABLE(); + HAL_GPIO_Init(LED_PORT, &GPIO_Config); +} + +int main(void) +{ + HAL_Init(); + initGPIO(); + // 1kHz ticks + HAL_SYSTICK_Config(SystemCoreClock / 1000); + + for (;;) + __WFI(); + + return 0; +} From 4c46794657fafec72893b2408b302c418a6f75d8 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 19 Feb 2022 13:22:47 +0100 Subject: [PATCH 026/119] Changed blinky cmakelist to handle cpp compilation --- examples/blinky/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/blinky/CMakeLists.txt b/examples/blinky/CMakeLists.txt index 51191d33..2713e527 100644 --- a/examples/blinky/CMakeLists.txt +++ b/examples/blinky/CMakeLists.txt @@ -1,7 +1,15 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) -project(stm32-blinky C ASM) +option(USE_CPP_FILE "Use the blink.cpp file instead of the blink.c" OFF) + +if(USE_CPP_FILE) + project(stm32-blinky C CXX ASM) + set(MAIN_SOURCE_FILE blinky.cpp) +else() + project(stm32-blinky C ASM) + set(MAIN_SOURCE_FILE blinky.c) +endif() set(CMAKE_INCLUDE_CURRENT_DIR TRUE) # Configure here which STM32 target(s) to build @@ -41,7 +49,7 @@ find_package(HAL COMPONENTS "${HAL_COMP_LIST}" REQUIRED) # STM32F4-Discovery if(BLINKY_F4_EXAMPLE) - add_executable(stm32-blinky-f4 blinky.c stm32f4xx_hal_conf.h) + add_executable(stm32-blinky-f4 ${MAIN_SOURCE_FILE} stm32f4xx_hal_conf.h) target_link_libraries(stm32-blinky-f4 HAL::STM32::F4::RCC HAL::STM32::F4::GPIO @@ -54,7 +62,7 @@ endif() # STM32VL-Discovery if(BLINKY_F1_EXAMPLE) - add_executable(stm32-blinky-f1 blinky.c stm32f1xx_hal_conf.h) + add_executable(stm32-blinky-f1 ${MAIN_SOURCE_FILE} stm32f1xx_hal_conf.h) target_link_libraries(stm32-blinky-f1 HAL::STM32::F1::RCC HAL::STM32::F1::GPIO @@ -67,7 +75,7 @@ endif() # STM32L0538-Discovery if(BLINKY_L0_EXAMPLE) - add_executable(stm32-blinky-l0 blinky.c stm32l0xx_hal_conf.h) + add_executable(stm32-blinky-l0 ${MAIN_SOURCE_FILE} stm32l0xx_hal_conf.h) target_link_libraries(stm32-blinky-l0 HAL::STM32::L0::RCC HAL::STM32::L0::GPIO From 27585dfdf4706156c8a12a6123df8965dd06e529 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 19 Feb 2022 13:29:44 +0100 Subject: [PATCH 027/119] blinky cmakelist options are now at the top of the file --- examples/blinky/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/blinky/CMakeLists.txt b/examples/blinky/CMakeLists.txt index 2713e527..2924c91a 100644 --- a/examples/blinky/CMakeLists.txt +++ b/examples/blinky/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) -option(USE_CPP_FILE "Use the blink.cpp file instead of the blink.c" OFF) +# Configure here which STM32 target(s) to build +option(BLINKY_F4_EXAMPLE "Compile F4 example" ON) +option(BLINKY_F1_EXAMPLE "Compile F1 example" OFF) +option(BLINKY_L0_EXAMPLE "Compile L0 example" OFF) + +option(USE_CPP_FILE "Use the .cpp example file instead of the .c one" OFF) if(USE_CPP_FILE) project(stm32-blinky C CXX ASM) @@ -10,12 +15,9 @@ else() project(stm32-blinky C ASM) set(MAIN_SOURCE_FILE blinky.c) endif() + set(CMAKE_INCLUDE_CURRENT_DIR TRUE) -# Configure here which STM32 target(s) to build -option(BLINKY_F4_EXAMPLE "Compile F4 example" ON) -option(BLINKY_F1_EXAMPLE "Compile F1 example" OFF) -option(BLINKY_L0_EXAMPLE "Compile L0 example" OFF) set(HAL_COMP_LIST RCC GPIO CORTEX) set(CMSIS_COMP_LIST "") From a9b83944d70ac0c9b7bf91e254f29d1f61d1e818 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 19 Feb 2022 13:30:17 +0100 Subject: [PATCH 028/119] Added documentation on USE_CPP_FILE option for blinky example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fce8af7..1f9aed1e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports F0 F1 F2 F3 * `blinky` ([examples/blinky](examples/blinky)) - blink led using STM32 HAL library and SysTick. It will compile a project for the `F4` family by default, but you can also compile for the `L0` and `F1` family by passing `BLINKY_L0_EXAMPLE=ON` or `BLINKY_F1_EXAMPLE=ON` to the CMake - generation call. + generation call. Using C++ instead of C is possible using `USE_CPP_FILE=ON`. * `freertos` ([examples/freertos](examples/freertos)) - blink led using STM32 HAL library and FreeRTOS. You need to specify at least one board by passing `FREERTOS__EXAMPLE=ON` to CMake. Currently, the example can be built for the `H743ZI` and `F407VG` board targets. From 6c033fe1c94c84846b9a65aba17df410125fce80 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 14:23:23 +0100 Subject: [PATCH 029/119] Fixed status message in utilies.cmake --- cmake/stm32/utilities.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 9c8c948e..ce05bdbd 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -122,6 +122,7 @@ function(stm32_fetch_cmsis) foreach(FAMILY ${ARGV}) if(STM32_USE_CMSIS_FROM_CUBE_${FAMILY}) stm32_fetch_cube(${FAMILY}) + message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") set(STM32_CMSIS_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx PARENT_SCOPE) else() set(CMSIS_NAME STM32-CMSIS-${FAMILY}) @@ -142,7 +143,7 @@ function(stm32_fetch_hal) foreach(FAMILY ${ARGV}) if(STM32_USE_HAL_FROM_CUBE_${FAMILY}) stm32_fetch_cube(${FAMILY}) - message("Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") + message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") set(STM32_HAL_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver PARENT_SCOPE) else() set(HAL_NAME STM32-HAL-${FAMILY}) From 1706c0aa3b50b01b26450ed7e98de0c8853941e7 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 14:23:35 +0100 Subject: [PATCH 030/119] Added mp1 to default tested families --- tests/bsp/CMakeLists.txt | 2 +- tests/hal/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bsp/CMakeLists.txt b/tests/bsp/CMakeLists.txt index d2aa7e01..b2aabf59 100644 --- a/tests/bsp/CMakeLists.txt +++ b/tests/bsp/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) + set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() # Nucleo boards can have different devices on it diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index 9719ae21..a505470d 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) + set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() project(hal-test C ASM) From 1f6640225bab3a70ca0fe1515b63a511f1e1ad32 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Sat, 19 Feb 2022 14:29:26 +0100 Subject: [PATCH 031/119] Moved stm32_get_memory_info in cmsis_generate_default_linker_script --- cmake/FindCMSIS.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index 9db28cc0..4e3cdcdc 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -70,13 +70,6 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) set(OUTPUT_LD_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DEVICE}${CORE_U}.ld") - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} FLASH SIZE FLASH_SIZE ORIGIN FLASH_ORIGIN) - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM SIZE RAM_SIZE ORIGIN RAM_ORIGIN) - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} CCRAM SIZE CCRAM_SIZE ORIGIN CCRAM_ORIGIN) - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM_SHARE SIZE RAM_SHARE_SIZE ORIGIN RAM_SHARE_ORIGIN) - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} HEAP SIZE HEAP_SIZE) - stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} STACK SIZE STACK_SIZE) - if(${FAMILY} STREQUAL MP1) string(TOLOWER ${FAMILY} FAMILY_L) find_file(CMSIS_${FAMILY}${CORE_U}_LD_SCRIPT @@ -87,7 +80,14 @@ function(cmsis_generate_default_linker_script FAMILY DEVICE CORE) add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} -E copy ${CMSIS_${FAMILY}${CORE_U}_LD_SCRIPT} ${OUTPUT_LD_FILE}) - else() + else() + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} FLASH SIZE FLASH_SIZE ORIGIN FLASH_ORIGIN) + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM SIZE RAM_SIZE ORIGIN RAM_ORIGIN) + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} CCRAM SIZE CCRAM_SIZE ORIGIN CCRAM_ORIGIN) + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM_SHARE SIZE RAM_SHARE_SIZE ORIGIN RAM_SHARE_ORIGIN) + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} HEAP SIZE HEAP_SIZE) + stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} STACK SIZE STACK_SIZE) + add_custom_command(OUTPUT "${OUTPUT_LD_FILE}" COMMAND ${CMAKE_COMMAND} -DFLASH_ORIGIN="${FLASH_ORIGIN}" From d66ce1a63e412a24ef0c1e9fa245a9c7cfff2dbb Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 19 Feb 2022 14:48:34 +0100 Subject: [PATCH 032/119] blinky: Adding missing braquets on if --- examples/blinky/blinky.c | 2 ++ examples/blinky/blinky.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/blinky/blinky.c b/examples/blinky/blinky.c index 8e108603..8b6bd303 100644 --- a/examples/blinky/blinky.c +++ b/examples/blinky/blinky.c @@ -27,7 +27,9 @@ void SysTick_Handler(void) // 1 Hz blinking if ((HAL_GetTick() % 500) == 0) + { HAL_GPIO_TogglePin(LED_PORT, LED_PIN); + } } void initGPIO() diff --git a/examples/blinky/blinky.cpp b/examples/blinky/blinky.cpp index 0cc1ff6d..a5bf69f9 100644 --- a/examples/blinky/blinky.cpp +++ b/examples/blinky/blinky.cpp @@ -30,7 +30,9 @@ extern "C" // 1 Hz blinking if ((HAL_GetTick() % 500) == 0) + { HAL_GPIO_TogglePin(LED_PORT, LED_PIN); + } } } From 9a412c7e9f1af5ca1c41e0c4b26b035f75fe44ba Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Mon, 21 Feb 2022 15:31:27 +0100 Subject: [PATCH 033/119] Fixed MP1 device types --- cmake/FindCMSIS.cmake | 11 ++--------- cmake/stm32/mp1.cmake | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index 4e3cdcdc..f0a0efb7 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -236,16 +236,9 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) string(TOLOWER ${DEVICE} DEVICE_L) string(TOLOWER ${TYPE} TYPE_L) - set(STARTUP_NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s) - if(${FAMILY} STREQUAL "MP1") - # stm32mp15?dxx.s uses stm32mp15?axx.s - # stm32mp15?fxx.s uses stm32mp15?cxx.s - string(REPLACE "dxx" "axx" STARTUP_NAMES ${STARTUP_NAMES}) - string(REPLACE "fxx" "cxx" STARTUP_NAMES ${STARTUP_NAMES}) - endif() - find_file(CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP - NAMES ${STARTUP_NAMES} + NAMES startup_stm32${TYPE_L}.s + startup_stm32${TYPE_L}${CORE_Ucm}.s PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates/gcc" NO_DEFAULT_PATH ) diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 39b45dbb..2461e889 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -1,22 +1,22 @@ set(STM32_MP1_TYPES - MP151Axx MP151Cxx MP151Dxx MP151Fxx - MP153Axx MP153Cxx MP153Dxx MP153Fxx - MP157Axx MP157Cxx MP157Dxx MP157Fxx) + MP151Axx MP151Cxx + MP153Axx MP153Cxx + MP157Axx MP157Cxx) set(STM32_MP1_TYPE_MATCH - "MP151AA.?" "MP151CA.?" "MP151DA.?" "MP151FA.?" - "MP153AA.?" "MP153CA.?" "MP153DA.?" "MP153FA.?" - "MP157AA.?" "MP157CA.?" "MP157DA.?" "MP157FA.?") + "MP151[AD]A.?" "MP151[CF]A.?" + "MP153[AD]A.?" "MP153[CF]A.?" + "MP157[AD]A.?" "MP157[CF]A.?") set(STM32_MP1_RAM_SIZES - 384K 384K 384K 384K - 384K 384K 384K 384K - 384K 384K 384K 384K) + 384K 384K + 384K 384K + 384K 384K) set(STM32_MP1_CCRAM_SIZES - 0K 0K 0K 0K - 0K 0K 0K 0K - 0K 0K 0K 0K) + 0K 0K + 0K 0K + 0K 0K) stm32_util_create_family_targets(MP1 M4) From 63d3eab2adaa75384d74b36e1884a8a8359a94a2 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Mon, 21 Feb 2022 16:09:33 +0100 Subject: [PATCH 034/119] Added MP1 BSPs --- cmake/FindBSP.cmake | 24 ++++++++++++++++-------- tests/bsp/CMakeLists.txt | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cmake/FindBSP.cmake b/cmake/FindBSP.cmake index 0392c146..7fac5705 100644 --- a/cmake/FindBSP.cmake +++ b/cmake/FindBSP.cmake @@ -245,6 +245,13 @@ set(BSP_L5_SOURCES_STM32L552E_EVAL audio bus idd io lcd ospi sd sram ts usbpd_pw set(BSP_L5_DEVICE_STM32L562E_Discovery L562QE) set(BSP_L5_DEVICE_STM32L552E_EVAL L552ZE) +### MP1 ### +set(BSP_MP1_BOARDS + STM32MP15xx_DISCO STM32MP15xx_EVAL) +set(BSP_MP1_COMPONENTS ) +set(BSP_MP1_SOURCES_STM32MP15xx_DISCO bus stpmic1) +set(BSP_MP1_SOURCES_STM32MP15xx_EVAL bus stpmic1) + ### WB ### set(BSP_WB_BOARDS STM32WB15CC_Nucleo STM32WB55_Nucleo STM32WB55_USBDongle STM32WB5MM_Discovery @@ -282,6 +289,11 @@ if(STM32WL IN_LIST BSP_FIND_COMPONENTS) list(APPEND BSP_FIND_COMPONENTS STM32WL_M4 STM32WL_M0PLUS) endif() +if(STM32MP1 IN_LIST BSP_FIND_COMPONENTS) + list(REMOVE_ITEM BSP_FIND_COMPONENTS STM32MP1) + list(APPEND BSP_FIND_COMPONENTS STM32MP1_M4) +endif() + list(REMOVE_DUPLICATES BSP_FIND_COMPONENTS) foreach(COMP ${BSP_FIND_COMPONENTS}) @@ -315,13 +327,9 @@ foreach(COMP ${BSP_FIND_COMPONENTS}) set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified using default: ${STM32_CUBE_${FAMILY}_PATH}") endif() - - find_path(BSP_${FAMILY}_PATH - NAMES Components/Common/io.h - PATHS "${STM32_CUBE_${FAMILY}_PATH}/Drivers/BSP" - NO_DEFAULT_PATH - ) - if (NOT BSP_${FAMILY}_PATH) + + set(BSP_${FAMILY}_PATH "${STM32_CUBE_${FAMILY}_PATH}/Drivers/BSP") + if(NOT EXISTS ${BSP_${FAMILY}_PATH}) continue() endif() @@ -346,7 +354,7 @@ foreach(COMP ${BSP_FIND_COMPONENTS}) PATHS "${BSP_${FAMILY}_PATH}/${BOARD}" "${BSP_${FAMILY}_PATH}/${BSP_${FAMILY}_DIR_${BOARD_CANONICAL}}" NO_DEFAULT_PATH ) - if (NOT BSP_${BOARD_CANONICAL}_PATH) + if (NOT EXISTS ${BSP_${BOARD_CANONICAL}_PATH}) continue() endif() diff --git a/tests/bsp/CMakeLists.txt b/tests/bsp/CMakeLists.txt index b2aabf59..f68fe9e1 100644 --- a/tests/bsp/CMakeLists.txt +++ b/tests/bsp/CMakeLists.txt @@ -25,6 +25,8 @@ set(DEVICE_STM32L1xx_Nucleo L152RE) set(DEVICE_STM32L4xx_Nucleo L412RB) set(DEVICE_STM32L4xx_Nucleo_32 L412KB) set(DEVICE_STM32L4xx_Nucleo_144 L496ZG) +set(DEVICE_STM32MP15xx_DISCO MP157CAC) +set(DEVICE_STM32MP15xx_EVAL MP157FAA) set(DEFINES_STM32469I_EVAL USE_IOEXPANDER) set(DEFINES_STM32F769I_EVAL USE_IOEXPANDER) set(DEFINES_STM32L476G_EVAL USE_IOEXPANDER) From 86bd4b88af0cc037df83a53c74da9be00d0bc29c Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Mon, 21 Feb 2022 16:21:48 +0100 Subject: [PATCH 035/119] Fixed flash size computation for MP1 --- cmake/stm32/common.cmake | 4 ++-- cmake/stm32/mp1.cmake | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 343f91be..939dc327 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -210,8 +210,6 @@ function(stm32_get_memory_info) set(FLASH "32K") elseif(SIZE_CODE STREQUAL "8") set(FLASH "64K") - elseif(SIZE_CODE STREQUAL "A") - set(FLASH "0K") elseif(SIZE_CODE STREQUAL "B") set(FLASH "128K") elseif(SIZE_CODE STREQUAL "C") @@ -261,6 +259,8 @@ function(stm32_get_memory_info) stm32wl_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} "${INFO_CORE}" RAM FLASH_ORIGIN RAM_ORIGIN TWO_FLASH_BANKS) elseif(FAMILY STREQUAL "WB") stm32wb_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} "${INFO_CORE}" RAM RAM_ORIGIN TWO_FLASH_BANKS) + elseif(FAMILY STREQUAL "MP1") + stm32mp1_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH) endif() # when a device is dual core, each core uses half of total flash if(TWO_FLASH_BANKS) diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 2461e889..1401dede 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -24,3 +24,8 @@ target_compile_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d1 target_link_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) target_compile_definitions(STM32::MP1::M4 INTERFACE CORE_CM4) +function(stm32mp1_get_memory_info DEVICE TYPE FLASH_SIZE) + if(FLASH_SIZE) + set(${FLASH_SIZE} "0KB" PARENT_SCOPE) + endif() +endfunction() From cbf95c6deecdcaa0b0eb37a6c890356b1011afc4 Mon Sep 17 00:00:00 2001 From: Julien JEMINE Date: Tue, 22 Feb 2022 09:34:32 +0100 Subject: [PATCH 036/119] Changed MP15xxA to MP15xx --- cmake/stm32/devices.cmake | 24 ++++++++++++------------ cmake/stm32/mp1.cmake | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index 6ea5fd80..c0dcad63 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1095,18 +1095,18 @@ set(STM32_ALL_DEVICES L562RE L562VE L562ZE - MP151AA - MP151CA - MP151DA - MP151FA - MP153AA - MP153CA - MP153DA - MP153FA - MP157AA - MP157CA - MP157DA - MP157FA + MP151A + MP151C + MP151D + MP151F + MP153A + MP153C + MP153D + MP153F + MP157A + MP157C + MP157D + MP157F U575CG U575CI U585CI diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 1401dede..4c8afd63 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -4,9 +4,9 @@ set(STM32_MP1_TYPES MP157Axx MP157Cxx) set(STM32_MP1_TYPE_MATCH - "MP151[AD]A.?" "MP151[CF]A.?" - "MP153[AD]A.?" "MP153[CF]A.?" - "MP157[AD]A.?" "MP157[CF]A.?") + "MP151[AD](A.?)?" "MP151[CF](A.?)?" + "MP153[AD](A.?)?" "MP153[CF](A.?)?" + "MP157[AD](A.?)?" "MP157[CF](A.?)?") set(STM32_MP1_RAM_SIZES 384K 384K From 51292b3609b401fdc84c21cbbf417642398d7b69 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 22 Feb 2022 18:45:38 +0100 Subject: [PATCH 037/119] FindCMSIS checks that ASM is enabled before generating ASM related targets --- README.md | 4 ++-- cmake/FindCMSIS.cmake | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f9aed1e..a7365f8e 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ STM32WB is a multi-cores device even if the second core is not accessible by end CMSIS consists of three main components: * Family-specific headers, e.g. `stm32f4xx.h` -* Device type-specific startup sources (e.g. `startup_stm32f407xx.s`) -* Device-specific linker scripts which requires information about memory sizes +* Device type-specific startup sources (e.g. `startup_stm32f407xx.s`) (if ASM language is enabled) +* Device-specific linker scripts which requires information about memory sizes (if ASM language is enabled) stm32-cmake uses modern CMake features notably imported targets and target properties. Every CMSIS component is CMake's target (aka library), which defines compiler definitions, compiler flags, include dirs, sources, etc. to build and propagate them as dependencies. So in a simple use-case all you need is to link your executable with library `CMSIS::STM32::`: diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index ce4ff82b..7503e323 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -219,6 +219,12 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) string(TOLOWER ${DEVICE} DEVICE_L) string(TOLOWER ${TYPE} TYPE_L) + get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) + if(NOT "ASM" IN_LIST languages) + message(STATUS "FindCMSIS: Not generating target for startup file and linker script because ASM language is not enabled") + continue() + endif() + find_file(CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates/gcc" From 10d387831efb6166fcf0e670b7c8918387f4bc93 Mon Sep 17 00:00:00 2001 From: Inujel Date: Thu, 24 Feb 2022 18:09:50 +0100 Subject: [PATCH 038/119] Removed erroneous USE_HAL_DRIVER --- cmake/FindHAL.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 40f02f1e..6924cbb7 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -378,7 +378,6 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) STM32::${FAMILY}${CORE_C} CMSIS::STM32::${FAMILY}${CORE_C}) target_include_directories(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_INCLUDE}") - target_compile_definitions(HAL::STM32::${FAMILY}${CORE_C} INTERFACE USE_HAL_DRIVER) target_sources(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_SOURCE}") endif() From 870d627a2e8803099954a803e34af394d7e40852 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sat, 7 May 2022 12:33:42 +0200 Subject: [PATCH 039/119] Replaced __WFI with active infinite loop --- examples/blinky-ll/blinky.c | 3 +-- examples/blinky/blinky.c | 3 +-- examples/blinky/blinky.cpp | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/blinky-ll/blinky.c b/examples/blinky-ll/blinky.c index 7d66f9f8..8a314b8b 100644 --- a/examples/blinky-ll/blinky.c +++ b/examples/blinky-ll/blinky.c @@ -53,8 +53,7 @@ int main(void) SystemCoreClockUpdate(); SysTick_Config(SystemCoreClock / 1000); - for (;;) - __WFI(); + while(1); return 0; } diff --git a/examples/blinky/blinky.c b/examples/blinky/blinky.c index 8b6bd303..7627b303 100644 --- a/examples/blinky/blinky.c +++ b/examples/blinky/blinky.c @@ -53,8 +53,7 @@ int main(void) // 1kHz ticks HAL_SYSTICK_Config(SystemCoreClock / 1000); - for (;;) - __WFI(); + while(1); return 0; } diff --git a/examples/blinky/blinky.cpp b/examples/blinky/blinky.cpp index a5bf69f9..63000cd6 100644 --- a/examples/blinky/blinky.cpp +++ b/examples/blinky/blinky.cpp @@ -57,8 +57,6 @@ int main(void) // 1kHz ticks HAL_SYSTICK_Config(SystemCoreClock / 1000); - for (;;) - __WFI(); - + while(1); return 0; } From 059ed668b3bd0a79676af9878c38b44d78d1c890 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 31 May 2022 11:30:49 +0200 Subject: [PATCH 040/119] set CMAKE_SYSROOT variable --- cmake/stm32/common.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 9d6186bf..40936baa 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -46,6 +46,8 @@ set(TOOLCHAIN_BIN_PATH "${STM32_TOOLCHAIN_PATH}/bin") set(TOOLCHAIN_INC_PATH "${STM32_TOOLCHAIN_PATH}/${STM32_TARGET_TRIPLET}/include") set(TOOLCHAIN_LIB_PATH "${STM32_TOOLCHAIN_PATH}/${STM32_TARGET_TRIPLET}/lib") +set(CMAKE_SYSROOT ${TOOLCHAIN_SYSROOT}) + find_program(CMAKE_OBJCOPY NAMES ${STM32_TARGET_TRIPLET}-objcopy HINTS ${TOOLCHAIN_BIN_PATH}) find_program(CMAKE_OBJDUMP NAMES ${STM32_TARGET_TRIPLET}-objdump HINTS ${TOOLCHAIN_BIN_PATH}) find_program(CMAKE_SIZE NAMES ${STM32_TARGET_TRIPLET}-size HINTS ${TOOLCHAIN_BIN_PATH}) From 072b77856c69c443fd298f01352960f75c6df8c2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 31 May 2022 11:39:16 +0200 Subject: [PATCH 041/119] should be safe to set --- cmake/stm32_gcc.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/stm32_gcc.cmake b/cmake/stm32_gcc.cmake index 174375d7..b34a1984 100644 --- a/cmake/stm32_gcc.cmake +++ b/cmake/stm32_gcc.cmake @@ -13,3 +13,6 @@ find_program(CMAKE_ASM_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc HINTS ${TOOLCH set(CMAKE_EXECUTABLE_SUFFIX_C .elf) set(CMAKE_EXECUTABLE_SUFFIX_CXX .elf) set(CMAKE_EXECUTABLE_SUFFIX_ASM .elf) + +# See: https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM.html +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) From 4f210e7e399288fb9aeeb24fa272001cd117511e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 31 May 2022 11:49:12 +0200 Subject: [PATCH 042/119] better comment --- cmake/stm32_gcc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32_gcc.cmake b/cmake/stm32_gcc.cmake index b34a1984..e6ab86fe 100644 --- a/cmake/stm32_gcc.cmake +++ b/cmake/stm32_gcc.cmake @@ -14,5 +14,5 @@ set(CMAKE_EXECUTABLE_SUFFIX_C .elf) set(CMAKE_EXECUTABLE_SUFFIX_CXX .elf) set(CMAKE_EXECUTABLE_SUFFIX_ASM .elf) -# See: https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM.html +# This should be safe to set for a bare-metal cross-compiler set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) From 3e305aacf772926a19a2239093e7049550d03691 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Jun 2022 22:12:06 +0200 Subject: [PATCH 043/119] remove explicit passing of --sysroot Is done by setting CMAKE_SYSROOT in toolchain file now --- cmake/stm32/utilities.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index ce05bdbd..d6405be5 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -17,14 +17,12 @@ function(stm32_util_create_family_targets FAMILY) # -Wall: all warnings activated # -ffunction-sections -fdata-sections: remove unused code target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE - --sysroot="${TOOLCHAIN_SYSROOT}" -mthumb -Wall -ffunction-sections -fdata-sections ) # Set linker flags # -mthumb: Generate thumb code # -Wl,--gc-sections: Remove unused code target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE - --sysroot="${TOOLCHAIN_SYSROOT}" -mthumb -Wl,--gc-sections ) target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE From 430cd6ec8099ce721420a51a1b4822919cb12487 Mon Sep 17 00:00:00 2001 From: Pavlo Taranov Date: Fri, 15 Jul 2022 13:19:13 +0200 Subject: [PATCH 044/119] Implemented FreeRTOS example for STM32F100RB boards (e.g. STM32-VLDiscovery) --- examples/freertos/CMakeLists.txt | 74 ++++- examples/freertos/FreeRTOSConfig.h | 10 + examples/freertos/main.cpp | 13 +- examples/freertos/stm32f1xx_hal_conf.h | 399 +++++++++++++++++++++++++ 4 files changed, 487 insertions(+), 9 deletions(-) create mode 100755 examples/freertos/stm32f1xx_hal_conf.h diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index 2bbd7481..a30579a1 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(PROJ_NAME stm32-freertos) set(STM32_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..) -# Please note: When using CMSIS, it is recommended to use the FreeRTOS version supplied in the +# Please note: When using CMSIS, it is recommended to use the FreeRTOS version supplied in the # Cube repository because more recent kernels might be incompatible to the CMSIS # implementation provided by STM option(USE_CMSIS_RTOS "Use CMSIS RTOS provided by Cube repository" OFF) @@ -33,13 +33,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) # Can be used to print out all devices for the H7 or/and the F4 family # stm32_print_devices_by_family(FAMILY H7) # stm32_print_devices_by_family(FAMILY F4) - -set(SUPPORTED_BOARDS F407VG H743ZI L552ZE) +set(SUPPORTED_BOARDS F100RB F407VG H743ZI L552ZE) +option(FREERTOS_F100RB_EXAMPLE "Compile FreeRTOS example for the F100RB board" OFF) option(FREERTOS_F407VG_EXAMPLE "Compile FreeRTOS example for the F407VG board" OFF) option(FREERTOS_H743ZI_EXAMPLE "Compile FreeRTOS example for the H743ZI board" OFF) option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the L552ZE board" OFF) -if(NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE AND NOT FREERTOS_L552ZE_EXAMPLE) +if(NOT FREERTOS_F100RB_EXAMPLE AND NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE AND NOT FREERTOS_L552ZE_EXAMPLE) message(FATAL_ERROR "Please select at least one target to compile by passing FREERTOS__EXAMPLE=ON\n" "Supported boards: ${SUPPORTED_BOARDS}" @@ -54,14 +54,30 @@ set(FREERTOS_NAMESPACE FreeRTOS) if(USE_CMSIS_RTOS) list(APPEND CMSIS_COMP_LIST RTOS) endif() + if(USE_CMSIS_RTOS_V2) list(APPEND CMSIS_COMP_LIST RTOS_V2) endif() +if(FREERTOS_F100RB_EXAMPLE) + list(APPEND CMSIS_COMP_LIST STM32F1) + list(APPEND HAL_COMP_LIST STM32F1) + list(APPEND FREERTOS_COMP_LIST ARM_CM3) + + if(USE_CUBE_FREERTOS) + # The device family needs to be supplied as a component to use the Cube FreeRTOS sources + list(APPEND FREERTOS_COMP_LIST STM32F1) + set(FREERTOS_F1_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::F1) + else() + set(FREERTOS_F1_NAMESPACE ${FREERTOS_NAMESPACE}) + endif() +endif() + if(FREERTOS_H743ZI_EXAMPLE) list(APPEND CMSIS_COMP_LIST STM32H743ZI_M7) list(APPEND HAL_COMP_LIST STM32H7M7) list(APPEND FREERTOS_COMP_LIST ARM_CM7) + if(USE_CUBE_FREERTOS) # The device family needs to be supplied as a component to use the Cube FreeRTOS sources list(APPEND FREERTOS_COMP_LIST STM32H7) @@ -75,11 +91,12 @@ if(FREERTOS_F407VG_EXAMPLE) list(APPEND CMSIS_COMP_LIST STM32F407VG) list(APPEND HAL_COMP_LIST STM32F407VG) list(APPEND FREERTOS_COMP_LIST ARM_CM4F) + if(USE_CUBE_FREERTOS) # The device family needs to be supplied as a component to use the Cube FreeRTOS sources list(APPEND FREERTOS_COMP_LIST STM32F4) set(FREERTOS_F4_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::F4) - else() + else() set(FREERTOS_F4_NAMESPACE ${FREERTOS_NAMESPACE}) endif() endif() @@ -88,11 +105,12 @@ if(FREERTOS_L552ZE_EXAMPLE) list(APPEND CMSIS_COMP_LIST STM32L552ZE) list(APPEND HAL_COMP_LIST STM32L552ZE) list(APPEND FREERTOS_COMP_LIST ARM_CM33_NTZ) + if(USE_CUBE_FREERTOS) # The device family needs to be supplied as a component to use the Cube FreeRTOS sources list(APPEND FREERTOS_COMP_LIST STM32L5) set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::L5) - else() + else() set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}) endif() endif() @@ -111,6 +129,42 @@ set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ) +if(FREERTOS_F100RB_EXAMPLE) + set(TARGET_NAME ${PROJ_NAME}-f100) + add_executable(${TARGET_NAME}) + + target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) + target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} PRIVATE + ${FREERTOS_F1_NAMESPACE}::Timers + ${FREERTOS_F1_NAMESPACE}::Heap::4 + ${FREERTOS_F1_NAMESPACE}::ARM_CM3 + HAL::STM32::F1::RCC + HAL::STM32::F1::GPIO + HAL::STM32::F1::CORTEX + CMSIS::STM32::F100RB + STM32::NoSys + ) + if(USE_CMSIS_RTOS) + target_link_libraries(${TARGET_NAME} PRIVATE + CMSIS::STM32::F1::RTOS + ) + endif() + if(USE_CMSIS_RTOS_V2) + target_link_libraries(${TARGET_NAME} PRIVATE + CMSIS::STM32::F100RB::RTOS_V2 + ) + target_compile_definitions(${TARGET_NAME} PRIVATE + USE_CMSIS_RTOS_V2 + CMSIS_RTOS_V2_DEVICE_HEADER="stm32f1xx_hal.h" + ) + endif() + + stm32_print_size_of_target(${TARGET_NAME}) + stm32_generate_binary_file(${TARGET_NAME}) + stm32_generate_hex_file(${TARGET_NAME}) +endif() + if(FREERTOS_H743ZI_EXAMPLE) set(TARGET_NAME ${PROJ_NAME}-h743zi) add_executable(${TARGET_NAME}) @@ -127,11 +181,13 @@ if(FREERTOS_H743ZI_EXAMPLE) CMSIS::STM32::H743ZI::M7 STM32::NoSys ) + if(USE_CMSIS_RTOS) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::H7::M7::RTOS ) endif() + if(USE_CMSIS_RTOS_V2) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::H7::M7::RTOS_V2 @@ -160,14 +216,16 @@ if(FREERTOS_F407VG_EXAMPLE) HAL::STM32::F4::RCC HAL::STM32::F4::GPIO HAL::STM32::F4::CORTEX - CMSIS::STM32::F407VG + CMSIS::STM32::F407VG STM32::NoSys ) + if(USE_CMSIS_RTOS) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::F4::RTOS ) endif() + if(USE_CMSIS_RTOS_V2) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::F4::RTOS_V2 @@ -199,11 +257,13 @@ if(FREERTOS_L552ZE_EXAMPLE) CMSIS::STM32::L552ZE STM32::NoSys ) + if(USE_CMSIS_RTOS) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::L5::RTOS ) endif() + if(USE_CMSIS_RTOS_V2) target_link_libraries(${TARGET_NAME} PRIVATE CMSIS::STM32::L5::RTOS_V2 diff --git a/examples/freertos/FreeRTOSConfig.h b/examples/freertos/FreeRTOSConfig.h index 708bbc03..241b47cf 100644 --- a/examples/freertos/FreeRTOSConfig.h +++ b/examples/freertos/FreeRTOSConfig.h @@ -44,6 +44,12 @@ #include extern uint32_t SystemCoreClock; +#if defined STM32F1 + // This is enough for Blinky example. + #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) + #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2 * 1024 ) ) +#endif + #if defined STM32L5 #define configENABLE_TRUSTZONE 0 #if configENABLE_TRUSTZONE @@ -62,8 +68,12 @@ extern uint32_t SystemCoreClock; #if !defined USE_CMSIS_RTOS_V2 #define configMAX_PRIORITIES ( 5 ) #endif +#if !defined configMINIMAL_STACK_SIZE #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 ) +#endif +#if !defined configTOTAL_HEAP_SIZE #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) ) +#endif #define configMAX_TASK_NAME_LEN ( 10 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 diff --git a/examples/freertos/main.cpp b/examples/freertos/main.cpp index 08079008..0057dc3d 100644 --- a/examples/freertos/main.cpp +++ b/examples/freertos/main.cpp @@ -3,7 +3,16 @@ #include #include -#if defined STM32H7 +#if defined STM32F1 + #include + + // STM32VL-Discovery green led - PC9 + #define LED_PORT GPIOC + #define LED_PIN GPIO_PIN_9 + // STM32VL-Discovery blue led - PC8 + //#define LED_PIN GPIO_PIN_8 + #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE +#elif defined STM32H7 #include // STM32H743ZI blue LED @@ -54,7 +63,7 @@ int main(void) SystemInit(); blinky::init(); - xTaskCreate(blinky::blinkTask, "blinky", configMINIMAL_STACK_SIZE * 4, NULL, tskIDLE_PRIORITY + 1, NULL); + xTaskCreate(blinky::blinkTask, "blinky", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); vTaskStartScheduler(); for (;;); diff --git a/examples/freertos/stm32f1xx_hal_conf.h b/examples/freertos/stm32f1xx_hal_conf.h new file mode 100755 index 00000000..1d0488c3 --- /dev/null +++ b/examples/freertos/stm32f1xx_hal_conf.h @@ -0,0 +1,399 @@ +/** + ****************************************************************************** + * @file stm32f1xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32f1xx_hal_conf.h. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F1xx_HAL_CONF_H +#define __STM32F1xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CAN_MODULE_ENABLED +// #define HAL_CAN_LEGACY_MODULE_ENABLED +// #define HAL_CEC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +// #define HAL_CRC_MODULE_ENABLED +// #define HAL_DAC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +// #define HAL_ETH_MODULE_ENABLED +// #define HAL_EXTI_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +// #define HAL_HCD_MODULE_ENABLED +// #define HAL_I2C_MODULE_ENABLED +// #define HAL_I2S_MODULE_ENABLED +// #define HAL_IRDA_MODULE_ENABLED +// #define HAL_IWDG_MODULE_ENABLED +// #define HAL_NAND_MODULE_ENABLED +// #define HAL_NOR_MODULE_ENABLED +// #define HAL_PCCARD_MODULE_ENABLED +// #define HAL_PCD_MODULE_ENABLED +// #define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +// #define HAL_RTC_MODULE_ENABLED +// #define HAL_SD_MODULE_ENABLED +// #define HAL_SMARTCARD_MODULE_ENABLED +// #define HAL_SPI_MODULE_ENABLED +// #define HAL_SRAM_MODULE_ENABLED +// #define HAL_TIM_MODULE_ENABLED +// #define HAL_UART_MODULE_ENABLED +// #define HAL_USART_MODULE_ENABLED +// #define HAL_WWDG_MODULE_ENABLED +// #define HAL_MMC_MODULE_ENABLED + +/* ########################## 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) +#if defined(USE_STM3210C_EVAL) +#define HSE_VALUE 25000000U /*!< Value of the External oscillator in Hz */ +#else +#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) +#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @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 8000000U /*!< Value of the Internal oscillator in Hz */ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) +#define LSI_VALUE 40000U /*!< 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 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 32768U /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) +#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 1U + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD 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_MMC_REGISTER_CALLBACKS 0U /* MMC 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_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC 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_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI 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 */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB 8U /* 8 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB 4U /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848 PHY Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ + +#define PHY_SR ((uint16_t)0x0010) /*!< PHY status register Offset */ +#define PHY_MICR ((uint16_t)0x0011) /*!< MII Interrupt Control Register */ +#define PHY_MISR ((uint16_t)0x0012) /*!< MII Interrupt Status and Misc. Control Register */ + +#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */ +#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */ + +#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */ +#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */ + +#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */ +#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver +* Activated: CRC code is present inside driver +* Deactivated: CRC code cleaned from driver +*/ + +#define USE_SPI_CRC 1U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f1xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f1xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f1xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f1xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f1xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f1xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED + #include "Legacy/stm32f1xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f1xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f1xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f1xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f1xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f1xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f1xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f1xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f1xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f1xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f1xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f1xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f1xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f1xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f1xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f1xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f1xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f1xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f1xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f1xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f1xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f1xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f1xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f1xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f1xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f1xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f1xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t* file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F1xx_HAL_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ From c812a15e51f0de9744745195e7052d9cc5acd85d Mon Sep 17 00:00:00 2001 From: Pavlo Taranov Date: Sat, 16 Jul 2022 13:01:46 +0200 Subject: [PATCH 045/119] Implemented FreeRTOS example for STM32F100RB boards (e.g. STM32-VLDiscovery). Typo fixed --- examples/freertos/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index a30579a1..1c5097c8 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -152,7 +152,7 @@ if(FREERTOS_F100RB_EXAMPLE) endif() if(USE_CMSIS_RTOS_V2) target_link_libraries(${TARGET_NAME} PRIVATE - CMSIS::STM32::F100RB::RTOS_V2 + CMSIS::STM32::F1::RTOS_V2 ) target_compile_definitions(${TARGET_NAME} PRIVATE USE_CMSIS_RTOS_V2 From 7df08d191cd9f296aa20fca19da94d713fbbc4c6 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 13 Aug 2022 21:46:49 -0230 Subject: [PATCH 046/119] Check cmake version and warn user if lower than required --- cmake/stm32_gcc.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/stm32_gcc.cmake b/cmake/stm32_gcc.cmake index e6ab86fe..e661fd9a 100644 --- a/cmake/stm32_gcc.cmake +++ b/cmake/stm32_gcc.cmake @@ -1,3 +1,7 @@ +if(${CMAKE_VERSION} VERSION_LESS "3.16.0") + message(WARNING "Current CMake verision is ${CMAKE_VERSION}. stm32-cmake requires CMake 3.16 or greater") +endif() + get_filename_component(STM32_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) list(APPEND CMAKE_MODULE_PATH ${STM32_CMAKE_DIR}) From 0872d7d849afedd184533a396a8704ce1ea4821a Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Mon, 15 Aug 2022 15:17:38 +0200 Subject: [PATCH 047/119] Update cmake/stm32_gcc.cmake --- cmake/stm32_gcc.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/stm32_gcc.cmake b/cmake/stm32_gcc.cmake index e661fd9a..6e63c4fd 100644 --- a/cmake/stm32_gcc.cmake +++ b/cmake/stm32_gcc.cmake @@ -1,5 +1,6 @@ if(${CMAKE_VERSION} VERSION_LESS "3.16.0") - message(WARNING "Current CMake verision is ${CMAKE_VERSION}. stm32-cmake requires CMake 3.16 or greater") + message(WARNING "Current CMake version is ${CMAKE_VERSION}. stm32-cmake requires CMake 3.16 or greater") + endif() get_filename_component(STM32_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) From c2a28cca950550c59d2428a11aac242974bf60eb Mon Sep 17 00:00:00 2001 From: pavlot Date: Fri, 30 Sep 2022 12:05:56 +0200 Subject: [PATCH 048/119] Update examples/freertos/CMakeLists.txt Co-authored-by: Julien Staub --- examples/freertos/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index 1c5097c8..85b68b80 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -60,8 +60,8 @@ if(USE_CMSIS_RTOS_V2) endif() if(FREERTOS_F100RB_EXAMPLE) - list(APPEND CMSIS_COMP_LIST STM32F1) - list(APPEND HAL_COMP_LIST STM32F1) + list(APPEND CMSIS_COMP_LIST STM32F100RB) + list(APPEND HAL_COMP_LIST STM32F100RB) list(APPEND FREERTOS_COMP_LIST ARM_CM3) if(USE_CUBE_FREERTOS) From 64626d3ac6aecd2e82fbda6f46ebcd4c2c0b27c6 Mon Sep 17 00:00:00 2001 From: pavlot Date: Fri, 30 Sep 2022 12:06:07 +0200 Subject: [PATCH 049/119] Update examples/freertos/CMakeLists.txt Co-authored-by: Julien Staub --- examples/freertos/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/freertos/CMakeLists.txt b/examples/freertos/CMakeLists.txt index 85b68b80..d571e863 100644 --- a/examples/freertos/CMakeLists.txt +++ b/examples/freertos/CMakeLists.txt @@ -130,7 +130,7 @@ set(INCLUDE_DIRS ) if(FREERTOS_F100RB_EXAMPLE) - set(TARGET_NAME ${PROJ_NAME}-f100) + set(TARGET_NAME ${PROJ_NAME}-f100rb) add_executable(${TARGET_NAME}) target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) From f3d4bd42faf89fa9ff175180d9041c63c9556ae8 Mon Sep 17 00:00:00 2001 From: Pavlo Taranov Date: Fri, 30 Sep 2022 12:16:54 +0200 Subject: [PATCH 050/119] MINIMAL_STACK_SIZE and TOTAL_HEAP_SIZE decreased for all platforms to make code simpler --- examples/freertos/FreeRTOSConfig.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/examples/freertos/FreeRTOSConfig.h b/examples/freertos/FreeRTOSConfig.h index 241b47cf..9beeaa97 100644 --- a/examples/freertos/FreeRTOSConfig.h +++ b/examples/freertos/FreeRTOSConfig.h @@ -44,12 +44,6 @@ #include extern uint32_t SystemCoreClock; -#if defined STM32F1 - // This is enough for Blinky example. - #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) - #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2 * 1024 ) ) -#endif - #if defined STM32L5 #define configENABLE_TRUSTZONE 0 #if configENABLE_TRUSTZONE @@ -68,12 +62,8 @@ extern uint32_t SystemCoreClock; #if !defined USE_CMSIS_RTOS_V2 #define configMAX_PRIORITIES ( 5 ) #endif -#if !defined configMINIMAL_STACK_SIZE -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 ) -#endif -#if !defined configTOTAL_HEAP_SIZE -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) ) -#endif +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 10 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 From 3b3da64bca9acbfeccd2c53c109e57bd570a838b Mon Sep 17 00:00:00 2001 From: Julien Combattelli Date: Sat, 1 Oct 2022 12:38:35 +0200 Subject: [PATCH 051/119] Fix target when adding link flag to FloatScan target --- cmake/stm32/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 9d6186bf..87851cb7 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -347,7 +347,7 @@ endif() if(NOT (TARGET STM32::Nano::FloatScan)) add_library(STM32::Nano::FloatScan INTERFACE IMPORTED) - target_link_options(STM32::Nano::FloatPrint INTERFACE + target_link_options(STM32::Nano::FloatScan INTERFACE $<$:-Wl,--undefined,_scanf_float> ) endif() From cad9a21482307a970725310079914c29ad1673fe Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 11 Oct 2022 21:45:51 +0200 Subject: [PATCH 052/119] FindHAL family are checked then drivers --- cmake/FindHAL.cmake | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 6924cbb7..393a048b 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -236,16 +236,30 @@ endforeach() list(REMOVE_DUPLICATES HAL_DRIVERS) list(REMOVE_DUPLICATES HAL_LL_DRIVERS) +################################################################################ +# Checking the parameters provided to the find_package(HAL ...) call +# The expected parameters are families and or drivers +################################################################################ +#Checking all the requested families before looking for drivers foreach(COMP ${HAL_FIND_COMPONENTS}) - string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) - if(CMAKE_MATCH_1) + if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component list(APPEND HAL_FIND_COMPONENTS_FAMILIES ${COMP}) message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_FAMILIES") - continue() + else() + list(APPEND HAL_FIND_COMPONENTS_UNHANDLED ${COMP}) endif() +endforeach() + +if(NOT HAL_FIND_COMPONENTS_FAMILIES) + set(HAL_FIND_COMPONENTS_FAMILIES ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) +endif() + +#Checkinf all the requested drivers +foreach(COMP ${HAL_FIND_COMPONENTS_UNHANDLED}) + string(TOLOWER ${COMP} COMP_L) + if(${COMP_L} IN_LIST HAL_DRIVERS) list(APPEND HAL_FIND_COMPONENTS_DRIVERS ${COMP}) message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_DRIVERS") @@ -260,9 +274,6 @@ foreach(COMP ${HAL_FIND_COMPONENTS}) message(FATAL_ERROR "FindHAL: unknown HAL component: ${COMP}") endforeach() -if(NOT HAL_FIND_COMPONENTS_FAMILIES) - set(HAL_FIND_COMPONENTS_FAMILIES ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) -endif() if(STM32H7 IN_LIST HAL_FIND_COMPONENTS_FAMILIES) list(REMOVE_ITEM HAL_FIND_COMPONENTS_FAMILIES STM32H7) From b331d250ea100a6a6c1bd069aa54c052f9177b40 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 11 Oct 2022 22:30:17 +0200 Subject: [PATCH 053/119] FindHAL:Added function get_list_hal_drivers --- cmake/FindHAL.cmake | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 393a048b..cb9a4261 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -236,6 +236,35 @@ endforeach() list(REMOVE_DUPLICATES HAL_DRIVERS) list(REMOVE_DUPLICATES HAL_LL_DRIVERS) +# This function gets a list of hal_driver using a given prefix and suffix +# +# out_list_hal_drivers list of hal_drivers foud +# hal_drivers_path path to the hal's drivers +# hal_driver_type hal_driver type to find (hal/ll/ex) +function(get_list_hal_drivers out_list_hal_drivers hal_drivers_path hal_driver_type) + #The pattern to retrieve a driver from a file name depends on the hal_driver_type field + if(${hal_driver_type} STREQUAL "hal" OR ${hal_driver_type} STREQUAL "ll") + #This regex match and capture a driver type (stm32xx_hal_(rcc).c => catches rcc) + set(file_pattern ".+_${hal_driver_type}_([a-z0-9]+)\\.c$") + elseif(${hal_driver_type} STREQUAL "ex") + #This regex match and capture a driver type (stm32xx_hal_(rcc)_ex.c => catches rcc) + set(file_pattern ".+_hal_([a-z0-9]+)_ex\\.c$") + else() + message(FATAL_ERROR "the inputed hal_driver_type(${hal_driver_type}) is not valid.") + endif() + + #Retrieving all the .c files from hal_drivers_path + file(GLOB filtered_files + RELATIVE "${hal_drivers_path}/Src" + "${hal_drivers_path}/Src/*.c") + # For all matched .c files keep only those with a driver name pattern (e.g. stm32xx_hal_rcc.c) + list(FILTER filtered_files INCLUDE REGEX ${file_pattern}) + # Retrieve the driver type using the regex's first parenthesis match + list(TRANSFORM filtered_files REPLACE ${file_pattern} "\\1") + #Making a return by reference by seting the output variable to PARENT_SCOPE + set(${out_list_hal_drivers} ${filtered_files} PARENT_SCOPE) +endfunction() + ################################################################################ # Checking the parameters provided to the find_package(HAL ...) call # The expected parameters are families and or drivers From c2c6ad1a24a03167f510ed1c4fea217534dce42e Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 12 Oct 2022 10:41:20 +0200 Subject: [PATCH 054/119] FindHAL: drivers are read from families HAL folders --- cmake/FindHAL.cmake | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index cb9a4261..981cdc7a 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -229,13 +229,6 @@ set(HAL_LL_DRIVERS_WL rng rtc spi tim usart utils ) -foreach(FAMILY_SUFFIX ${STM32_SUPPORTED_FAMILIES_SHORT_NAME}) - list(APPEND HAL_DRIVERS ${HAL_DRIVERS_${FAMILY_SUFFIX}}) - list(APPEND HAL_LL_DRIVERS ${HAL_LL_DRIVERS_${FAMILY_SUFFIX}}) -endforeach() -list(REMOVE_DUPLICATES HAL_DRIVERS) -list(REMOVE_DUPLICATES HAL_LL_DRIVERS) - # This function gets a list of hal_driver using a given prefix and suffix # # out_list_hal_drivers list of hal_drivers foud @@ -281,10 +274,38 @@ foreach(COMP ${HAL_FIND_COMPONENTS}) endif() endforeach() +# If no family requested look for all families if(NOT HAL_FIND_COMPONENTS_FAMILIES) set(HAL_FIND_COMPONENTS_FAMILIES ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) endif() +# Look for available drivers for all requested families +foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) + string(TOUPPER ${family_comp} family_comp) + string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) + find_path(HAL_${FAMILY}_PATH + NAMES Inc/stm32${FAMILY_L}xx_hal.h + PATHS "${STM32_HAL_${FAMILY}_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver" + NO_DEFAULT_PATH + ) + if(NOT HAL_${FAMILY}_PATH) + message(FATAL_ERROR "could not find HAL for family ${FAMILY}") + else() + set(HAL_${COMP}_FOUND TRUE) + endif() + if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component + get_list_hal_drivers(HAL_DRIVERS_${FAMILY} ${HAL_${FAMILY}_PATH} "hal") + get_list_hal_drivers(HAL_EX_DRIVERS_${FAMILY} ${HAL_${FAMILY}_PATH} "ex") + get_list_hal_drivers(HAL_LL_DRIVERS_${FAMILY} ${HAL_${FAMILY}_PATH} "ll") + list(APPEND HAL_DRIVERS ${HAL_DRIVERS_${FAMILY}}) + list(APPEND HAL_LL_DRIVERS ${HAL_LL_DRIVERS_${FAMILY}}) + else() + endif() +endforeach() +message("P2H HAL drivers are ${HAL_DRIVERS}") +list(REMOVE_DUPLICATES HAL_DRIVERS) +list(REMOVE_DUPLICATES HAL_LL_DRIVERS) + #Checkinf all the requested drivers foreach(COMP ${HAL_FIND_COMPONENTS_UNHANDLED}) string(TOLOWER ${COMP} COMP_L) From a2d9bbd61b20595e368c16c605575db0a6d38a5c Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 12 Oct 2022 10:44:15 +0200 Subject: [PATCH 055/119] FindHAL: Removed all manual drivers list --- cmake/FindHAL.cmake | 229 -------------------------------------------- 1 file changed, 229 deletions(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 981cdc7a..3f109a7c 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -1,234 +1,5 @@ # For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html -set(HAL_DRIVERS_F0 - adc can cec comp cortex crc dac dma exti flash gpio i2c i2s irda iwdg pcd - pwr rcc rtc smartcard smbus spi tim tsc uart usart wwdg -) -set(HAL_EX_DRIVERS_F0 - adc crc dac flash i2c pcd pwr rcc rtc smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_F0 - adc comp crc crs dac dma exti gpio i2c pwr rcc rtc spi tim usart usb utils -) - -set(HAL_DRIVERS_F1 - adc can cec cortex crc dac dma eth exti flash gpio hcd i2c i2s irda iwdg - mmc nand nor pccard pcd pwr rcc rtc sd smartcard spi sram tim uart usart - wwdg -) -set(HAL_EX_DRIVERS_F1 - adc dac flash gpio pcd rcc rtc tim -) -set(HAL_LL_DRIVERS_F1 - adc crc dac dma exti fsmc gpio i2c pwr rcc rtc sdmmc spi tim usart usb utils -) - -set(HAL_DRIVERS_F2 - adc can cortex crc cryp dac dcmi dma eth exti flash gpio hash hcd i2c i2s - irda iwdg mmc nand nor pccard pcd pwr rcc rng rtc sd smartcard spi sram tim - uart usart wwdg -) -set(HAL_EX_DRIVERS_F2 - adc dac dcmi dma flash pcd pwr rcc rtc tim -) -set(HAL_LL_DRIVERS_F2 - adc crc dac dma exti fsmc gpio i2c pwr rcc rng rtc sdmmc spi tim usart usb - utils -) - -set(HAL_DRIVERS_F3 - adc can cec comp cortex crc dac dma exti flash gpio hrtim i2c i2s irda iwdg - nand nor opamp pccard pcd pwr rcc rtc sdadc smartcard smbus spi sram tim tsc - uart usart wwdg -) -set(HAL_EX_DRIVERS_F3 - adc crc dac flash i2c i2s opamp pcd pwr rcc rtc smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_F3 - adc comp crc dac dma exti fmc gpio hrtim i2c opamp pwr rcc rtc spi tim usart - usb utils -) - -set(HAL_DRIVERS_F4 - adc can cec cortex crc cryp dac dcmi dfsdm dma dma2d dsi eth exti flash - flash_ramfunc fmpi2c gpio hash hcd i2c i2s irda iwdg lptim ltdc mmc nand nor - pccard pcd pwr qspi rcc rng rtc sai sd sdram smartcard smbus spdifrx spi - sram tim uart usart wwdg -) -set(HAL_EX_DRIVERS_F4 - adc cryp dac dcmi dma flash fmpi2c hash i2c i2s ltdc pcd pwr rcc rtc sai tim -) -set(HAL_LL_DRIVERS_F4 - adc crc dac dma dma2d exti fmc fsmc gpio i2c lptim pwr rcc rng rtc sdmmc spi - tim usart usb utils -) - -set(HAL_DRIVERS_F7 - adc can cec cortex crc cryp dac dcmi dfsdm dma dma2d dsi eth exti flash - gpio hash hcd i2c i2s irda iwdg jpeg lptim ltdc mdios mmc nand nor pcd pwr - qspi rcc rng rtc sai sd sdram smartcard smbus spdifrx spi sram tim uart - usart wwdg -) -set(HAL_EX_DRIVERS_F7 - adc crc cryp dac dcmi dma flash hash i2c ltdc pcd pwr rcc rtc sai smartcard - spi tim uart -) -set(HAL_LL_DRIVERS_F7 - adc crc dac dma dma2d exti fmc gpio i2c lptim pwr rcc rng rtc sdmmc spi tim - usart usb utils -) - -set(HAL_DRIVERS_G0 - adc cec comp cortex crc cryp dac dma exti flash gpio i2c i2s irda iwdg lptim - pwr rcc rng rtc smartcard smbus spi tim uart usart wwdg -) -set(HAL_EX_DRIVERS_G0 - adc crc cryp dac dma flash i2c pwr rcc rtc smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_G0 - adc comp crc dac dma exti gpio i2c lptim lpuart pwr rcc rng rtc spi tim ucpd - usart utils -) - -set(HAL_DRIVERS_G4 - adc comp cordic cortex crc cryp dac dma exti fdcan flash flash_ramfunc fmac - gpio hrtim i2c i2s irda iwdg lptim nand nor opamp pcd pwr qspi rcc rng rtc - sai smartcard smbus spi sram tim uart usart wwdg -) -set(HAL_EX_DRIVERS_G4 - adc crc cryp dac dma flash i2c opamp pcd pwr rcc rtc sai smartcard spi tim - uart usart -) -set(HAL_LL_DRIVERS_G4 - adc comp cordic crc crs dac dma exti fmac fmc gpio hrtim i2c lptim lpuart - opamp pwr rcc rng rtc spi tim ucpd usart usb utils -) - -set(HAL_DRIVERS_H7 - adc cec comp cordic cortex crc cryp dac dcmi dfsdm dma dma2d dsi dts eth exti fdcan - flash fmac gfxmmu gpio hash hcd hrtim hsem i2c i2s irda iwdg jpeg lptim ltdc mdios - mdma mmc nand nor opamp ospi otfdec pcd pssi pwr qspi ramecc rcc rng rtc sai - sd sdram smartcard smbus spdifrx spi sram swpmi tim uart usart wwdg -) -set(HAL_EX_DRIVERS_H7 - adc crc cryp dac dfsdm dma eth flash hash i2c i2s ltdc mmc opamp pcd pwr rcc - rng rtc sai sd smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_H7 - adc bdma comp cordic crc crs dac delayblock dma dma2d exti fmac fmc gpio hrtim i2c lptim - lpuart mdma opamp pwr rcc rng rtc sdmmc spi swpmi tim usart usb utils -) - -set(HAL_DRIVERS_L0 - adc comp cortex crc cryp dac dma firewall flash flash_ramfunc gpio i2c i2s - irda iwdg lcd lptim pcd pwr rcc rng rtc smartcard smbus spi tim tsc uart - usart wwdg -) -set(HAL_EX_DRIVERS_L0 - adc comp crc cryp dac flash i2c pcd pwr rcc rtc smartcard tim uart -) -set(HAL_LL_DRIVERS_L0 - adc comp crc crs dac dma exti gpio i2c lptim lpuart pwr rcc rng rtc spi tim - usart usb utils -) - -set(HAL_DRIVERS_L1 - adc comp cortex crc cryp dac dma flash flash_ramfunc gpio i2c i2s irda iwdg - lcd nor opamp pcd pwr rcc rtc sd smartcard spi sram tim uart usart wwdg -) -set(HAL_EX_DRIVERS_L1 - adc cryp dac flash opamp pcd pcd pwr rcc rtc tim -) -set(HAL_LL_DRIVERS_L1 - adc comp crc dac dma exti fsmc gpio i2c opamp pwr rcc rtc sdmmc spi tim - usart usb utils -) - -set(HAL_DRIVERS_L4 - adc can comp cortex crc cryp dac dcmi dfsdm dma dma2d dsi exti firewall - flash flash_ramfunc gfxmmu gpio hash hcd i2c irda iwdg lcd lptim ltdc mmc - nand nor opamp ospi pcd pka pssi pwr qspi rcc rng rtc sai sd smartcard smbus - spi sram swpmi tim tsc uart usart wwdg -) -set(HAL_EX_DRIVERS_L4 - adc crc cryp dac dfsdm dma flash hash i2c ltdc mmc opamp pcd pwr rcc rng rtc - sai sd smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_L4 - adc comp crc crs dac dma dma2d exti fmc gpio i2c lptim lpuart opamp pka pwr - rcc rng rtc sdmmc spi swpmi tim usart usb utils -) - -set(HAL_DRIVERS_L5 - adc comp cortex crc cryp dac dfsdm dma exti fdcan flash flash_ramfunc gpio - gtzc hash i2c icache irda iwdg lptim mmc nand nor opamp ospi pcd pka pwr rcc - rng rtc sai sd smartcard smbus spi sram tim tsc uart usart wwdg -) -set(HAL_EX_DRIVERS_L5 - adc crc cryp dac dfsdm dma flash hash i2c mmc opamp pcd pwr rcc - rng rtc sai sd smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_L5 - adc comp crc crs dac dma exti fmc gpio i2c lptim lpuart opamp pka pwr rcc - rng rtc sdmmc spi tim ucpd usart usb utils -) - -set(HAL_DRIVERS_MP1 - adc cec cortex crc cryp dac dcmi dfsdm dma exti fdcan gpio hash hsem i2c - ipcc lptim mdios mdma pwr qspi rcc rng rtc sai sd smartcard smbus spdifrx - spi sram tim uart usart wwdg -) -set(HAL_EX_DRIVERS_MP1 - adc crc cryp dac dfsdm dma hash i2c pwr rcc rtc sai sd smartcard spi tim - uart usart -) -set(HAL_LL_DRIVERS_MP1 - adc delayblock dma exti fmc gpio i2c lptim pwr rcc rtc sdmmc spi tim usart - utils -) - -set(HAL_DRIVERS_U5 - adc comp cordic cortex crc cryp dac dcache dcmi dma dma2d exti fdcan flash fmac gpio - gtzc hash hcd i2c icache irda iwdg lptim mdf mmc nand nor opamp ospi otfdec pcd pka pssi pwr ramcfg rcc - rng rtc sai sd smartcard smbus spi sram tim tsc uart usart wwdg -) -set(HAL_EX_DRIVERS_U5 - adc crc cryp dac dma flash hash i2c mmc opamp pcd pwr rcc - rng rtc sai sd smartcard smbus spi tim uart usart -) -set(HAL_LL_DRIVERS_U5 - adc comp cordic crc crs dac dlyb dma dma2d exti fmac fmc gpio i2c icache lpgpio lptim lpuart opamp pka pwr rcc - rng rtc sdmmc spi tim ucpd usart usb utils -) - -set(HAL_DRIVERS_WB - adc comp cortex crc cryp dma exti flash gpio hsem - i2c ipcc irda iwdg lcd lptim pcd pka pwr qspi rcc - rng rtc sai smartcard smbus spi tim tsc uart usart wwdg -) -set(HAL_EX_DRIVERS_WB - adc crc cryp dma flash i2c pcd pwr rcc - rtc sai smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_WB - adc comp crc crs dma exti gpio i2c lptim lpuart pka pwr rcc - rng rtc spi tim usart usb utils -) - -set(HAL_DRIVERS_WL - adc comp cortex crc cryp dac dma exti flash gpio gtzc hsem - i2c i2s ipcc irda iwdg lptim pka pwr rcc - rng rtc smartcard smbus spi subghz tim uart usart wwdg -) -set(HAL_EX_DRIVERS_WL - adc crc cryp dma flash i2c pwr rcc - rng rtc smartcard spi tim uart usart -) -set(HAL_LL_DRIVERS_WL - adc comp crc dac dma exti gpio i2c lptim lpuart pka pwr rcc - rng rtc spi tim usart utils -) - # This function gets a list of hal_driver using a given prefix and suffix # # out_list_hal_drivers list of hal_drivers foud From 812b6a114244996bf1fbeee008e869d2776ce7df Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 12 Oct 2022 11:07:54 +0200 Subject: [PATCH 056/119] FindHAL corrected var init issue --- cmake/FindHAL.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 3f109a7c..d3d08c49 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -54,6 +54,9 @@ endif() foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) string(TOUPPER ${family_comp} family_comp) string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) + if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component + set(FAMILY ${CMAKE_MATCH_1}) + endif() find_path(HAL_${FAMILY}_PATH NAMES Inc/stm32${FAMILY_L}xx_hal.h PATHS "${STM32_HAL_${FAMILY}_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver" @@ -62,7 +65,7 @@ foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) if(NOT HAL_${FAMILY}_PATH) message(FATAL_ERROR "could not find HAL for family ${FAMILY}") else() - set(HAL_${COMP}_FOUND TRUE) + set(HAL_${family_comp}_FOUND TRUE) endif() if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component get_list_hal_drivers(HAL_DRIVERS_${FAMILY} ${HAL_${FAMILY}_PATH} "hal") From 99316ef021b76add8867bce182bada45aabf4821 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 12 Oct 2022 21:02:25 +0200 Subject: [PATCH 057/119] test:fetch test specify the family on find_package calls --- tests/fetch/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index 1ab40c51..f3082999 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -5,14 +5,17 @@ if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() +# Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES +list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) + project(fetch-test C ASM) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) stm32_fetch_cmsis(${TEST_FAMILIES}) stm32_fetch_hal(${TEST_FAMILIES}) -find_package(CMSIS REQUIRED) -find_package(HAL REQUIRED) +find_package(CMSIS REQUIRED ${TEST_FAMILIES_LONG_NAMES}) +find_package(HAL REQUIRED ${TEST_FAMILIES_LONG_NAMES}) set(SOURCES main.c) From 4c55796970f67e977697052f90d259a95a2c3dd0 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 12 Oct 2022 21:36:49 +0200 Subject: [PATCH 058/119] test:hal test specify the family on find_package calls --- tests/hal/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index a505470d..4b14e386 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -5,6 +5,9 @@ if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() +# Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES +list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) + project(hal-test C ASM) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) @@ -13,8 +16,8 @@ if(FETCH_ST_SOURCES) stm32_fetch_hal(${TEST_FAMILIES}) endif() -find_package(CMSIS REQUIRED) -find_package(HAL REQUIRED) +find_package(CMSIS REQUIRED ${TEST_FAMILIES_LONG_NAMES}) +find_package(HAL REQUIRED ${TEST_FAMILIES_LONG_NAMES}) set(SOURCES main.c) From 082dc08c054f4c0d844e439a153c43659b107e00 Mon Sep 17 00:00:00 2001 From: Hish15 Date: Sat, 15 Oct 2022 13:31:58 +0200 Subject: [PATCH 059/119] FindHAL.cmake: Corrected typo --- cmake/FindHAL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index d3d08c49..0c053fd3 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -2,7 +2,7 @@ # This function gets a list of hal_driver using a given prefix and suffix # -# out_list_hal_drivers list of hal_drivers foud +# out_list_hal_drivers list of hal_drivers found # hal_drivers_path path to the hal's drivers # hal_driver_type hal_driver type to find (hal/ll/ex) function(get_list_hal_drivers out_list_hal_drivers hal_drivers_path hal_driver_type) From 1c84c542feae87f3f78a933e83583a7a0b50d526 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 1 Nov 2022 14:02:11 +0100 Subject: [PATCH 060/119] FindHal.cmake:corrected some typo in comments --- cmake/FindHAL.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 0c053fd3..0e385341 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -8,7 +8,7 @@ function(get_list_hal_drivers out_list_hal_drivers hal_drivers_path hal_driver_type) #The pattern to retrieve a driver from a file name depends on the hal_driver_type field if(${hal_driver_type} STREQUAL "hal" OR ${hal_driver_type} STREQUAL "ll") - #This regex match and capture a driver type (stm32xx_hal_(rcc).c => catches rcc) + #This regex match and capture a driver type (stm32xx_hal_(rcc).c or stm32xx_ll_(rcc).c => catches rcc) set(file_pattern ".+_${hal_driver_type}_([a-z0-9]+)\\.c$") elseif(${hal_driver_type} STREQUAL "ex") #This regex match and capture a driver type (stm32xx_hal_(rcc)_ex.c => catches rcc) @@ -33,7 +33,7 @@ endfunction() # Checking the parameters provided to the find_package(HAL ...) call # The expected parameters are families and or drivers ################################################################################ -#Checking all the requested families before looking for drivers +# Checking all the requested families before looking for drivers foreach(COMP ${HAL_FIND_COMPONENTS}) string(TOUPPER ${COMP} COMP_U) string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) @@ -80,7 +80,7 @@ message("P2H HAL drivers are ${HAL_DRIVERS}") list(REMOVE_DUPLICATES HAL_DRIVERS) list(REMOVE_DUPLICATES HAL_LL_DRIVERS) -#Checkinf all the requested drivers +# Checking all the requested drivers foreach(COMP ${HAL_FIND_COMPONENTS_UNHANDLED}) string(TOLOWER ${COMP} COMP_L) From 213ae0aad36fd68fd27a0e1753105bafaf5111a7 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 1 Nov 2022 15:36:23 +0100 Subject: [PATCH 061/119] FindHAL.cmake: Added detailed comment on the workflow --- cmake/FindHAL.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 0e385341..cbee74f5 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -31,9 +31,15 @@ endfunction() ################################################################################ # Checking the parameters provided to the find_package(HAL ...) call -# The expected parameters are families and or drivers +# The expected parameters are families and or drivers in *any orders* +# Families are valid if on the list of known families. +# Drivers are valid if on the list of valid driver of any family. For this +# reason the requested families must be processed in two steps +# - Step 1 : Checking all the requested families +# - Step 2 : Generating all the valid drivers from requested families +# - Step 3 : Checking the other requested components (Expected to be drivers) ################################################################################ -# Checking all the requested families before looking for drivers +# Step 1 : Checking all the requested families foreach(COMP ${HAL_FIND_COMPONENTS}) string(TOUPPER ${COMP} COMP_U) string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) @@ -50,7 +56,7 @@ if(NOT HAL_FIND_COMPONENTS_FAMILIES) set(HAL_FIND_COMPONENTS_FAMILIES ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) endif() -# Look for available drivers for all requested families +# Step 2 : Generating all the valid drivers from requested families foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) string(TOUPPER ${family_comp} family_comp) string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) @@ -76,11 +82,10 @@ foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) else() endif() endforeach() -message("P2H HAL drivers are ${HAL_DRIVERS}") list(REMOVE_DUPLICATES HAL_DRIVERS) list(REMOVE_DUPLICATES HAL_LL_DRIVERS) -# Checking all the requested drivers +# Step 3 : Checking the other requested components (Expected to be drivers) foreach(COMP ${HAL_FIND_COMPONENTS_UNHANDLED}) string(TOLOWER ${COMP} COMP_L) From 272bce378969714d9ccf7b5ff5b8449118bcfda6 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 1 Nov 2022 16:09:51 +0100 Subject: [PATCH 062/119] FindHAL.cmake: more comments --- cmake/FindHAL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index cbee74f5..7edaaf40 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -23,7 +23,7 @@ function(get_list_hal_drivers out_list_hal_drivers hal_drivers_path hal_driver_t "${hal_drivers_path}/Src/*.c") # For all matched .c files keep only those with a driver name pattern (e.g. stm32xx_hal_rcc.c) list(FILTER filtered_files INCLUDE REGEX ${file_pattern}) - # Retrieve the driver type using the regex's first parenthesis match + # From the files names keep only the driver type part using the regex (stm32xx_hal_(rcc).c or stm32xx_ll_(rcc).c => catches rcc) list(TRANSFORM filtered_files REPLACE ${file_pattern} "\\1") #Making a return by reference by seting the output variable to PARENT_SCOPE set(${out_list_hal_drivers} ${filtered_files} PARENT_SCOPE) From 332307a466154fe5f363a4587b632c21456ae958 Mon Sep 17 00:00:00 2001 From: Timofey Dovgal Date: Sun, 1 Jan 2023 16:15:29 +0300 Subject: [PATCH 063/119] Set lowercase family string in step 2 of find_package(HAL ...); --- cmake/FindHAL.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 7edaaf40..b714ed14 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -62,6 +62,7 @@ foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component set(FAMILY ${CMAKE_MATCH_1}) + string(TOLOWER ${FAMILY} FAMILY_L) endif() find_path(HAL_${FAMILY}_PATH NAMES Inc/stm32${FAMILY_L}xx_hal.h From 55233c837f39acbf00231d8243a31df68558e522 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sat, 7 Jan 2023 23:26:55 +0300 Subject: [PATCH 064/119] stm32: Add support for some G0 devices Added some of G050xx, G051xx, G061xx and G0B0xx devices. --- cmake/stm32/devices.cmake | 36 ++++++++++++++++++++++++++++++++++++ cmake/stm32/g0.cmake | 14 +++++++------- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index c0dcad63..16f3ecad 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -539,6 +539,27 @@ set(STM32_ALL_DEVICES G041K6 G041K8 G041Y8 + G050C6 + G050C8 + G050F6 + G050K6 + G050K8 + G051C6 + G051C8 + G051F6 + G051F8 + G051G6 + G051G8 + G051K6 + G051K8 + G061C6 + G061C8 + G061F6 + G061F8 + G061G6 + G061G8 + G061K6 + G061K8 G070CB G070KB G070RB @@ -560,18 +581,33 @@ set(STM32_ALL_DEVICES G081GB G081KB G081RB + G0B0CE + G0B0KE + G0B0RE + G0B0VE + G0B1CB G0B1CC G0B1CE + G0B1KB G0B1KC G0B1KE + G0B1MB + G0B1MC + G0B1ME + G0B1NE + G0B1RB G0B1RC G0B1RE + G0B1VB G0B1VC G0B1VE G0C1CC G0C1CE G0C1KC G0C1KE + G0C1MC + G0C1ME + G0C1NE G0C1RC G0C1RE G0C1VC diff --git a/cmake/stm32/g0.cmake b/cmake/stm32/g0.cmake index 3fd3c4ec..ce362099 100644 --- a/cmake/stm32/g0.cmake +++ b/cmake/stm32/g0.cmake @@ -1,18 +1,18 @@ set(STM32_G0_TYPES - G030xx G031xx G041xx G070xx G071xx G081xx - G0B1xx G0C1xx + G030xx G031xx G041xx G050xx G051xx G061xx + G070xx G071xx G081xx G0B0xx G0B1xx G0C1xx ) set(STM32_G0_TYPE_MATCH - "G030.." "G031.." "G041.." "G070.." "G071.." "G081.." - "G0B1.." "G0C1.." + "G030.." "G031.." "G041.." "G050.." "G051.." "G061.." + "G070.." "G071.." "G081.." "G0B0.." "G0B1.." "G0C1.." ) set(STM32_G0_RAM_SIZES - 8K 8K 8K 36K 36K 36K - 144k 144K + 8K 8K 8K 18K 18K 18K + 36K 36K 36K 144K 144K 144K ) set(STM32_G0_CCRAM_SIZES 0K 0K 0K 0K 0K 0K - 0K 0K + 0K 0K 0K 0K 0K 0K ) stm32_util_create_family_targets(G0) From cda419e9157fb68e905a1853662852f0677b968f Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sun, 8 Jan 2023 10:39:59 +0300 Subject: [PATCH 065/119] stm32: common: Fix 'stm32_generate_*_file' This patch takes into account that the .elf file name may differ from target name. Now target properties and generator expression used to determine the file path. --- cmake/stm32/common.cmake | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 87851cb7..37e493fb 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -61,33 +61,44 @@ function(stm32_print_size_of_target TARGET) endfunction() function(stm32_generate_binary_file TARGET) + get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) + get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + set(FILE_NAME "${OUTPUT_NAME}.bin") + set(FILE "${BINARY_DIR}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.bin - BYPRODUCTS ${TARGET}.bin - COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O binary "$" ${FILE} + BYPRODUCTS ${FILE} + COMMENT "Generating binary file ${FILE_NAME}" ) endfunction() function(stm32_generate_srec_file TARGET) + get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) + get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + set(FILE_NAME "${OUTPUT_NAME}.srec") + set(FILE "${BINARY_DIR}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O srec ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.srec - BYPRODUCTS ${TARGET}.srec - - COMMENT "Generating srec file ${CMAKE_PROJECT_NAME}.srec" + COMMAND ${CMAKE_OBJCOPY} -O srec "$" ${FILE} + BYPRODUCTS ${FILE} + COMMENT "Generating srec file ${FILE_NAME}" ) endfunction() function(stm32_generate_hex_file TARGET) + get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) + get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + set(FILE_NAME "${OUTPUT_NAME}.hex") + set(FILE "${BINARY_DIR}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O ihex ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} ${TARGET}.hex - BYPRODUCTS ${TARGET}.hex - COMMENT "Generating hex file ${CMAKE_PROJECT_NAME}.hex" + COMMAND ${CMAKE_OBJCOPY} -O ihex "$" ${FILE} + BYPRODUCTS ${FILE} + COMMENT "Generating hex file ${FILE_NAME}" ) endfunction() From 637c95cafc455196b80162972e6c62cacd3d0aae Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sun, 8 Jan 2023 11:17:02 +0300 Subject: [PATCH 066/119] stm32: common: Fix 'stm32_generate_*_file' output file path Target's property 'RUNTIME_OUTPUT_DIRECTORY' better suited for defining output file path. --- cmake/stm32/common.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 37e493fb..91efd73b 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -62,9 +62,9 @@ endfunction() function(stm32_generate_binary_file TARGET) get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) set(FILE_NAME "${OUTPUT_NAME}.bin") - set(FILE "${BINARY_DIR}/${FILE_NAME}") + set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD @@ -76,9 +76,9 @@ endfunction() function(stm32_generate_srec_file TARGET) get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) set(FILE_NAME "${OUTPUT_NAME}.srec") - set(FILE "${BINARY_DIR}/${FILE_NAME}") + set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD @@ -90,9 +90,9 @@ endfunction() function(stm32_generate_hex_file TARGET) get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) set(FILE_NAME "${OUTPUT_NAME}.hex") - set(FILE "${BINARY_DIR}/${FILE_NAME}") + set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD From 01f51f787fd333354284add41b2024293f897418 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Sun, 8 Jan 2023 09:36:51 +0100 Subject: [PATCH 067/119] minor fix --- cmake/stm32/devices.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index 16f3ecad..fa209357 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -607,7 +607,6 @@ set(STM32_ALL_DEVICES G0C1KE G0C1MC G0C1ME - G0C1NE G0C1RC G0C1RE G0C1VC From a142b3a0116f6a279f65c2a70f52f46528ced363 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sat, 21 Jan 2023 12:09:12 +0300 Subject: [PATCH 068/119] stm32: common: Generalize stm32_generate_*_file To comply with the DRY principle, realisation of 'stm32_generate_*_file' functions are generalized in '_stm32_generate_file'. --- cmake/stm32/common.cmake | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 91efd73b..f7fe7117 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -60,46 +60,30 @@ function(stm32_print_size_of_target TARGET) ) endfunction() -function(stm32_generate_binary_file TARGET) +function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) - set(FILE_NAME "${OUTPUT_NAME}.bin") + set(FILE_NAME "${OUTPUT_NAME}.${OUTPUT_EXTENSION}") set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O binary "$" ${FILE} + COMMAND ${CMAKE_OBJCOPY} -O ${OBJCOPY_BFD_OUTPUT} "$" ${FILE} BYPRODUCTS ${FILE} - COMMENT "Generating binary file ${FILE_NAME}" + COMMENT "Generating ${OBJCOPY_BFD_OUTPUT} file ${FILE_NAME}" ) endfunction() +function(stm32_generate_binary_file TARGET) + _stm32_generate_file(${TARGET} "bin" "binary") +endfunction() + function(stm32_generate_srec_file TARGET) - get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) - set(FILE_NAME "${OUTPUT_NAME}.srec") - set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") - add_custom_command( - TARGET ${TARGET} - POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O srec "$" ${FILE} - BYPRODUCTS ${FILE} - COMMENT "Generating srec file ${FILE_NAME}" - ) + _stm32_generate_file(${TARGET} "srec" "srec") endfunction() function(stm32_generate_hex_file TARGET) - get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) - set(FILE_NAME "${OUTPUT_NAME}.hex") - set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") - add_custom_command( - TARGET ${TARGET} - POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O ihex "$" ${FILE} - BYPRODUCTS ${FILE} - COMMENT "Generating hex file ${FILE_NAME}" - ) + _stm32_generate_file(${TARGET} "hex" "ihex") endfunction() # This function takes FAMILY (e.g. L4) and DEVICE (e.g. L496VG) to output TYPE (e.g. L496xx) From 7c4badabd939b6ec6ff039497ea9565b529246a7 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sat, 21 Jan 2023 12:37:50 +0300 Subject: [PATCH 069/119] stm32: common: Refactor '_stm32_generate_file' Variables now have more explicit names. --- cmake/stm32/common.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index f7fe7117..7a40e495 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -61,16 +61,16 @@ function(stm32_print_size_of_target TARGET) endfunction() function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) - get_target_property(OUTPUT_NAME ${TARGET} OUTPUT_NAME) + get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) - set(FILE_NAME "${OUTPUT_NAME}.${OUTPUT_EXTENSION}") - set(FILE "${RUNTIME_OUTPUT_DIRECTORY}/${FILE_NAME}") + set(OUTPUT_FILE_NAME "${TARGET_OUTPUT_NAME}.${OUTPUT_EXTENSION}") + set(OUTPUT_FILE_PATH "${RUNTIME_OUTPUT_DIRECTORY}/${OUTPUT_FILE_NAME}") add_custom_command( TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} -O ${OBJCOPY_BFD_OUTPUT} "$" ${FILE} - BYPRODUCTS ${FILE} - COMMENT "Generating ${OBJCOPY_BFD_OUTPUT} file ${FILE_NAME}" + COMMAND ${CMAKE_OBJCOPY} -O ${OBJCOPY_BFD_OUTPUT} "$" ${OUTPUT_FILE_PATH} + BYPRODUCTS ${OUTPUT_FILE_PATH} + COMMENT "Generating ${OBJCOPY_BFD_OUTPUT} file ${OUTPUT_FILE_NAME}" ) endfunction() From d84bb57bb96a4cbd8ba8041516b7059bdfa61de3 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sun, 22 Jan 2023 00:26:44 +0300 Subject: [PATCH 070/119] stm32: common: Fix '_stm32_generate_file' Fixed bug that occurs when target's property 'RUNTIME_OUTPUT_DIRECTORY' is not defined. --- cmake/stm32/common.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 7a40e495..c4d1a056 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -62,9 +62,15 @@ endfunction() function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) - get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) set(OUTPUT_FILE_NAME "${TARGET_OUTPUT_NAME}.${OUTPUT_EXTENSION}") - set(OUTPUT_FILE_PATH "${RUNTIME_OUTPUT_DIRECTORY}/${OUTPUT_FILE_NAME}") + + get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) + if(RUNTIME_OUTPUT_DIRECTORY) + set(OUTPUT_FILE_PATH "${RUNTIME_OUTPUT_DIRECTORY}/${OUTPUT_FILE_NAME}") + else() + set(OUTPUT_FILE_PATH "${OUTPUT_FILE_NAME}") + endif() + add_custom_command( TARGET ${TARGET} POST_BUILD From 48be18b4fbd04839dc97261b7a89dc8cee0aa3e4 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sun, 22 Jan 2023 13:59:24 +0300 Subject: [PATCH 071/119] stm32: common: Add comments to the 'stm32_generate_*_file' --- cmake/stm32/common.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index c4d1a056..82f2b2be 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -60,6 +60,11 @@ function(stm32_print_size_of_target TARGET) ) endfunction() +# This function calls the objcopy program defined in CMAKE_OBJCOPY to generate +# file with object format specified in OBJCOPY_BFD_OUTPUT. +# The generated file has the name of the target output but with extension +# corresponding to the OUTPUT_EXTENSION argument value. +# The generated file will be placed in the same directory as the target output file. function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) set(OUTPUT_FILE_NAME "${TARGET_OUTPUT_NAME}.${OUTPUT_EXTENSION}") @@ -80,14 +85,20 @@ function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) ) endfunction() +# This function adds post-build generation of the binary file from the target ELF. +# The generated file will be placed in the same directory as the ELF file. function(stm32_generate_binary_file TARGET) _stm32_generate_file(${TARGET} "bin" "binary") endfunction() +# This function adds post-build generation of the Motorola S-record file from the target ELF. +# The generated file will be placed in the same directory as the ELF file. function(stm32_generate_srec_file TARGET) _stm32_generate_file(${TARGET} "srec" "srec") endfunction() +# This function adds post-build generation of the Intel hex file from the target ELF. +# The generated file will be placed in the same directory as the ELF file. function(stm32_generate_hex_file TARGET) _stm32_generate_file(${TARGET} "hex" "ihex") endfunction() From feffcf376b7779efa716f2ebc290a7055a787d75 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Tue, 24 Jan 2023 22:35:56 +0300 Subject: [PATCH 072/119] stm32: common: Fix 'stm32_print_size_of_target' This function now uses a generator expression to get the target path. --- cmake/stm32/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index dde25b25..6108c16a 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -56,7 +56,7 @@ find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt HINTS ${TOOLCHA function(stm32_print_size_of_target TARGET) add_custom_target(${TARGET}_always_display_size - ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} + ALL COMMAND ${CMAKE_SIZE} "$" COMMENT "Target Sizes: " DEPENDS ${TARGET} ) From b29da0d6ff9f62de0c8bf7d614f003b6cf4934fb Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Tue, 24 Jan 2023 23:07:52 +0300 Subject: [PATCH 073/119] stm32: common: Add comments to the 'stm32_print_size_of_target' --- cmake/stm32/common.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 6108c16a..7a425029 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -54,6 +54,9 @@ find_program(CMAKE_SIZE NAMES ${STM32_TARGET_TRIPLET}-size HINTS ${TOOLCHAIN_BIN find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb HINTS ${TOOLCHAIN_BIN_PATH}) find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt HINTS ${TOOLCHAIN_BIN_PATH}) +# This function adds a target with name '${TARGET}_always_display_size'. The new +# target builds a TARGET and then calls the program defined in CMAKE_SIZE to +# display the size of the final ELF. function(stm32_print_size_of_target TARGET) add_custom_target(${TARGET}_always_display_size ALL COMMAND ${CMAKE_SIZE} "$" From 1a20bc18b630fb8ac903d667d5d63ae6452a44b6 Mon Sep 17 00:00:00 2001 From: Alexander Voronov Date: Sat, 28 Jan 2023 12:41:30 +0300 Subject: [PATCH 074/119] stm32: common: Fix '_stm32_generate_file' After cmake 3.10 the target property OUTPUT_NAME is not set by default. This commit adds a check to see if the target property has a value. --- cmake/stm32/common.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 7a425029..8c60fc16 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -72,7 +72,11 @@ endfunction() # The generated file will be placed in the same directory as the target output file. function(_stm32_generate_file TARGET OUTPUT_EXTENSION OBJCOPY_BFD_OUTPUT) get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) - set(OUTPUT_FILE_NAME "${TARGET_OUTPUT_NAME}.${OUTPUT_EXTENSION}") + if (TARGET_OUTPUT_NAME) + set(OUTPUT_FILE_NAME "${TARGET_OUTPUT_NAME}.${OUTPUT_EXTENSION}") + else() + set(OUTPUT_FILE_NAME "${TARGET}.${OUTPUT_EXTENSION}") + endif() get_target_property(RUNTIME_OUTPUT_DIRECTORY ${TARGET} RUNTIME_OUTPUT_DIRECTORY) if(RUNTIME_OUTPUT_DIRECTORY) From a4ff415714c2ccca095afc5e4f679b9e62fa5326 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 21:26:20 +0200 Subject: [PATCH 075/119] Added h5.cmake file --- cmake/stm32/h5.cmake | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmake/stm32/h5.cmake diff --git a/cmake/stm32/h5.cmake b/cmake/stm32/h5.cmake new file mode 100644 index 00000000..9018013b --- /dev/null +++ b/cmake/stm32/h5.cmake @@ -0,0 +1,23 @@ +set(STM32_H5_TYPES + H503xx H562xx H563xx H573xx +) + +set(STM32_H5_TYPE_MATCH + "H503.." "H562.." "H563.." "H573.." +) +set(STM32_H5_RAM_SIZES + 32K 640K 640K 640K +) +set(STM32_H5_CCRAM_SIZES + 0K 0K 0K 0K +) + +stm32_util_create_family_targets(H5) + +target_compile_options(STM32::H5 INTERFACE + -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb +) + +target_link_options(STM32::H5 INTERFACE + -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb +) From 82ff509f766f7d4b1cf4b859b6346f9f924fc82e Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 21:35:58 +0200 Subject: [PATCH 076/119] docs:Added doc to add new family --- docs/MAINTAIN.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docs/MAINTAIN.md diff --git a/docs/MAINTAIN.md b/docs/MAINTAIN.md new file mode 100644 index 00000000..98b878ba --- /dev/null +++ b/docs/MAINTAIN.md @@ -0,0 +1,7 @@ +# Supporting new families + +## Write device file + +a file .cmake must be added to the folder cmake/stm32 +This file containes the differents devices and the regex used to parse them. +It also give information on the RAM and CCRAM available From ecaefbe8570a470d79012abd29d29228c7ec1f04 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 21:58:05 +0200 Subject: [PATCH 077/119] common.cmake:Added H5 to STM32_SUPPORTED_FAMILIES_LONG_NAME --- cmake/stm32/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 8c60fc16..667cf26b 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -1,7 +1,7 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32F0 STM32F1 STM32F2 STM32F3 STM32F4 STM32F7 STM32G0 STM32G4 - STM32H7_M4 STM32H7_M7 + STM32H5 STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5 STM32U5 STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS From 0ab59569448e5ba7ceaa0dd8dec14a894f9b6ce7 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 22:05:49 +0200 Subject: [PATCH 078/119] CI: Added H5 family to CI run --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index df1b0b5c..be9a3d0b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - family: [F0, F1, F2, F3, F4, F7, G0, G4, H7, L0, L1, L4, L5, U5, WB, WL, MP1] + family: [F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U5, WB, WL, MP1] fail-fast: false steps: From ae613dc521c88a06e7ab1caa3aaae279d4699880 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 22:06:40 +0200 Subject: [PATCH 079/119] TRASH: CI: Removed all but H5 from tests --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index be9a3d0b..11f0be80 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - family: [F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U5, WB, WL, MP1] + family: [H5] fail-fast: false steps: From 93725b7de1a0f95ebc8bf2bdc2028155fbaf9d9c Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 22:14:43 +0200 Subject: [PATCH 080/119] maintiain.md added more info --- docs/MAINTAIN.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/MAINTAIN.md b/docs/MAINTAIN.md index 98b878ba..66e75860 100644 --- a/docs/MAINTAIN.md +++ b/docs/MAINTAIN.md @@ -5,3 +5,12 @@ a file .cmake must be added to the folder cmake/stm32 This file containes the differents devices and the regex used to parse them. It also give information on the RAM and CCRAM available + +## Add family to list of know families + +Update the list `STM32_SUPPORTED_FAMILIES_LONG_NAME` located in the cmake/stm32/common.cmake file + + +## Add family to CI + +Update the cmake.yml workflow file to include the new family From 9ffdd498a84b9f68be1d02b84ab4f4df8de270f9 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Fri, 21 Apr 2023 22:55:10 +0200 Subject: [PATCH 081/119] utilities.cmake: Added versions for fetch feature --- cmake/stm32/utilities.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index d6405be5..661110a1 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -43,10 +43,10 @@ endfunction() include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository -set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) +set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) +set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.0.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v5.6.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.0.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) FetchContent_Declare( STM32-CMSIS From 8bf05203f4b70042c889739d68f3de4beff4787c Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Sun, 23 Apr 2023 19:49:22 +0200 Subject: [PATCH 082/119] h5: fixed cpu core to cortex-m33 --- cmake/stm32/h5.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/h5.cmake b/cmake/stm32/h5.cmake index 9018013b..beae218c 100644 --- a/cmake/stm32/h5.cmake +++ b/cmake/stm32/h5.cmake @@ -15,9 +15,9 @@ set(STM32_H5_CCRAM_SIZES stm32_util_create_family_targets(H5) target_compile_options(STM32::H5 INTERFACE - -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb + -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb ) target_link_options(STM32::H5 INTERFACE - -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb + -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb ) From 443b732f4744c599dcfdcc8a4ea61b056dc44dcf Mon Sep 17 00:00:00 2001 From: Simone Ruffini <50401154+simoneruffini@users.noreply.github.com> Date: Mon, 15 May 2023 23:29:49 +0200 Subject: [PATCH 083/119] feat: added reference to system_stm32fxx in CMSIS targets --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7365f8e..ba18de14 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ STM32WB is a multi-cores device even if the second core is not accessible by end CMSIS consists of three main components: * Family-specific headers, e.g. `stm32f4xx.h` +* Cortex peripheral access layer header and source, e.g. `system_stm32f4xx.[c|h]` * Device type-specific startup sources (e.g. `startup_stm32f407xx.s`) (if ASM language is enabled) * Device-specific linker scripts which requires information about memory sizes (if ASM language is enabled) @@ -118,12 +119,12 @@ Every CMSIS component is CMake's target (aka library), which defines compiler de add_executable(stm32-template main.c) target_link_libraries(stm32-template CMSIS::STM32::F407VG) ``` -That will add include directories, startup source, linker script and compiler flags to your executable. +That will add include directories, coretx peripheral layere files, startup source, linker script and compiler flags to your executable. CMSIS creates the following targets: * `CMSIS::STM32::` (e.g. `CMSIS::STM32::F4`) - common includes, compiler flags and defines for family -* `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407xx`) - common startup source for device type, depends on `CMSIS::STM32::` +* `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407xx`) - common startup source for device type and cortex peripheral access layer files, depends on `CMSIS::STM32::` * `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407VG`) - linker script for device, depends on `CMSIS::STM32::` So, if you don't need linker script, you can link only `CMSIS::STM32::` library and provide your own script using `stm32_add_linker_script` function From ee4f556a26662d12bde793768afd1fd8dd253076 Mon Sep 17 00:00:00 2001 From: Hish15 Date: Tue, 16 May 2023 13:18:55 +0200 Subject: [PATCH 084/119] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba18de14..cd905ccd 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ STM32WB is a multi-cores device even if the second core is not accessible by end CMSIS consists of three main components: * Family-specific headers, e.g. `stm32f4xx.h` -* Cortex peripheral access layer header and source, e.g. `system_stm32f4xx.[c|h]` +* Peripheral access layer header and source, e.g. `system_stm32f4xx.[c|h]` * Device type-specific startup sources (e.g. `startup_stm32f407xx.s`) (if ASM language is enabled) * Device-specific linker scripts which requires information about memory sizes (if ASM language is enabled) @@ -124,7 +124,7 @@ That will add include directories, coretx peripheral layere files, startup sourc CMSIS creates the following targets: * `CMSIS::STM32::` (e.g. `CMSIS::STM32::F4`) - common includes, compiler flags and defines for family -* `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407xx`) - common startup source for device type and cortex peripheral access layer files, depends on `CMSIS::STM32::` +* `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407xx`) - common startup source for device type and peripheral access layer files, depends on `CMSIS::STM32::` * `CMSIS::STM32::` (e.g. `CMSIS::STM32::F407VG`) - linker script for device, depends on `CMSIS::STM32::` So, if you don't need linker script, you can link only `CMSIS::STM32::` library and provide your own script using `stm32_add_linker_script` function From eb4a0c457352905520c11bb6bf87bf1a75597e45 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 16 May 2023 13:41:11 +0200 Subject: [PATCH 085/119] Readme.md:Corrected typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd905ccd..58b16d5a 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Every CMSIS component is CMake's target (aka library), which defines compiler de add_executable(stm32-template main.c) target_link_libraries(stm32-template CMSIS::STM32::F407VG) ``` -That will add include directories, coretx peripheral layere files, startup source, linker script and compiler flags to your executable. +That will add include directories, peripheral layer files, startup source, linker script and compiler flags to your executable. CMSIS creates the following targets: From f79ca66e9f3dd3f2bc6a9a93093dfab0aed8610e Mon Sep 17 00:00:00 2001 From: David Drinn Date: Tue, 12 Sep 2023 09:53:09 -0700 Subject: [PATCH 086/119] Update U5 to latest STM32 Cube FW Package --- cmake/stm32/utilities.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index d6405be5..a04198d2 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -44,9 +44,9 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.9.0 v1.1.0) +set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube cube v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube cube v1.9.0 v1.1.0) FetchContent_Declare( STM32-CMSIS From f209fe8196a364cda1a296526a754d5c14375c68 Mon Sep 17 00:00:00 2001 From: Julien Staub Date: Tue, 12 Sep 2023 19:12:13 +0200 Subject: [PATCH 087/119] Update cmake/stm32/utilities.cmake --- cmake/stm32/utilities.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index a04198d2..baf672f3 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -45,8 +45,9 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube cube v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube cube v1.9.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) + FetchContent_Declare( STM32-CMSIS From 340c6990e307e12802ef1730b3f42255d8a190d5 Mon Sep 17 00:00:00 2001 From: Kirill Kotyagin Date: Sat, 7 Oct 2023 13:35:57 +0300 Subject: [PATCH 088/119] stm32: common: Fix STM32_TARGET_TRIPLET --- cmake/stm32/common.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 8c60fc16..4fbd1e0c 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -34,8 +34,14 @@ if(NOT STM32_TOOLCHAIN_PATH) endif() if(NOT STM32_TARGET_TRIPLET) - set(STM32_TARGET_TRIPLET "arm-none-eabi") - message(STATUS "No STM32_TARGET_TRIPLET specified, using default: " ${STM32_TARGET_TRIPLET}) + if(DEFINED ENV{STM32_TARGET_TRIPLET}) + message(STATUS "Detected toolchain path STM32_TARGET_TRIPLET in environmental variables: ") + message(STATUS "$ENV{STM32_TARGET_TRIPLET}") + set(STM32_TARGET_TRIPLET $ENV{STM32_TARGET_TRIPLET}) + else() + set(STM32_TARGET_TRIPLET "arm-none-eabi") + message(STATUS "No STM32_TARGET_TRIPLET specified, using default: " ${STM32_TARGET_TRIPLET}) + endif() endif() set(CMAKE_SYSTEM_NAME Generic) From 684e5a046d7f1f868219a624f2f62adfa57fd0d2 Mon Sep 17 00:00:00 2001 From: Kirill Kotyagin Date: Sat, 7 Oct 2023 13:36:58 +0300 Subject: [PATCH 089/119] Fix README.md (TARGET_TRIPLET) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58b16d5a..bf4342d6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ These configuration variables are optional: * `STM32_TOOLCHAIN_PATH` - where toolchain is located, **default**: `/usr`. Alternatively you can add the folder containing the toolchain binaries to the system path. If both are given, the `STM32_TOOLCHAIN_PATH` setting takes precedence -* `TARGET_TRIPLET` - toolchain target triplet, **default**: `arm-none-eabi` +* `STM32_TARGET_TRIPLET` - toolchain target triplet, **default**: `arm-none-eabi` * `FREERTOS_PATH` - Path to the FreeRTOS kernel when compiling with a RTOS. Does not need to be specified when using CMSIS @@ -74,7 +74,7 @@ If you have access to a Unix shell, which is the default terminal on Linux, or t ```sh export STM32_TOOLCHAIN_PATH="" -export TARGET_TRIPLET=arm-none-eabi +export STM32_TARGET_TRIPLET=arm-none-eabi export STM32_CUBE__PATH="" ``` @@ -86,7 +86,7 @@ On Windows, you can use a Powershell script `path_helper.ps1`to set up the envir ```sh $env:STM32_TOOLCHAIN_PATH = "" -$env:TARGET_TRIPLET = arm-none-eabi +$env:STM32_TARGET_TRIPLET = arm-none-eabi $env:STM32_CUBE__PATH="" ``` From ff41f63aca4fd78f702c2fc48d28881e069e249a Mon Sep 17 00:00:00 2001 From: Kirill Kotyagin Date: Sat, 7 Oct 2023 13:39:10 +0300 Subject: [PATCH 090/119] stm32: common: Fix target triplet status message --- cmake/stm32/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 4fbd1e0c..ef94372b 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -35,7 +35,7 @@ endif() if(NOT STM32_TARGET_TRIPLET) if(DEFINED ENV{STM32_TARGET_TRIPLET}) - message(STATUS "Detected toolchain path STM32_TARGET_TRIPLET in environmental variables: ") + message(STATUS "Detected target triplet STM32_TARGET_TRIPLET in environmental variables: ") message(STATUS "$ENV{STM32_TARGET_TRIPLET}") set(STM32_TARGET_TRIPLET $ENV{STM32_TARGET_TRIPLET}) else() From 91f3bd74e7313058eab0eb173e268507cae90e22 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Tue, 14 Nov 2023 09:24:05 +0100 Subject: [PATCH 091/119] Add STM32C0 support --- .github/workflows/cmake.yml | 2 +- cmake/FindBSP.cmake | 2 +- cmake/FindCMSIS.cmake | 4 +- cmake/FindFreeRTOS.cmake | 4 +- cmake/FindHAL.cmake | 6 +- cmake/stm32/c0.cmake | 25 +++ cmake/stm32/common.cmake | 8 +- cmake/stm32/devices.cmake | 13 ++ cmake/stm32/utilities.cmake | 8 +- tests/bsp/CMakeLists.txt | 3 +- tests/bsp/stm32c0xx_hal_conf.h | 275 +++++++++++++++++++++++++++++++ tests/cmsis/CMakeLists.txt | 2 +- tests/fetch/CMakeLists.txt | 2 +- tests/fetch/stm32c0xx_hal_conf.h | 275 +++++++++++++++++++++++++++++++ tests/hal/CMakeLists.txt | 2 +- tests/hal/stm32c0xx_hal_conf.h | 275 +++++++++++++++++++++++++++++++ 16 files changed, 886 insertions(+), 20 deletions(-) create mode 100644 cmake/stm32/c0.cmake create mode 100644 tests/bsp/stm32c0xx_hal_conf.h create mode 100644 tests/fetch/stm32c0xx_hal_conf.h create mode 100644 tests/hal/stm32c0xx_hal_conf.h diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index df1b0b5c..6c56c5a4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - family: [F0, F1, F2, F3, F4, F7, G0, G4, H7, L0, L1, L4, L5, U5, WB, WL, MP1] + family: [C0, F0, F1, F2, F3, F4, F7, G0, G4, H7, L0, L1, L4, L5, U5, WB, WL, MP1] fail-fast: false steps: diff --git a/cmake/FindBSP.cmake b/cmake/FindBSP.cmake index 7fac5705..e5617d75 100644 --- a/cmake/FindBSP.cmake +++ b/cmake/FindBSP.cmake @@ -300,7 +300,7 @@ foreach(COMP ${BSP_FIND_COMPONENTS}) string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(NOT CMAKE_MATCH_1) message(FATAL_ERROR "Unknown BSP component: ${COMP}") endif() diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index fe5d5efc..d6a1a7c2 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -43,7 +43,7 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS}) endif() # Component is not RTOS component, so check whether it is a family component - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) if(CMAKE_MATCH_1) list(APPEND CMSIS_FIND_COMPONENTS_FAMILIES ${COMP}) endif() @@ -113,7 +113,7 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS_FAMILIES}) string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) # CMAKE_MATCH_ contains n'th subexpression # CMAKE_MATCH_0 contains full match diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index a7dbe25b..0e7fd121 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -44,7 +44,7 @@ endif() # This section fills the family and ports components list foreach(COMP ${FreeRTOS_FIND_COMPONENTS}) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP}) # Valid family component, so add it (e.g. STM32H7) if(CMAKE_MATCH_1) list(APPEND FreeRTOS_FIND_COMPONENTS_FAMILIES ${FAMILY_COMP}) @@ -207,7 +207,7 @@ else() string(TOLOWER ${COMP} COMP_L) string(TOUPPER ${COMP} COMP) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) if((NOT CMAKE_MATCH_1) AND (NOT CMAKE_MATCH_2)) message(FATAL_ERROR "Unknown FreeRTOS component: ${COMP}") diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index b714ed14..d275b4e6 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -42,7 +42,7 @@ endfunction() # Step 1 : Checking all the requested families foreach(COMP ${HAL_FIND_COMPONENTS}) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component list(APPEND HAL_FIND_COMPONENTS_FAMILIES ${COMP}) message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_FAMILIES") @@ -59,7 +59,7 @@ endif() # Step 2 : Generating all the valid drivers from requested families foreach(family_comp ${HAL_FIND_COMPONENTS_FAMILIES}) string(TOUPPER ${family_comp} family_comp) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" family_comp ${family_comp}) if(CMAKE_MATCH_1) #Matches the family part of the provided STM32[..] component set(FAMILY ${CMAKE_MATCH_1}) string(TOLOWER ${FAMILY} FAMILY_L) @@ -143,7 +143,7 @@ message(STATUS "Search for HAL LL drivers: ${HAL_FIND_COMPONENTS_DRIVERS_LL}") foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) string(TOUPPER ${COMP} COMP_U) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP_U ${COMP_U}) if(CMAKE_MATCH_3) set(CORE ${CMAKE_MATCH_3}) set(CORE_C "::${CORE}") diff --git a/cmake/stm32/c0.cmake b/cmake/stm32/c0.cmake new file mode 100644 index 00000000..8150b56f --- /dev/null +++ b/cmake/stm32/c0.cmake @@ -0,0 +1,25 @@ +set(STM32_C0_TYPES + C011xx + C031xx +) +set(STM32_C0_TYPE_MATCH + "C011.." + "C031.." +) +set(STM32_C0_RAM_SIZES + 6K + 12K +) +set(STM32_C0_CCRAM_SIZES + 0K 0K + 0K 0K +) + +stm32_util_create_family_targets(C0) + +target_compile_options(STM32::C0 INTERFACE + -mcpu=cortex-m0plus +) +target_link_options(STM32::C0 INTERFACE + -mcpu=cortex-m0plus +) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index ef94372b..a35cf0af 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -1,4 +1,5 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32C0 STM32F0 STM32F1 STM32F2 STM32F3 STM32F4 STM32F7 STM32G0 STM32G4 STM32H7_M4 STM32H7_M7 @@ -9,7 +10,7 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME foreach(FAMILY ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) # append short names (F0, F1, H7_M4, ...) to STM32_SUPPORTED_FAMILIES_SHORT_NAME - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])_?(M0PLUS|M4|M7)?" FAMILY ${FAMILY}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])_?(M0PLUS|M4|M7)?" FAMILY ${FAMILY}) list(APPEND STM32_SUPPORTED_FAMILIES_SHORT_NAME ${CMAKE_MATCH_1}) endforeach() list(REMOVE_DUPLICATES STM32_SUPPORTED_FAMILIES_SHORT_NAME) @@ -142,7 +143,7 @@ function(stm32_get_chip_info CHIP) string(TOUPPER ${CHIP} CHIP) - string(REGEX MATCH "^STM32([FGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP}) + string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP}) if((NOT CMAKE_MATCH_1) OR (NOT CMAKE_MATCH_2)) message(FATAL_ERROR "Unknown chip ${CHIP}") @@ -228,7 +229,7 @@ function(stm32_get_memory_info) stm32_get_chip_type(${INFO_FAMILY} ${INFO_DEVICE} INFO_TYPE) endif() - string(REGEX REPLACE "^[FGHLMUW]P?[0-9BL][0-9A-Z][0-9M].([3468ABCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE}) + string(REGEX REPLACE "^[CFGHLMUW]P?[0-9BL][0-9A-Z][0-9M].([3468ABCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE}) if(SIZE_CODE STREQUAL "3") set(FLASH "8K") @@ -380,6 +381,7 @@ if(NOT (TARGET STM32::Nano::FloatScan)) endif() include(stm32/utilities) +include(stm32/c0) include(stm32/f0) include(stm32/f1) include(stm32/f2) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index fa209357..f69c9ba9 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1,4 +1,17 @@ set(STM32_ALL_DEVICES + C011D6 + C011F4 + C011F6 + C011J4 + C011J6 + C031C4 + C031C6 + C031F4 + C031F6 + C031G4 + C031G6 + C031K4 + C031K6 F030C6 F030C8 F030CC diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index baf672f3..8ede1e70 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -43,10 +43,10 @@ endfunction() include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository -set(STM32_FETCH_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL ) +set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) FetchContent_Declare( diff --git a/tests/bsp/CMakeLists.txt b/tests/bsp/CMakeLists.txt index f68fe9e1..83cdf930 100644 --- a/tests/bsp/CMakeLists.txt +++ b/tests/bsp/CMakeLists.txt @@ -2,10 +2,11 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() # Nucleo boards can have different devices on it +set(DEVICE_STM32C0xx_Nucleo C031C6) set(DEVICE_STM32F0xx_Nucleo_32 F031K6) set(DEVICE_STM32F0xx_Nucleo F030R8) set(DEVICE_STM32F1xx_Nucleo F103RB) diff --git a/tests/bsp/stm32c0xx_hal_conf.h b/tests/bsp/stm32c0xx_hal_conf.h new file mode 100644 index 00000000..1a12a99e --- /dev/null +++ b/tests/bsp/stm32c0xx_hal_conf.h @@ -0,0 +1,275 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32c0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32c0xx_hal_conf.h. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 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 STM32C0xx_HAL_CONF_H +#define STM32C0xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Register Callbacks selection ############################## */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32c0xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_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 */ + +/* ########################## 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 (8000000U) /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @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 (48000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ +/** + * @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 */ + +/** + * @brief External clock source for I2S1 peripheral + * This value is used by the RCC HAL module to compute the I2S1 clock source + * frequency. + */ +#if !defined (EXTERNAL_I2S1_CLOCK_VALUE) +#define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ +#endif /* EXTERNAL_I2S1_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 3U /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include modules header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32c0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32c0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32c0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32c0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32c0xx_hal_adc.h" + #include "stm32c0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32c0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32c0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32c0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32c0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32c0xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32c0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32c0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32c0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32c0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32c0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32c0xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32c0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32c0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32c0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32c0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32c0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for functions 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); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32C0xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index a62179d5..7c52a0af 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) endif() if("MP1" IN_LIST TEST_FAMILIES) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index f3082999..3709d382 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES diff --git a/tests/fetch/stm32c0xx_hal_conf.h b/tests/fetch/stm32c0xx_hal_conf.h new file mode 100644 index 00000000..c8b7208d --- /dev/null +++ b/tests/fetch/stm32c0xx_hal_conf.h @@ -0,0 +1,275 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32c0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32c0xx_hal_conf.h. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 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 STM32C0xx_HAL_CONF_H +#define STM32C0xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CRC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +/* #define HAL_I2C_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_PCD_MODULE_ENABLED */ +/* #define HAL_RNG_MODULE_ENABLED */ +/* #define HAL_RTC_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_SPI_MODULE_ENABLED */ +/* #define HAL_TIM_MODULE_ENABLED */ +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Register Callbacks selection ############################## */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32c0xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_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 */ + +/* ########################## 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 (8000000U) /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @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 (48000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ +/** + * @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 */ + +/** + * @brief External clock source for I2S1 peripheral + * This value is used by the RCC HAL module to compute the I2S1 clock source + * frequency. + */ +#if !defined (EXTERNAL_I2S1_CLOCK_VALUE) +#define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ +#endif /* EXTERNAL_I2S1_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 3U /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include modules header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32c0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32c0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32c0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32c0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32c0xx_hal_adc.h" + #include "stm32c0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32c0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32c0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32c0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32c0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32c0xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32c0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32c0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32c0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32c0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32c0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32c0xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32c0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32c0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32c0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32c0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32c0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for functions 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); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32C0xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index 4b14e386..60530684 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) endif() # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES diff --git a/tests/hal/stm32c0xx_hal_conf.h b/tests/hal/stm32c0xx_hal_conf.h new file mode 100644 index 00000000..c8b7208d --- /dev/null +++ b/tests/hal/stm32c0xx_hal_conf.h @@ -0,0 +1,275 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file stm32c0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32c0xx_hal_conf.h. + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 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 STM32C0xx_HAL_CONF_H +#define STM32C0xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_CRC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +/* #define HAL_I2C_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_PCD_MODULE_ENABLED */ +/* #define HAL_RNG_MODULE_ENABLED */ +/* #define HAL_RTC_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_SPI_MODULE_ENABLED */ +/* #define HAL_TIM_MODULE_ENABLED */ +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Register Callbacks selection ############################## */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32c0xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_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 */ + +/* ########################## 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 (8000000U) /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @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 (48000000UL) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ +/** + * @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 */ + +/** + * @brief External clock source for I2S1 peripheral + * This value is used by the RCC HAL module to compute the I2S1 clock source + * frequency. + */ +#if !defined (EXTERNAL_I2S1_CLOCK_VALUE) +#define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ +#endif /* EXTERNAL_I2S1_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 3U /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include modules header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32c0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32c0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32c0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32c0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32c0xx_hal_adc.h" + #include "stm32c0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32c0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32c0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32c0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32c0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32c0xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32c0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32c0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32c0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32c0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32c0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32c0xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32c0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32c0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32c0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32c0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32c0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for functions 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); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32C0xx_HAL_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ From 58dfa5b832d051841fb34cc3bf7cf8720ddbc471 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Tue, 14 Nov 2023 10:10:40 +0100 Subject: [PATCH 092/119] fix residual CGRAM list --- cmake/stm32/c0.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/c0.cmake b/cmake/stm32/c0.cmake index 8150b56f..05d4c557 100644 --- a/cmake/stm32/c0.cmake +++ b/cmake/stm32/c0.cmake @@ -11,8 +11,8 @@ set(STM32_C0_RAM_SIZES 12K ) set(STM32_C0_CCRAM_SIZES - 0K 0K - 0K 0K + 0K + 0K ) stm32_util_create_family_targets(C0) From 1e6bcd93318a8283243bab4d5eabad0a8b9d396b Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Tue, 14 Nov 2023 10:11:52 +0100 Subject: [PATCH 093/119] fix MATCH regex to match only existing FLASH SIZE variants --- cmake/stm32/c0.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/c0.cmake b/cmake/stm32/c0.cmake index 05d4c557..165b0e03 100644 --- a/cmake/stm32/c0.cmake +++ b/cmake/stm32/c0.cmake @@ -3,8 +3,8 @@ set(STM32_C0_TYPES C031xx ) set(STM32_C0_TYPE_MATCH - "C011.." - "C031.." + "C011.[46]" + "C031.[46]" ) set(STM32_C0_RAM_SIZES 6K From 0a1a062aaf7d10e75649dd66615550e134b09799 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Tue, 14 Nov 2023 17:41:18 +0100 Subject: [PATCH 094/119] Add C0 MCU in supported devices families --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf4342d6..513d34bf 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Tests](https://github.com/ObKo/stm32-cmake/workflows/Tests/badge.svg) This project is used to develop applications for the STM32 - ST's ARM Cortex-Mx MCUs. -It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL device families. +It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL device families. ## Requirements @@ -56,7 +56,7 @@ The most important set of variables which needs to be set can be found in the fo These configuration options need to be set for the build process to work properly: * `STM32_CUBE__PATH` - path to STM32Cube directory, where `` is one - of `F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL` **default**: `/opt/STM32Cube` + of `C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL` **default**: `/opt/STM32Cube` These configuration variables are optional: From 9e2a5802470f8913614ac429b5d2c2758da5f838 Mon Sep 17 00:00:00 2001 From: Hish15 Date: Tue, 19 Dec 2023 10:55:52 +0100 Subject: [PATCH 095/119] Updated CMSIS version to v5.9.0 for H5 family --- cmake/stm32/utilities.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 174ec28c..9b55fe28 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -45,7 +45,8 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.0.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v5.6.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v5.9.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) + set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.0.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) From c6c84f487c2ef36bc1fcbe96ba1538c63d6ea36e Mon Sep 17 00:00:00 2001 From: Hish15 Date: Wed, 20 Dec 2023 11:05:33 +0100 Subject: [PATCH 096/119] Corrected CMSIS and HAL versions --- cmake/stm32/utilities.cmake | 5 +++-- docs/MAINTAIN.md | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 9b55fe28..c16e4ebe 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -45,9 +45,10 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.0.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v5.9.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) + +set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.0.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) FetchContent_Declare( diff --git a/docs/MAINTAIN.md b/docs/MAINTAIN.md index 66e75860..dfd9dd26 100644 --- a/docs/MAINTAIN.md +++ b/docs/MAINTAIN.md @@ -10,7 +10,13 @@ It also give information on the RAM and CCRAM available Update the list `STM32_SUPPORTED_FAMILIES_LONG_NAME` located in the cmake/stm32/common.cmake file +## Update cube, cmsis and hal version in utilities.cmake +The versions to use can be found as follow: + - Cube version : a valid tag from the repo https://github.com/STMicroelectronics/STM32Cube${FAMILY} + - Cmsis version : a valid tag from the repo https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L} + - Hal version : a valid tag from the repo https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver + ## Add family to CI Update the cmake.yml workflow file to include the new family From 9b57e2e610cec4ac0533ef6ff69b679c6bc405f3 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 20 Dec 2023 14:37:28 +0100 Subject: [PATCH 097/119] common.cmake includes h5 properly --- cmake/stm32/common.cmake | 1 + cmake/stm32/utilities.cmake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 141e7e86..15e788b4 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -390,6 +390,7 @@ include(stm32/f4) include(stm32/f7) include(stm32/g0) include(stm32/g4) +include(stm32/h5) include(stm32/h7) include(stm32/l0) include(stm32/l1) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index c16e4ebe..0814a372 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -44,7 +44,7 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.0.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) From e37e0debf6d4e9ed3ef76d5946234170881b4733 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 20 Dec 2023 15:05:03 +0100 Subject: [PATCH 098/119] Added H5 devices to list of known devices --- cmake/stm32/common.cmake | 3 ++- cmake/stm32/devices.cmake | 31 +++++++++++++++++++++++++++++++ docs/MAINTAIN.md | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 15e788b4..2c385496 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -2,7 +2,8 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32C0 STM32F0 STM32F1 STM32F2 STM32F3 STM32F4 STM32F7 STM32G0 STM32G4 - STM32H5 STM32H7_M4 STM32H7_M7 + STM32H5 + STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5 STM32U5 STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index f69c9ba9..43d79cd0 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -718,6 +718,37 @@ set(STM32_ALL_DEVICES G4A1RE G4A1VE GBK1CB + H503CB + H503EB + H503KB + H503RB + H562AG + H562AI + H562IG + H562II + H562RG + H562RI + H562VG + H562VI + H562ZG + H562ZI + H563AG + H563AI + H563IG + H563II + H563MI + H563RG + H563RI + H563VG + H563VI + H563ZG + H563ZI + H573AI + H573II + H573MI + H573RI + H573VI + H573ZI H723VE H723VG H723ZE diff --git a/docs/MAINTAIN.md b/docs/MAINTAIN.md index dfd9dd26..bcb40ea9 100644 --- a/docs/MAINTAIN.md +++ b/docs/MAINTAIN.md @@ -10,6 +10,10 @@ It also give information on the RAM and CCRAM available Update the list `STM32_SUPPORTED_FAMILIES_LONG_NAME` located in the cmake/stm32/common.cmake file +## Add devices to list of devices in devices.cmake + +Add all known devices to the list of all devices + ## Update cube, cmsis and hal version in utilities.cmake The versions to use can be found as follow: From d9f8585caedaf2bfb6d464eac4dc66420812748d Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 20 Dec 2023 15:10:35 +0100 Subject: [PATCH 099/119] Added conf file for all tests --- tests/bsp/stm32h5xx_hal_conf.h | 488 +++++++++++++++++++++++++++++++ tests/cmsis/stm32h5xx_hal_conf.h | 488 +++++++++++++++++++++++++++++++ tests/fetch/stm32h5xx_hal_conf.h | 488 +++++++++++++++++++++++++++++++ tests/hal/stm32h5xx_hal_conf.h | 488 +++++++++++++++++++++++++++++++ 4 files changed, 1952 insertions(+) create mode 100644 tests/bsp/stm32h5xx_hal_conf.h create mode 100644 tests/cmsis/stm32h5xx_hal_conf.h create mode 100644 tests/fetch/stm32h5xx_hal_conf.h create mode 100644 tests/hal/stm32h5xx_hal_conf.h diff --git a/tests/bsp/stm32h5xx_hal_conf.h b/tests/bsp/stm32h5xx_hal_conf.h new file mode 100644 index 00000000..c453c736 --- /dev/null +++ b/tests/bsp/stm32h5xx_hal_conf.h @@ -0,0 +1,488 @@ +/** + ********************************************************************************************************************** + * @file stm32h5xx_hal_conf_template.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32h5xx_hal_conf.h. + ********************************************************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ********************************************************************************************************************** + */ + +/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ +#ifndef STM32H5xx_HAL_CONF_H +#define STM32H5xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ----------------------------------------------------------------------------------------------------*/ +/* Exported constants ------------------------------------------------------------------------------------------------*/ + +/* ########################################### Module Selection ##################################################### */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_COMP_MODULE_ENABLED +#define HAL_CORDIC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCACHE_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_DTS_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_ETH_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_FMAC_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_GTZC_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HCD_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_I3C_MODULE_ENABLED +#define HAL_ICACHE_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_MMC_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OTFDEC_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PKA_MODULE_ENABLED +#define HAL_PSSI_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RAMCFG_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_XSPI_MODULE_ENABLED + +/* ####################################### 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 25000000UL /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @brief Internal Core Speed oscillator (CSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when CSI is used as system clock source, directly or through the PLL). + */ +#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 (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ + +/** + * @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 */ + + +/** + * @brief External clock source for SPI/SAI peripheral + * This value is used by the SPI/SAI HAL module to compute the SPI/SAI 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 ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U /*!< Enable prefetch */ + +/* ############################################ Assert Selection #################################################### */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ############################################ Register callback feature configuration ############################# */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32h5xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#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_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_NOR_REGISTER_CALLBACKS 0U /* NOR 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_I3C_REGISTER_CALLBACKS 0U /* I3C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OPAMP register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_PKA_REGISTER_CALLBACKS 0U /* PKA register callback disabled */ +#define USE_HAL_RAMCFG_REGISTER_CALLBACKS 0U /* RAMCFG 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_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_SRAM_REGISTER_CALLBACKS 0U /* SRAM 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_XSPI_REGISTER_CALLBACKS 0U /* XSPI register callback disabled */ + +/* ############################################ SPI peripheral configuration ######################################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#define USE_SPI_CRC 1U + + +/* Includes ----------------------------------------------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32h5xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32h5xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_ICACHE_MODULE_ENABLED +#include "stm32h5xx_hal_icache.h" +#endif /* HAL_ICACHE_MODULE_ENABLED */ + +#ifdef HAL_DCACHE_MODULE_ENABLED +#include "stm32h5xx_hal_dcache.h" +#endif /* HAL_DCACHE_MODULE_ENABLED */ + +#ifdef HAL_GTZC_MODULE_ENABLED +#include "stm32h5xx_hal_gtzc.h" +#endif /* HAL_GTZC_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32h5xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DTS_MODULE_ENABLED +#include "stm32h5xx_hal_dts.h" +#endif /* HAL_DTS_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32h5xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED +#include "stm32h5xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32h5xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32h5xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32h5xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32h5xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32h5xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32h5xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32h5xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32h5xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32h5xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32h5xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32h5xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_I3C_MODULE_ENABLED +#include "stm32h5xx_hal_i3c.h" +#endif /* HAL_I3C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32h5xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32h5xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32h5xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_XSPI_MODULE_ENABLED +#include "stm32h5xx_hal_xspi.h" +#endif /* HAL_XSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32h5xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32h5xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32h5xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32h5xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32h5xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32h5xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32h5xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32h5xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32h5xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32h5xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32h5xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32h5xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32h5xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32h5xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32h5xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CORDIC_MODULE_ENABLED +#include "stm32h5xx_hal_cordic.h" +#endif /* HAL_CORDIC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32h5xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32h5xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32h5xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED +#include "stm32h5xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32h5xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMAC_MODULE_ENABLED +#include "stm32h5xx_hal_fmac.h" +#endif /* HAL_FMAC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32h5xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OTFDEC_MODULE_ENABLED +#include "stm32h5xx_hal_otfdec.h" +#endif /* HAL_OTFDEC_MODULE_ENABLED */ + +#ifdef HAL_PSSI_MODULE_ENABLED +#include "stm32h5xx_hal_pssi.h" +#endif /* HAL_PSSI_MODULE_ENABLED */ + +#ifdef HAL_RAMCFG_MODULE_ENABLED +#include "stm32h5xx_hal_ramcfg.h" +#endif /* HAL_RAMCFG_MODULE_ENABLED */ + +/* Exported macro ----------------------------------------------------------------------------------------------------*/ +#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__)) +/* Exported functions ----------------------------------------------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32H5xx_HAL_CONF_H */ diff --git a/tests/cmsis/stm32h5xx_hal_conf.h b/tests/cmsis/stm32h5xx_hal_conf.h new file mode 100644 index 00000000..c453c736 --- /dev/null +++ b/tests/cmsis/stm32h5xx_hal_conf.h @@ -0,0 +1,488 @@ +/** + ********************************************************************************************************************** + * @file stm32h5xx_hal_conf_template.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32h5xx_hal_conf.h. + ********************************************************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ********************************************************************************************************************** + */ + +/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ +#ifndef STM32H5xx_HAL_CONF_H +#define STM32H5xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ----------------------------------------------------------------------------------------------------*/ +/* Exported constants ------------------------------------------------------------------------------------------------*/ + +/* ########################################### Module Selection ##################################################### */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_COMP_MODULE_ENABLED +#define HAL_CORDIC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCACHE_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_DTS_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_ETH_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_FMAC_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_GTZC_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HCD_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_I3C_MODULE_ENABLED +#define HAL_ICACHE_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_MMC_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OTFDEC_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PKA_MODULE_ENABLED +#define HAL_PSSI_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RAMCFG_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_XSPI_MODULE_ENABLED + +/* ####################################### 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 25000000UL /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @brief Internal Core Speed oscillator (CSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when CSI is used as system clock source, directly or through the PLL). + */ +#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 (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ + +/** + * @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 */ + + +/** + * @brief External clock source for SPI/SAI peripheral + * This value is used by the SPI/SAI HAL module to compute the SPI/SAI 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 ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U /*!< Enable prefetch */ + +/* ############################################ Assert Selection #################################################### */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ############################################ Register callback feature configuration ############################# */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32h5xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#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_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_NOR_REGISTER_CALLBACKS 0U /* NOR 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_I3C_REGISTER_CALLBACKS 0U /* I3C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OPAMP register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_PKA_REGISTER_CALLBACKS 0U /* PKA register callback disabled */ +#define USE_HAL_RAMCFG_REGISTER_CALLBACKS 0U /* RAMCFG 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_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_SRAM_REGISTER_CALLBACKS 0U /* SRAM 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_XSPI_REGISTER_CALLBACKS 0U /* XSPI register callback disabled */ + +/* ############################################ SPI peripheral configuration ######################################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#define USE_SPI_CRC 1U + + +/* Includes ----------------------------------------------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32h5xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32h5xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_ICACHE_MODULE_ENABLED +#include "stm32h5xx_hal_icache.h" +#endif /* HAL_ICACHE_MODULE_ENABLED */ + +#ifdef HAL_DCACHE_MODULE_ENABLED +#include "stm32h5xx_hal_dcache.h" +#endif /* HAL_DCACHE_MODULE_ENABLED */ + +#ifdef HAL_GTZC_MODULE_ENABLED +#include "stm32h5xx_hal_gtzc.h" +#endif /* HAL_GTZC_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32h5xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DTS_MODULE_ENABLED +#include "stm32h5xx_hal_dts.h" +#endif /* HAL_DTS_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32h5xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED +#include "stm32h5xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32h5xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32h5xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32h5xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32h5xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32h5xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32h5xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32h5xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32h5xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32h5xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32h5xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32h5xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_I3C_MODULE_ENABLED +#include "stm32h5xx_hal_i3c.h" +#endif /* HAL_I3C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32h5xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32h5xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32h5xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_XSPI_MODULE_ENABLED +#include "stm32h5xx_hal_xspi.h" +#endif /* HAL_XSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32h5xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32h5xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32h5xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32h5xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32h5xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32h5xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32h5xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32h5xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32h5xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32h5xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32h5xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32h5xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32h5xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32h5xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32h5xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CORDIC_MODULE_ENABLED +#include "stm32h5xx_hal_cordic.h" +#endif /* HAL_CORDIC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32h5xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32h5xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32h5xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED +#include "stm32h5xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32h5xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMAC_MODULE_ENABLED +#include "stm32h5xx_hal_fmac.h" +#endif /* HAL_FMAC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32h5xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OTFDEC_MODULE_ENABLED +#include "stm32h5xx_hal_otfdec.h" +#endif /* HAL_OTFDEC_MODULE_ENABLED */ + +#ifdef HAL_PSSI_MODULE_ENABLED +#include "stm32h5xx_hal_pssi.h" +#endif /* HAL_PSSI_MODULE_ENABLED */ + +#ifdef HAL_RAMCFG_MODULE_ENABLED +#include "stm32h5xx_hal_ramcfg.h" +#endif /* HAL_RAMCFG_MODULE_ENABLED */ + +/* Exported macro ----------------------------------------------------------------------------------------------------*/ +#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__)) +/* Exported functions ----------------------------------------------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32H5xx_HAL_CONF_H */ diff --git a/tests/fetch/stm32h5xx_hal_conf.h b/tests/fetch/stm32h5xx_hal_conf.h new file mode 100644 index 00000000..c453c736 --- /dev/null +++ b/tests/fetch/stm32h5xx_hal_conf.h @@ -0,0 +1,488 @@ +/** + ********************************************************************************************************************** + * @file stm32h5xx_hal_conf_template.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32h5xx_hal_conf.h. + ********************************************************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ********************************************************************************************************************** + */ + +/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ +#ifndef STM32H5xx_HAL_CONF_H +#define STM32H5xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ----------------------------------------------------------------------------------------------------*/ +/* Exported constants ------------------------------------------------------------------------------------------------*/ + +/* ########################################### Module Selection ##################################################### */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_COMP_MODULE_ENABLED +#define HAL_CORDIC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCACHE_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_DTS_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_ETH_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_FMAC_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_GTZC_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HCD_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_I3C_MODULE_ENABLED +#define HAL_ICACHE_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_MMC_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OTFDEC_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PKA_MODULE_ENABLED +#define HAL_PSSI_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RAMCFG_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_XSPI_MODULE_ENABLED + +/* ####################################### 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 25000000UL /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @brief Internal Core Speed oscillator (CSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when CSI is used as system clock source, directly or through the PLL). + */ +#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 (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ + +/** + * @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 */ + + +/** + * @brief External clock source for SPI/SAI peripheral + * This value is used by the SPI/SAI HAL module to compute the SPI/SAI 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 ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U /*!< Enable prefetch */ + +/* ############################################ Assert Selection #################################################### */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ############################################ Register callback feature configuration ############################# */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32h5xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#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_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_NOR_REGISTER_CALLBACKS 0U /* NOR 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_I3C_REGISTER_CALLBACKS 0U /* I3C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OPAMP register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_PKA_REGISTER_CALLBACKS 0U /* PKA register callback disabled */ +#define USE_HAL_RAMCFG_REGISTER_CALLBACKS 0U /* RAMCFG 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_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_SRAM_REGISTER_CALLBACKS 0U /* SRAM 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_XSPI_REGISTER_CALLBACKS 0U /* XSPI register callback disabled */ + +/* ############################################ SPI peripheral configuration ######################################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#define USE_SPI_CRC 1U + + +/* Includes ----------------------------------------------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32h5xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32h5xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_ICACHE_MODULE_ENABLED +#include "stm32h5xx_hal_icache.h" +#endif /* HAL_ICACHE_MODULE_ENABLED */ + +#ifdef HAL_DCACHE_MODULE_ENABLED +#include "stm32h5xx_hal_dcache.h" +#endif /* HAL_DCACHE_MODULE_ENABLED */ + +#ifdef HAL_GTZC_MODULE_ENABLED +#include "stm32h5xx_hal_gtzc.h" +#endif /* HAL_GTZC_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32h5xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DTS_MODULE_ENABLED +#include "stm32h5xx_hal_dts.h" +#endif /* HAL_DTS_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32h5xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED +#include "stm32h5xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32h5xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32h5xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32h5xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32h5xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32h5xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32h5xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32h5xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32h5xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32h5xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32h5xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32h5xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_I3C_MODULE_ENABLED +#include "stm32h5xx_hal_i3c.h" +#endif /* HAL_I3C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32h5xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32h5xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32h5xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_XSPI_MODULE_ENABLED +#include "stm32h5xx_hal_xspi.h" +#endif /* HAL_XSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32h5xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32h5xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32h5xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32h5xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32h5xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32h5xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32h5xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32h5xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32h5xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32h5xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32h5xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32h5xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32h5xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32h5xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32h5xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CORDIC_MODULE_ENABLED +#include "stm32h5xx_hal_cordic.h" +#endif /* HAL_CORDIC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32h5xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32h5xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32h5xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED +#include "stm32h5xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32h5xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMAC_MODULE_ENABLED +#include "stm32h5xx_hal_fmac.h" +#endif /* HAL_FMAC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32h5xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OTFDEC_MODULE_ENABLED +#include "stm32h5xx_hal_otfdec.h" +#endif /* HAL_OTFDEC_MODULE_ENABLED */ + +#ifdef HAL_PSSI_MODULE_ENABLED +#include "stm32h5xx_hal_pssi.h" +#endif /* HAL_PSSI_MODULE_ENABLED */ + +#ifdef HAL_RAMCFG_MODULE_ENABLED +#include "stm32h5xx_hal_ramcfg.h" +#endif /* HAL_RAMCFG_MODULE_ENABLED */ + +/* Exported macro ----------------------------------------------------------------------------------------------------*/ +#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__)) +/* Exported functions ----------------------------------------------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32H5xx_HAL_CONF_H */ diff --git a/tests/hal/stm32h5xx_hal_conf.h b/tests/hal/stm32h5xx_hal_conf.h new file mode 100644 index 00000000..c453c736 --- /dev/null +++ b/tests/hal/stm32h5xx_hal_conf.h @@ -0,0 +1,488 @@ +/** + ********************************************************************************************************************** + * @file stm32h5xx_hal_conf_template.h + * @author MCD Application Team + * @brief HAL configuration template file. + * This file should be copied to the application folder and renamed + * to stm32h5xx_hal_conf.h. + ********************************************************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ********************************************************************************************************************** + */ + +/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ +#ifndef STM32H5xx_HAL_CONF_H +#define STM32H5xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ----------------------------------------------------------------------------------------------------*/ +/* Exported constants ------------------------------------------------------------------------------------------------*/ + +/* ########################################### Module Selection ##################################################### */ +/** + * @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_CEC_MODULE_ENABLED +#define HAL_COMP_MODULE_ENABLED +#define HAL_CORDIC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DCACHE_MODULE_ENABLED +#define HAL_DCMI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_DTS_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_ETH_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_FMAC_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_GTZC_MODULE_ENABLED +#define HAL_HASH_MODULE_ENABLED +#define HAL_HCD_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_I3C_MODULE_ENABLED +#define HAL_ICACHE_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_MMC_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OTFDEC_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PKA_MODULE_ENABLED +#define HAL_PSSI_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RAMCFG_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_XSPI_MODULE_ENABLED + +/* ####################################### 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 25000000UL /*!< Value of the External oscillator in Hz */ +#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 */ + +/** + * @brief Internal Core Speed oscillator (CSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when CSI is used as system clock source, directly or through the PLL). + */ +#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 (HSI48) value for USB FS, SDMMC and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#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_STARTUP_TIME) +#define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ +#endif /* LSI_STARTUP_TIME */ + +/** + * @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 */ + + +/** + * @brief External clock source for SPI/SAI peripheral + * This value is used by the SPI/SAI HAL module to compute the SPI/SAI 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 ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U /*!< Enable prefetch */ + +/* ############################################ Assert Selection #################################################### */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ############################################ Register callback feature configuration ############################# */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32h5xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#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_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_NOR_REGISTER_CALLBACKS 0U /* NOR 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_I3C_REGISTER_CALLBACKS 0U /* I3C register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */ +#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OPAMP register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_PKA_REGISTER_CALLBACKS 0U /* PKA register callback disabled */ +#define USE_HAL_RAMCFG_REGISTER_CALLBACKS 0U /* RAMCFG 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_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD 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_SRAM_REGISTER_CALLBACKS 0U /* SRAM 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_XSPI_REGISTER_CALLBACKS 0U /* XSPI register callback disabled */ + +/* ############################################ SPI peripheral configuration ######################################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#define USE_SPI_CRC 1U + + +/* Includes ----------------------------------------------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32h5xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32h5xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_ICACHE_MODULE_ENABLED +#include "stm32h5xx_hal_icache.h" +#endif /* HAL_ICACHE_MODULE_ENABLED */ + +#ifdef HAL_DCACHE_MODULE_ENABLED +#include "stm32h5xx_hal_dcache.h" +#endif /* HAL_DCACHE_MODULE_ENABLED */ + +#ifdef HAL_GTZC_MODULE_ENABLED +#include "stm32h5xx_hal_gtzc.h" +#endif /* HAL_GTZC_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32h5xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DTS_MODULE_ENABLED +#include "stm32h5xx_hal_dts.h" +#endif /* HAL_DTS_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32h5xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_PKA_MODULE_ENABLED +#include "stm32h5xx_hal_pka.h" +#endif /* HAL_PKA_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32h5xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32h5xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32h5xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32h5xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32h5xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32h5xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32h5xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32h5xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32h5xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32h5xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32h5xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32h5xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_I3C_MODULE_ENABLED +#include "stm32h5xx_hal_i3c.h" +#endif /* HAL_I3C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32h5xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32h5xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32h5xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_XSPI_MODULE_ENABLED +#include "stm32h5xx_hal_xspi.h" +#endif /* HAL_XSPI_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32h5xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32h5xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32h5xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32h5xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32h5xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32h5xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32h5xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32h5xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32h5xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32h5xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32h5xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32h5xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32h5xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32h5xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32h5xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CORDIC_MODULE_ENABLED +#include "stm32h5xx_hal_cordic.h" +#endif /* HAL_CORDIC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32h5xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32h5xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32h5xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FDCAN_MODULE_ENABLED +#include "stm32h5xx_hal_fdcan.h" +#endif /* HAL_FDCAN_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32h5xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMAC_MODULE_ENABLED +#include "stm32h5xx_hal_fmac.h" +#endif /* HAL_FMAC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32h5xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_OTFDEC_MODULE_ENABLED +#include "stm32h5xx_hal_otfdec.h" +#endif /* HAL_OTFDEC_MODULE_ENABLED */ + +#ifdef HAL_PSSI_MODULE_ENABLED +#include "stm32h5xx_hal_pssi.h" +#endif /* HAL_PSSI_MODULE_ENABLED */ + +#ifdef HAL_RAMCFG_MODULE_ENABLED +#include "stm32h5xx_hal_ramcfg.h" +#endif /* HAL_RAMCFG_MODULE_ENABLED */ + +/* Exported macro ----------------------------------------------------------------------------------------------------*/ +#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__)) +/* Exported functions ----------------------------------------------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32H5xx_HAL_CONF_H */ From c7e9b4272ee5e933a058f0414b27cd0178105fa1 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Wed, 20 Dec 2023 15:21:21 +0100 Subject: [PATCH 100/119] Updated doc to have a working CI for new families --- docs/MAINTAIN.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/MAINTAIN.md b/docs/MAINTAIN.md index bcb40ea9..67926b51 100644 --- a/docs/MAINTAIN.md +++ b/docs/MAINTAIN.md @@ -23,4 +23,5 @@ The versions to use can be found as follow: ## Add family to CI +Add the file stm32${FAMILY_L}xx_hal_conf.h file to the root folder of each test. (A template is provided in the corresponding HAL) Update the cmake.yml workflow file to include the new family From fb8cbae98c9f79cf7191fd1199787f3d66dc2c22 Mon Sep 17 00:00:00 2001 From: Hector PHARAM Date: Tue, 26 Dec 2023 15:44:18 +0100 Subject: [PATCH 101/119] h5.cmake:Corrected fpu flag --- cmake/stm32/h5.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/stm32/h5.cmake b/cmake/stm32/h5.cmake index beae218c..620b5f2e 100644 --- a/cmake/stm32/h5.cmake +++ b/cmake/stm32/h5.cmake @@ -15,9 +15,9 @@ set(STM32_H5_CCRAM_SIZES stm32_util_create_family_targets(H5) target_compile_options(STM32::H5 INTERFACE - -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb + -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb ) target_link_options(STM32::H5 INTERFACE - -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb + -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb ) From 85306d6229615f734e230ab9288017f66e6529a5 Mon Sep 17 00:00:00 2001 From: David Drinn Date: Mon, 29 Jan 2024 14:22:24 -0700 Subject: [PATCH 102/119] NT: Update U5 to latest Cube 1.4.0 --- cmake/stm32/utilities.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 0814a372..725be900 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -44,10 +44,10 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.3.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.4.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.1 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.3.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.4.0 v1.9.0 v1.1.0) From da260cf59e882ef8cf21c97095f706dca1cfa377 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Mon, 8 Apr 2024 09:56:56 +0200 Subject: [PATCH 103/119] STM32U0 family support --- .github/workflows/cmake.yml | 2 +- README.md | 4 +- cmake/FindBSP.cmake | 11 + cmake/stm32/common.cmake | 2 + cmake/stm32/devices.cmake | 21 ++ cmake/stm32/u0.cmake | 29 +++ cmake/stm32/utilities.cmake | 8 +- tests/bsp/CMakeLists.txt | 4 +- tests/bsp/stm32u0xx_hal_conf.h | 335 +++++++++++++++++++++++++++++++ tests/cmsis/CMakeLists.txt | 2 +- tests/fetch/CMakeLists.txt | 2 +- tests/fetch/stm32u0xx_hal_conf.h | 335 +++++++++++++++++++++++++++++++ tests/hal/CMakeLists.txt | 2 +- tests/hal/stm32u0xx_hal_conf.h | 335 +++++++++++++++++++++++++++++++ 14 files changed, 1081 insertions(+), 11 deletions(-) create mode 100644 cmake/stm32/u0.cmake create mode 100644 tests/bsp/stm32u0xx_hal_conf.h create mode 100644 tests/fetch/stm32u0xx_hal_conf.h create mode 100644 tests/hal/stm32u0xx_hal_conf.h diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8a3a2c3c..00ff1e55 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - family: [C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U5, WB, WL, MP1] + family: [C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U0, U5, WB, WL, MP1] fail-fast: false steps: diff --git a/README.md b/README.md index 513d34bf..0315b65c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Tests](https://github.com/ObKo/stm32-cmake/workflows/Tests/badge.svg) This project is used to develop applications for the STM32 - ST's ARM Cortex-Mx MCUs. -It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL device families. +It uses cmake and GCC, along with newlib (libc), STM32Cube. Supports C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U0 U5 WB WL device families. ## Requirements @@ -56,7 +56,7 @@ The most important set of variables which needs to be set can be found in the fo These configuration options need to be set for the build process to work properly: * `STM32_CUBE__PATH` - path to STM32Cube directory, where `` is one - of `C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL` **default**: `/opt/STM32Cube` + of `C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U0 U5 WB WL` **default**: `/opt/STM32Cube` These configuration variables are optional: diff --git a/cmake/FindBSP.cmake b/cmake/FindBSP.cmake index e5617d75..27437fa2 100644 --- a/cmake/FindBSP.cmake +++ b/cmake/FindBSP.cmake @@ -252,6 +252,17 @@ set(BSP_MP1_COMPONENTS ) set(BSP_MP1_SOURCES_STM32MP15xx_DISCO bus stpmic1) set(BSP_MP1_SOURCES_STM32MP15xx_EVAL bus stpmic1) +### U0 ### +set(BSP_U0_BOARDS + STM32U0xx_Nucleo STM32U083C_Discovery +) +set(BSP_U0_COMPONENTS + stts22h +) + +set(BSP_U0_SOURCES_STM32U083C_Discovery stts22h) +set(BSP_U0_DEVICE_STM32U083C_Discovery U083CC) + ### WB ### set(BSP_WB_BOARDS STM32WB15CC_Nucleo STM32WB55_Nucleo STM32WB55_USBDongle STM32WB5MM_Discovery diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 2c385496..195742d9 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -5,6 +5,7 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32H5 STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5 + STM32U0 STM32U5 STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS STM32MP1_M4 ) @@ -397,6 +398,7 @@ include(stm32/l0) include(stm32/l1) include(stm32/l4) include(stm32/l5) +include(stm32/u0) include(stm32/u5) include(stm32/wb) include(stm32/wl) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index 43d79cd0..ae615737 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1186,6 +1186,27 @@ set(STM32_ALL_DEVICES MP157C MP157D MP157F + U031C6 + U031C8 + U031F4 + U031F6 + U031F8 + U031G6 + U031G8 + U031K4 + U031K8 + U031R6 + U031R8 + U073CC + U073HC + U073KC + U073MC + U073RC + U083CC + U083HC + U083KC + U083MC + U083RC U575CG U575CI U585CI diff --git a/cmake/stm32/u0.cmake b/cmake/stm32/u0.cmake new file mode 100644 index 00000000..64572893 --- /dev/null +++ b/cmake/stm32/u0.cmake @@ -0,0 +1,29 @@ +set(STM32_U0_TYPES + U031xx + U073xC + U083xC +) +set(STM32_U0_TYPE_MATCH + "U031.." + "U073.." + "U083.." +) +set(STM32_U0_RAM_SIZES + 12K + 40K + 40K +) +set(STM32_U0_CCRAM_SIZES + 0K + 0K + 0K +) + +stm32_util_create_family_targets(U0) + +target_compile_options(STM32::U0 INTERFACE + -mcpu=cortex-m0plus +) +target_link_options(STM32::U0 INTERFACE + -mcpu=cortex-m0plus +) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 725be900..682b2581 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -43,11 +43,11 @@ endfunction() include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository -set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.4.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.1 v1.9.0 v1.1.0) +set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL ) +set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.4.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.3.1 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.4.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.4.0 v1.9.0 v1.1.0) diff --git a/tests/bsp/CMakeLists.txt b/tests/bsp/CMakeLists.txt index 83cdf930..37db1aa0 100644 --- a/tests/bsp/CMakeLists.txt +++ b/tests/bsp/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) endif() # Nucleo boards can have different devices on it @@ -28,6 +28,8 @@ set(DEVICE_STM32L4xx_Nucleo_32 L412KB) set(DEVICE_STM32L4xx_Nucleo_144 L496ZG) set(DEVICE_STM32MP15xx_DISCO MP157CAC) set(DEVICE_STM32MP15xx_EVAL MP157FAA) +set(DEVICE_STM32U0xx_Nucleo U031R8) +set(DEVICE_STM32U0xx_DISCO U083CC) set(DEFINES_STM32469I_EVAL USE_IOEXPANDER) set(DEFINES_STM32F769I_EVAL USE_IOEXPANDER) set(DEFINES_STM32L476G_EVAL USE_IOEXPANDER) diff --git a/tests/bsp/stm32u0xx_hal_conf.h b/tests/bsp/stm32u0xx_hal_conf.h new file mode 100644 index 00000000..e402e067 --- /dev/null +++ b/tests/bsp/stm32u0xx_hal_conf.h @@ -0,0 +1,335 @@ +/** + ****************************************************************************** + * @file stm32u0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32U0xx_HAL_CONF_H +#define __STM32U0xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_COMP_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRS_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LCD_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_TSC_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## 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 4000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) + #define MSI_VALUE 4000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_VALUE */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI32_VALUE) +#define MSI32_VALUE 32000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI32_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 16000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI48) value for USB FS and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) + #define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB FS/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U /*!< 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 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 32768U /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY (3U) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ + +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Register callback feature configuration ############### */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32n6xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LCD_REGISTER_CALLBACKS 0U /* LCD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD 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_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI 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 */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32u0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32u0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32u0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32u0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32u0xx_hal_adc.h" +#include "stm32u0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32u0xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32u0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRS_MODULE_ENABLED +#include "stm32u0xx_ll_crs.h" +#endif /* HAL_CRS_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32u0xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32u0xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32u0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32u0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32u0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32u0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32u0xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32u0xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32u0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32u0xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32u0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32u0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32u0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED +#include "stm32u0xx_ll_system.h" +#include "stm32u0xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32u0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32u0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32u0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32u0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32u0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LCD_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32u0xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t *file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32U0xx_HAL_CONF_H */ diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index 7c52a0af..4e4f94e3 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U0 U5 WB WL) endif() if("MP1" IN_LIST TEST_FAMILIES) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index 3709d382..641e4776 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) endif() # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES diff --git a/tests/fetch/stm32u0xx_hal_conf.h b/tests/fetch/stm32u0xx_hal_conf.h new file mode 100644 index 00000000..e402e067 --- /dev/null +++ b/tests/fetch/stm32u0xx_hal_conf.h @@ -0,0 +1,335 @@ +/** + ****************************************************************************** + * @file stm32u0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32U0xx_HAL_CONF_H +#define __STM32U0xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_COMP_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRS_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LCD_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_TSC_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## 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 4000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) + #define MSI_VALUE 4000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_VALUE */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI32_VALUE) +#define MSI32_VALUE 32000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI32_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 16000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI48) value for USB FS and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) + #define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB FS/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U /*!< 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 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 32768U /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY (3U) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ + +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Register callback feature configuration ############### */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32n6xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LCD_REGISTER_CALLBACKS 0U /* LCD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD 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_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI 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 */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32u0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32u0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32u0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32u0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32u0xx_hal_adc.h" +#include "stm32u0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32u0xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32u0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRS_MODULE_ENABLED +#include "stm32u0xx_ll_crs.h" +#endif /* HAL_CRS_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32u0xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32u0xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32u0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32u0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32u0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32u0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32u0xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32u0xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32u0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32u0xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32u0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32u0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32u0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED +#include "stm32u0xx_ll_system.h" +#include "stm32u0xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32u0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32u0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32u0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32u0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32u0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LCD_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32u0xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t *file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32U0xx_HAL_CONF_H */ diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index 60530684..c1f5da7b 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) if(NOT TEST_FAMILIES) - set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U5 WB WL) + set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) endif() # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES diff --git a/tests/hal/stm32u0xx_hal_conf.h b/tests/hal/stm32u0xx_hal_conf.h new file mode 100644 index 00000000..e402e067 --- /dev/null +++ b/tests/hal/stm32u0xx_hal_conf.h @@ -0,0 +1,335 @@ +/** + ****************************************************************************** + * @file stm32u0xx_hal_conf.h + * @author MCD Application Team + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2023 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32U0xx_HAL_CONF_H +#define __STM32U0xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @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_COMP_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRS_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_LCD_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_TSC_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## 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 4000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) + #define MSI_VALUE 4000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_VALUE */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI32_VALUE) +#define MSI32_VALUE 32000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI32_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 16000000U /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI48) value for USB FS and RNG. + * This internal oscillator is mainly dedicated to provide a high precision clock to + * the USB peripheral by means of a special Clock Recovery System (CRS) circuitry. + * When the CRS is not used, the HSI48 RC oscillator runs on it default frequency + * which is subject to manufacturing process variations. + */ +#if !defined (HSI48_VALUE) + #define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB FS/RNG in Hz. + The real value my vary depending on manufacturing process variations.*/ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE 32000U /*!< 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 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 32768U /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* 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 3300U /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY (3U) /*!< tick interrupt priority (lowest by default) */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define INSTRUCTION_CACHE_ENABLE 1U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ + +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Register callback feature configuration ############### */ +/** + * @brief Set below the peripheral configuration to "1U" to add the support + * of HAL callback registration/unregistration feature for the HAL + * driver(s). This allows user application to provide specific callback + * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting + * the default weak callback functions (see each stm32n6xx_hal_ppp.h file + * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef + * for each PPP peripheral). + */ +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC 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_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LCD_REGISTER_CALLBACKS 0U /* LCD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD 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_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI 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 */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32u0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32u0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32u0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32u0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32u0xx_hal_adc.h" +#include "stm32u0xx_hal_adc_ex.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "stm32u0xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32u0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRS_MODULE_ENABLED +#include "stm32u0xx_ll_crs.h" +#endif /* HAL_CRS_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32u0xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32u0xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32u0xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32u0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32u0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32u0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32u0xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_OPAMP_MODULE_ENABLED +#include "stm32u0xx_hal_opamp.h" +#endif /* HAL_OPAMP_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32u0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32u0xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32u0xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32u0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32u0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED +#include "stm32u0xx_ll_system.h" +#include "stm32u0xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32u0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32u0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32u0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32u0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32u0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED +#include "stm32u0xx_hal_lcd.h" +#endif /* HAL_LCD_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32u0xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#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__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t *file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32U0xx_HAL_CONF_H */ From 6cbfdbc4bdc1ccaa9310ec0e3d0369ec0b211094 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Mon, 8 Apr 2024 11:14:04 +0200 Subject: [PATCH 104/119] Fix types and matches --- cmake/stm32/common.cmake | 3 +-- cmake/stm32/u0.cmake | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 195742d9..a3f6c09e 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -5,8 +5,7 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME STM32H5 STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5 - STM32U0 - STM32U5 + STM32U0 STM32U5 STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS STM32MP1_M4 ) diff --git a/cmake/stm32/u0.cmake b/cmake/stm32/u0.cmake index 64572893..25fcde87 100644 --- a/cmake/stm32/u0.cmake +++ b/cmake/stm32/u0.cmake @@ -1,12 +1,12 @@ set(STM32_U0_TYPES U031xx - U073xC - U083xC + U073xx + U083xx ) set(STM32_U0_TYPE_MATCH - "U031.." - "U073.." - "U083.." + "U031.[468]" + "U073.C" + "U083.C" ) set(STM32_U0_RAM_SIZES 12K From e99fe2a4213e280c349f877b5a77b58d3f34c6bf Mon Sep 17 00:00:00 2001 From: slide333333 Date: Tue, 16 Apr 2024 16:12:07 +0200 Subject: [PATCH 105/119] Update to use lates Cube / HAl / CMSIS for F4 --- cmake/stm32/utilities.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake index 725be900..da7096ab 100644 --- a/cmake/stm32/utilities.cmake +++ b/cmake/stm32/utilities.cmake @@ -44,10 +44,10 @@ include(FetchContent) # A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.26.1 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.4.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.6 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.1 v1.9.0 v1.1.0) +set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.28.0 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.4.0 v1.12.0 v1.1.0) +set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.9 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.3.1 v1.9.0 v1.1.0) -set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.7.12 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.4.0 v1.9.0 v1.1.0) +set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.8.2 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.4.0 v1.9.0 v1.1.0) From 9d7fd3890f310b6b0483b4cd59a6c6320b554c93 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Sun, 12 May 2024 14:08:16 +0200 Subject: [PATCH 106/119] Split devices in family files --- cmake/stm32/c0.cmake | 26 + cmake/stm32/common.cmake | 33 +- cmake/stm32/devices.cmake | 1439 +++++------------------------------ cmake/stm32/f0.cmake | 86 +++ cmake/stm32/f1.cmake | 108 +++ cmake/stm32/f2.cmake | 51 ++ cmake/stm32/f3.cmake | 82 ++ cmake/stm32/f4.cmake | 162 ++++ cmake/stm32/f7.cmake | 98 +++ cmake/stm32/g0.cmake | 116 +++ cmake/stm32/g4.cmake | 107 +++ cmake/stm32/h5.cmake | 44 ++ cmake/stm32/h7.cmake | 127 ++++ cmake/stm32/l0.cmake | 111 +++ cmake/stm32/l1.cmake | 72 ++ cmake/stm32/l4.cmake | 151 ++++ cmake/stm32/l5.cmake | 30 + cmake/stm32/mp1.cmake | 25 + cmake/stm32/u0.cmake | 34 + cmake/stm32/u5.cmake | 34 + cmake/stm32/utilities.cmake | 162 ---- cmake/stm32/wb.cmake | 29 + cmake/stm32/wl.cmake | 34 +- 23 files changed, 1700 insertions(+), 1461 deletions(-) delete mode 100644 cmake/stm32/utilities.cmake diff --git a/cmake/stm32/c0.cmake b/cmake/stm32/c0.cmake index 165b0e03..28aa096c 100644 --- a/cmake/stm32/c0.cmake +++ b/cmake/stm32/c0.cmake @@ -23,3 +23,29 @@ target_compile_options(STM32::C0 INTERFACE target_link_options(STM32::C0 INTERFACE -mcpu=cortex-m0plus ) + +list(APPEND STM32_ALL_DEVICES + C011D6 + C011F4 + C011F6 + C011J4 + C011J6 + C031C4 + C031C6 + C031F4 + C031F6 + C031G4 + C031G6 + C031K4 + C031K6 +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32C0 +) + +list(APPEND STM32_FETCH_FAMILIES C0) + +set(CUBE_C0_VERSION v1.1.0) +set(CMSIS_C0_VERSION v1.1.0) +set(HAL_C0_VERSION v1.1.0) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index a3f6c09e..391c34ab 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -1,13 +1,4 @@ -set(STM32_SUPPORTED_FAMILIES_LONG_NAME - STM32C0 - STM32F0 STM32F1 STM32F2 STM32F3 STM32F4 STM32F7 - STM32G0 STM32G4 - STM32H5 - STM32H7_M4 STM32H7_M7 - STM32L0 STM32L1 STM32L4 STM32L5 - STM32U0 STM32U5 - STM32WB_M4 STM32WL_M4 STM32WL_M0PLUS - STM32MP1_M4 ) +include(stm32/devices) foreach(FAMILY ${STM32_SUPPORTED_FAMILIES_LONG_NAME}) # append short names (F0, F1, H7_M4, ...) to STM32_SUPPORTED_FAMILIES_SHORT_NAME @@ -380,25 +371,3 @@ if(NOT (TARGET STM32::Nano::FloatScan)) $<$:-Wl,--undefined,_scanf_float> ) endif() - -include(stm32/utilities) -include(stm32/c0) -include(stm32/f0) -include(stm32/f1) -include(stm32/f2) -include(stm32/f3) -include(stm32/f4) -include(stm32/f7) -include(stm32/g0) -include(stm32/g4) -include(stm32/h5) -include(stm32/h7) -include(stm32/l0) -include(stm32/l1) -include(stm32/l4) -include(stm32/l5) -include(stm32/u0) -include(stm32/u5) -include(stm32/wb) -include(stm32/wl) -include(stm32/mp1) diff --git a/cmake/stm32/devices.cmake b/cmake/stm32/devices.cmake index ae615737..af29301a 100644 --- a/cmake/stm32/devices.cmake +++ b/cmake/stm32/devices.cmake @@ -1,1267 +1,69 @@ -set(STM32_ALL_DEVICES - C011D6 - C011F4 - C011F6 - C011J4 - C011J6 - C031C4 - C031C6 - C031F4 - C031F6 - C031G4 - C031G6 - C031K4 - C031K6 - F030C6 - F030C8 - F030CC - F030F4 - F030K6 - F030R8 - F030RC - F031C4 - F031C6 - F031E6 - F031F4 - F031F6 - F031G4 - F031G6 - F031K4 - F031K6 - F038C6 - F038E6 - F038F6 - F038G6 - F038K6 - F042C4 - F042C6 - F042F4 - F042F6 - F042G4 - F042G6 - F042K4 - F042K6 - F042T6 - F048C6 - F048G6 - F048T6 - F051C4 - F051C6 - F051C8 - F051K4 - F051K6 - F051K8 - F051R4 - F051R6 - F051R8 - F051T8 - F058C8 - F058R8 - F058T8 - F070C6 - F070CB - F070F6 - F070RB - F071C8 - F071CB - F071RB - F071V8 - F071VB - F072C8 - F072CB - F072R8 - F072RB - F072V8 - F072VB - F078CB - F078RB - F078VB - F091CB - F091CC - F091RB - F091RC - F091VB - F091VC - F098CC - F098RC - F098VC - F100C4 - F100C6 - F100C8 - F100CB - F100R4 - F100R6 - F100R8 - F100RB - F100RC - F100RD - F100RE - F100V8 - F100VB - F100VC - F100VD - F100VE - F100ZC - F100ZD - F100ZE - F101C4 - F101C6 - F101C8 - F101CB - F101R4 - F101R6 - F101R8 - F101RB - F101RC - F101RD - F101RE - F101RF - F101RG - F101T4 - F101T6 - F101T8 - F101TB - F101V8 - F101VB - F101VC - F101VD - F101VE - F101VF - F101VG - F101ZC - F101ZD - F101ZE - F101ZF - F101ZG - F102C4 - F102C6 - F102C8 - F102CB - F102R4 - F102R6 - F102R8 - F102RB - F103C4 - F103C6 - F103C8 - F103CB - F103R4 - F103R6 - F103R8 - F103RB - F103RC - F103RD - F103RE - F103RF - F103RG - F103T4 - F103T6 - F103T8 - F103TB - F103V8 - F103VB - F103VC - F103VD - F103VE - F103VF - F103VG - F103ZC - F103ZD - F103ZE - F103ZF - F103ZG - F105R8 - F105RB - F105RC - F105V8 - F105VB - F105VC - F107RB - F107RC - F107VB - F107VC - F205RB - F205RC - F205RE - F205RF - F205RG - F205VB - F205VC - F205VE - F205VF - F205VG - F205ZC - F205ZE - F205ZF - F205ZG - F207IC - F207IE - F207IF - F207IG - F207VC - F207VE - F207VF - F207VG - F207ZC - F207ZE - F207ZF - F207ZG - F215RE - F215RG - F215VE - F215VG - F215ZE - F215ZG - F217IE - F217IG - F217VE - F217VG - F217ZE - F217ZG - F301C6 - F301C8 - F301K6 - F301K8 - F301R6 - F301R8 - F302C6 - F302C8 - F302CB - F302CC - F302K6 - F302K8 - F302R6 - F302R8 - F302RB - F302RC - F302RD - F302RE - F302VB - F302VC - F302VD - F302VE - F302ZD - F302ZE - F303C6 - F303C8 - F303CB - F303CC - F303K6 - F303K8 - F303R6 - F303R8 - F303RB - F303RC - F303RD - F303RE - F303VB - F303VC - F303VD - F303VE - F303ZD - F303ZE - F318C8 - F318K8 - F328C8 - F334C4 - F334C6 - F334C8 - F334K4 - F334K6 - F334K8 - F334R6 - F334R8 - F358CC - F358RC - F358VC - F373C8 - F373CB - F373CC - F373R8 - F373RB - F373RC - F373V8 - F373VB - F373VC - F378CC - F378RC - F378VC - F398VE - F401CB - F401CC - F401CD - F401CE - F401RB - F401RC - F401RD - F401RE - F401VB - F401VC - F401VD - F401VE - F405OE - F405OG - F405RG - F405VG - F405ZG - F407IE - F407IG - F407VE - F407VG - F407ZE - F407ZG - F410C8 - F410CB - F410R8 - F410RB - F410T8 - F410TB - F411CC - F411CE - F411RC - F411RE - F411VC - F411VE - F412CE - F412CG - F412RE - F412RG - F412VE - F412VG - F412ZE - F412ZG - F413CG - F413CH - F413MG - F413MH - F413RG - F413RH - F413VG - F413VH - F413ZG - F413ZH - F415OG - F415RG - F415VG - F415ZG - F417IE - F417IG - F417VE - F417VG - F417ZE - F417ZG - F423CH - F423MH - F423RH - F423VH - F423ZH - F427AG - F427AI - F427IG - F427II - F427VG - F427VI - F427ZG - F427ZI - F429AG - F429AI - F429BE - F429BG - F429BI - F429IE - F429IG - F429II - F429NE - F429NG - F429NI - F429VE - F429VG - F429VI - F429ZE - F429ZG - F429ZI - F437AI - F437IG - F437II - F437VG - F437VI - F437ZG - F437ZI - F439AI - F439BG - F439BI - F439IG - F439II - F439NG - F439NI - F439VG - F439VI - F439ZG - F439ZI - F446MC - F446ME - F446RC - F446RE - F446VC - F446VE - F446ZC - F446ZE - F469AE - F469AG - F469AI - F469BE - F469BG - F469BI - F469IE - F469IG - F469II - F469NE - F469NG - F469NI - F469VE - F469VG - F469VI - F469ZE - F469ZG - F469ZI - F479AG - F479AI - F479BG - F479BI - F479IG - F479II - F479NG - F479NI - F479VG - F479VI - F479ZG - F479ZI - F722IC - F722IE - F722RC - F722RE - F722VC - F722VE - F722ZC - F722ZE - F723IC - F723IE - F723VE - F723ZC - F723ZE - F730I8 - F730R8 - F730V8 - F730Z8 - F732IE - F732RE - F732VE - F732ZE - F733IE - F733VE - F733ZE - F745IE - F745IG - F745VE - F745VG - F745ZE - F745ZG - F746BE - F746BG - F746IE - F746IG - F746NE - F746NG - F746VE - F746VG - F746ZE - F746ZG - F750N8 - F750V8 - F750Z8 - F756BG - F756IG - F756NG - F756VG - F756ZG - F765BG - F765BI - F765IG - F765II - F765NG - F765NI - F765VG - F765VI - F765ZG - F765ZI - F767BG - F767BI - F767IG - F767II - F767NG - F767NI - F767VG - F767VI - F767ZG - F767ZI - F769AI - F769BG - F769BI - F769IG - F769II - F769NG - F769NI - F777BI - F777II - F777NI - F777VI - F777ZI - F778AI - F779AI - F779BI - F779II - F779NI - G030C6 - G030C8 - G030F6 - G030J6 - G030K6 - G030K8 - G031C4 - G031C6 - G031C8 - G031F4 - G031F6 - G031F8 - G031G4 - G031G6 - G031G8 - G031J4 - G031J6 - G031K4 - G031K6 - G031K8 - G031Y8 - G041C6 - G041C8 - G041F6 - G041F8 - G041G6 - G041G8 - G041J6 - G041K6 - G041K8 - G041Y8 - G050C6 - G050C8 - G050F6 - G050K6 - G050K8 - G051C6 - G051C8 - G051F6 - G051F8 - G051G6 - G051G8 - G051K6 - G051K8 - G061C6 - G061C8 - G061F6 - G061F8 - G061G6 - G061G8 - G061K6 - G061K8 - G070CB - G070KB - G070RB - G071C6 - G071C8 - G071CB - G071EB - G071G6 - G071G8 - G071GB - G071K6 - G071K8 - G071KB - G071R6 - G071R8 - G071RB - G081CB - G081EB - G081GB - G081KB - G081RB - G0B0CE - G0B0KE - G0B0RE - G0B0VE - G0B1CB - G0B1CC - G0B1CE - G0B1KB - G0B1KC - G0B1KE - G0B1MB - G0B1MC - G0B1ME - G0B1NE - G0B1RB - G0B1RC - G0B1RE - G0B1VB - G0B1VC - G0B1VE - G0C1CC - G0C1CE - G0C1KC - G0C1KE - G0C1MC - G0C1ME - G0C1RC - G0C1RE - G0C1VC - G0C1VE - G431C6 - G431C8 - G431CB - G431K6 - G431K8 - G431KB - G431M6 - G431M8 - G431MB - G431R6 - G431R8 - G431RB - G431V6 - G431V8 - G431VB - G441CB - G441KB - G441MB - G441RB - G441VB - G471CC - G471CE - G471MC - G471ME - G471QC - G471QE - G471RC - G471RE - G471VC - G471VE - G473CB - G473CC - G473CE - G473MB - G473MC - G473ME - G473PB - G473PC - G473PE - G473QB - G473QC - G473QE - G473RB - G473RC - G473RE - G473VB - G473VC - G473VE - G474CB - G474CC - G474CE - G474MB - G474MC - G474ME - G474PB - G474PC - G474PE - G474QB - G474QC - G474QE - G474RB - G474RC - G474RE - G474VB - G474VC - G474VE - G483CE - G483ME - G483PE - G483QE - G483RE - G483VE - G484CE - G484ME - G484PE - G484QE - G484RE - G484VE - G491CC - G491KC - G491MC - G491RC - G491VC - G491CE - G491KE - G491ME - G491RE - G491VE - G4A1CE - G4A1KE - G4A1ME - G4A1RE - G4A1VE - GBK1CB - H503CB - H503EB - H503KB - H503RB - H562AG - H562AI - H562IG - H562II - H562RG - H562RI - H562VG - H562VI - H562ZG - H562ZI - H563AG - H563AI - H563IG - H563II - H563MI - H563RG - H563RI - H563VG - H563VI - H563ZG - H563ZI - H573AI - H573II - H573MI - H573RI - H573VI - H573ZI - H723VE - H723VG - H723ZE - H723ZG - H725AE - H725AG - H725IE - H725IG - H725RE - H725RG - H725VE - H725VG - H725ZE - H725ZG - H730AB - H730IB - H730VB - H730ZB - H733VG - H733ZG - H735AG - H735IG - H735RG - H735VG - H735ZG - H742AG - H742AI - H742BG - H742BI - H742IG - H742II - H742VG - H742VI - H742XG - H742XI - H742ZG - H742ZI - H743AG - H743AI - H743BG - H743BI - H743IG - H743II - H743VG - H743VI - H743XG - H743XI - H743ZG - H743ZI - H745BG - H745BI - H745IG - H745II - H745XG - H745XI - H745ZG - H745ZI - H747AG - H747AI - H747BG - H747BI - H747IG - H747II - H747XG - H747XI - H747ZI - H750IB - H750VB - H750XB - H750ZB - H753AI - H753BI - H753II - H753VI - H753XI - H753ZI - H755BI - H755II - H755XI - H755ZI - H757AI - H757BI - H757II - H757XI - H757ZI - H7A3AG - H7A3AI - H7A3IG - H7A3II - H7A3LG - H7A3LI - H7A3NG - H7A3NI - H7A3QI - H7A3RG - H7A3RI - H7A3VG - H7A3VI - H7A3ZG - H7A3ZI - H7B0AB - H7B0IB - H7B0RB - H7B0VB - H7B0ZB - H7B3AI - H7B3II - H7B3LI - H7B3NI - H7B3QI - H7B3RI - H7B3VI - H7B3ZI - L010C6 - L010F4 - L010K4 - L010K8 - L010R8 - L010RB - L011D3 - L011D4 - L011E3 - L011E4 - L011F3 - L011F4 - L011G3 - L011G4 - L011K3 - L011K4 - L021D4 - L021F4 - L021G4 - L021K4 - L031C4 - L031C6 - L031E4 - L031E6 - L031F4 - L031F6 - L031G4 - L031G6 - L031K4 - L031K6 - L041C6 - L041E6 - L041F6 - L041G6 - L041K6 - L051C6 - L051C8 - L051K6 - L051K8 - L051R6 - L051R8 - L051T6 - L051T8 - L052C6 - L052C8 - L052K6 - L052K8 - L052R6 - L052R8 - L052T6 - L052T8 - L053C6 - L053C8 - L053R6 - L053R8 - L062C8 - L062K8 - L063C8 - L063R8 - L071C8 - L071CB - L071CZ - L071K8 - L071KB - L071KZ - L071RB - L071RZ - L071V8 - L071VB - L071VZ - L072CB - L072CZ - L072KB - L072KZ - L072RB - L072RZ - L072V8 - L072VB - L072VZ - L073CB - L073CZ - L073RB - L073RZ - L073V8 - L073VB - L073VZ - L081CB - L081CZ - L081KZ - L082CZ - L082KZ - L083CB - L083CZ - L083RB - L083RZ - L083V8 - L083VB - L083VZ - L100C6 - L100R8 - L100RB - L100RC - L151C6 - L151C8 - L151CB - L151CC - L151QC - L151QD - L151QE - L151R6 - L151R8 - L151RB - L151RC - L151RD - L151RE - L151UC - L151V8 - L151VB - L151VC - L151VD - L151VE - L151ZC - L151ZD - L151ZE - L152C6 - L152C8 - L152CB - L152CC - L152QC - L152QD - L152QE - L152R6 - L152R8 - L152RB - L152RC - L152RD - L152RE - L152UC - L152V8 - L152VB - L152VC - L152VD - L152VE - L152ZC - L152ZD - L152ZE - L162QC - L162QD - L162RC - L162RD - L162RE - L162VC - L162VD - L162VE - L162ZC - L162ZD - L162ZE - L412C8 - L412CB - L412K8 - L412KB - L412R8 - L412RB - L412T8 - L412TB - L422CB - L422KB - L422RB - L422TB - L431CB - L431CC - L431KB - L431KC - L431RB - L431RC - L431VC - L432KB - L432KC - L433CB - L433CC - L433RB - L433RC - L433VC - L442KC - L443CC - L443RC - L443VC - L451CC - L451CE - L451RC - L451RE - L451VC - L451VE - L452CC - L452CE - L452RC - L452RE - L452VC - L452VE - L462CE - L462RE - L462VE - L471QE - L471QG - L471RE - L471RG - L471VE - L471VG - L471ZE - L471ZG - L475RC - L475RE - L475RG - L475VC - L475VE - L475VG - L476JE - L476JG - L476ME - L476MG - L476QE - L476QG - L476RC - L476RE - L476RG - L476VC - L476VE - L476VG - L476ZE - L476ZG - L486JG - L486QG - L486RG - L486VG - L486ZG - L496AE - L496AG - L496QE - L496QG - L496RE - L496RG - L496VE - L496VG - L496ZE - L496ZG - L4A6AG - L4A6QG - L4A6RG - L4A6VG - L4A6ZG - L4P5AE - L4P5AG - L4P5CE - L4P5CG - L4P5QE - L4P5QG - L4P5RE - L4P5RG - L4P5VE - L4P5VG - L4P5ZE - L4P5ZG - L4Q5AG - L4Q5CG - L4Q5QG - L4Q5RG - L4Q5VG - L4Q5ZG - L4R5AG - L4R5AI - L4R5QG - L4R5QI - L4R5VG - L4R5VI - L4R5ZG - L4R5ZI - L4R7AI - L4R7VI - L4R7ZI - L4R9AG - L4R9AI - L4R9VG - L4R9VI - L4R9ZG - L4R9ZI - L4S5AI - L4S5QI - L4S5VI - L4S5ZI - L4S7AI - L4S7VI - L4S7ZI - L4S9AI - L4S9VI - L4S9ZI - L552CC - L552CE - L552ME - L552QC - L552QE - L552RC - L552RE - L552VC - L552VE - L552ZC - L552ZE - L562CE - L562ME - L562QE - L562RE - L562VE - L562ZE - MP151A - MP151C - MP151D - MP151F - MP153A - MP153C - MP153D - MP153F - MP157A - MP157C - MP157D - MP157F - U031C6 - U031C8 - U031F4 - U031F6 - U031F8 - U031G6 - U031G8 - U031K4 - U031K8 - U031R6 - U031R8 - U073CC - U073HC - U073KC - U073MC - U073RC - U083CC - U083HC - U083KC - U083MC - U083RC - U575CG - U575CI - U585CI - U575RG - U575RI - U585RI - U5750G - U5750I - U5850I - U575VG - U575VI - U585VI - U575QG - U575QI - U585QI - U575ZG - U575ZI - U585ZI - U575AG - U575AI - U585AI - WB5MMG - WB50CG - WB30CE - WB10CC - WB55CC - WB55CE - WB55CG - WB55RC - WB55RE - WB55RG - WB55VC - WB55VE - WB55VG - WB55VY - WB15CC - WB35CC - WB35CE - WL55CC - WL54CC - WL55JC - WL54JC - WLE5J8 - WLE5JB - WLE5JC - WLE5C8 - WLE5CB - WLE5CC - WLE4J8 - WLE4JB - WLE4JC - WLE4C8 - WLE4CB - WLE4CC -) +function(stm32_util_create_family_targets FAMILY) + set(CORES ${ARGN}) + list(LENGTH CORES NUM_CORES) + if(${NUM_CORES} EQUAL 0) + set(CORE "") + set(CORE_C "") + elseif(${NUM_CORES} EQUAL 1) + set(CORE "_${CORES}") + set(CORE_C "::${CORES}") + else() + message(FATAL_ERROR "Expected at most one core for family ${FAMILY}: ${CORES}") + endif() + + if(NOT (TARGET STM32::${FAMILY}${CORE_C})) + add_library(STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED) + # Set compiler flags for target + # -Wall: all warnings activated + # -ffunction-sections -fdata-sections: remove unused code + target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE + -mthumb -Wall -ffunction-sections -fdata-sections + ) + # Set linker flags + # -mthumb: Generate thumb code + # -Wl,--gc-sections: Remove unused code + target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE + -mthumb -Wl,--gc-sections + ) + target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE + STM32${FAMILY} + ) + endif() + foreach(TYPE ${STM32_${FAMILY}_TYPES}) + if(NOT (TARGET STM32::${TYPE}${CORE_C})) + add_library(STM32::${TYPE}${CORE_C} INTERFACE IMPORTED) + target_link_libraries(STM32::${TYPE}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C}) + target_compile_definitions(STM32::${TYPE}${CORE_C} INTERFACE + STM32${TYPE} + ) + endif() + endforeach() +endfunction() + +set(STM32_ALL_DEVICES "") +set(STM32_SUPPORTED_FAMILIES_LONG_NAME "") + +include(stm32/c0) +include(stm32/f0) +include(stm32/f1) +include(stm32/f2) +include(stm32/f3) +include(stm32/f4) +include(stm32/f7) +include(stm32/g0) +include(stm32/g4) +include(stm32/h5) +include(stm32/h7) +include(stm32/l0) +include(stm32/l1) +include(stm32/l4) +include(stm32/l5) +include(stm32/u0) +include(stm32/u5) +include(stm32/wb) +include(stm32/wl) +include(stm32/mp1) + # Store a list of devices into a given STM_DEVICES list. # You can also specify multiple device families. Examples: @@ -1356,3 +158,112 @@ macro(stm32_pretty_print_dev_list FAMILIES STM_DEVICES) message(STATUS "${TMP_LIST}") endif() endmacro() + + + +include(FetchContent) + +FetchContent_Declare( + STM32-CMSIS + GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_core/ + GIT_TAG v5.6.0 + GIT_PROGRESS TRUE +) + +foreach(FAMILY ${STM32_FETCH_FAMILIES}) + string(TOLOWER ${FAMILY} FAMILY_L) + + FetchContent_Declare( + STM32Cube${FAMILY} + GIT_REPOSITORY https://github.com/STMicroelectronics/STM32Cube${FAMILY}/ + GIT_TAG ${CUBE_${FAMILY}_VERSION} + GIT_PROGRESS TRUE + ) + + if(CMSIS_${FAMILY}_VERSION STREQUAL cube) + set(STM32_USE_CMSIS_FROM_CUBE_${FAMILY} ON) + else() + FetchContent_Declare( + STM32-CMSIS-${FAMILY} + GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L}/ + GIT_TAG ${CMSIS_${FAMILY}_VERSION} + GIT_PROGRESS TRUE + ) + endif() + + if(HAL_${FAMILY}_VERSION STREQUAL cube) + set(STM32_USE_HAL_FROM_CUBE_${FAMILY} ON) + else() + FetchContent_Declare( + STM32-HAL-${FAMILY} + GIT_REPOSITORY https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/ + GIT_TAG ${HAL_${FAMILY}_VERSION} + GIT_PROGRESS TRUE + ) + endif() + +endforeach() + +function(stm32_fetch_cube) + foreach(FAMILY ${ARGV}) + set(CUBE_NAME STM32Cube${FAMILY}) + string(TOLOWER ${CUBE_NAME} CUBE_NAME_L) + + if(STM32_CUBE_${FAMILY}_PATH) + message(VERBOSE "STM32_CUBE_${FAMILY}_PATH specified, skipping fetch for ${CUBE_NAME}") + continue() + endif() + + FetchContent_MakeAvailable(${CUBE_NAME}) + set(STM32_CUBE_${FAMILY}_PATH ${${CUBE_NAME_L}_SOURCE_DIR} PARENT_SCOPE) + endforeach() +endfunction() + +function(stm32_fetch_cmsis) + if(NOT STM32_CMSIS_PATH) + FetchContent_MakeAvailable(STM32-CMSIS) + set(STM32_CMSIS_PATH ${stm32-cmsis_SOURCE_DIR} PARENT_SCOPE) + else() + message(INFO "STM32_CMSIS_PATH specified, skipping fetch for STM32-CMSIS") + endif() + + foreach(FAMILY ${ARGV}) + if(STM32_USE_CMSIS_FROM_CUBE_${FAMILY}) + stm32_fetch_cube(${FAMILY}) + message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") + set(STM32_CMSIS_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx PARENT_SCOPE) + else() + set(CMSIS_NAME STM32-CMSIS-${FAMILY}) + string(TOLOWER ${CMSIS_NAME} CMSIS_NAME_L) + + if(STM32_CMSIS_${FAMILY}_PATH) + message(INFO "STM32_CMSIS_${FAMILY}_PATH specified, skipping fetch for ${CMSIS_NAME}") + continue() + endif() + + FetchContent_MakeAvailable(${CMSIS_NAME}) + set(STM32_CMSIS_${FAMILY}_PATH ${${CMSIS_NAME_L}_SOURCE_DIR} PARENT_SCOPE) + endif() + endforeach() +endfunction() + +function(stm32_fetch_hal) + foreach(FAMILY ${ARGV}) + if(STM32_USE_HAL_FROM_CUBE_${FAMILY}) + stm32_fetch_cube(${FAMILY}) + message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") + set(STM32_HAL_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver PARENT_SCOPE) + else() + set(HAL_NAME STM32-HAL-${FAMILY}) + string(TOLOWER ${HAL_NAME} HAL_NAME_L) + + if(STM32_HAL_${FAMILY}_PATH) + message(INFO "STM32_HAL_${FAMILY}_PATH specified, skipping fetch for ${HAL_NAME}") + continue() + endif() + + FetchContent_MakeAvailable(${HAL_NAME}) + set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE) + endif() + endforeach() +endfunction() diff --git a/cmake/stm32/f0.cmake b/cmake/stm32/f0.cmake index 92d5e7a3..48471149 100644 --- a/cmake/stm32/f0.cmake +++ b/cmake/stm32/f0.cmake @@ -23,3 +23,89 @@ target_compile_options(STM32::F0 INTERFACE target_link_options(STM32::F0 INTERFACE -mcpu=cortex-m0 ) + +list(APPEND STM32_ALL_DEVICES + F030C6 + F030C8 + F030CC + F030F4 + F030K6 + F030R8 + F030RC + F031C4 + F031C6 + F031E6 + F031F4 + F031F6 + F031G4 + F031G6 + F031K4 + F031K6 + F038C6 + F038E6 + F038F6 + F038G6 + F038K6 + F042C4 + F042C6 + F042F4 + F042F6 + F042G4 + F042G6 + F042K4 + F042K6 + F042T6 + F048C6 + F048G6 + F048T6 + F051C4 + F051C6 + F051C8 + F051K4 + F051K6 + F051K8 + F051R4 + F051R6 + F051R8 + F051T8 + F058C8 + F058R8 + F058T8 + F070C6 + F070CB + F070F6 + F070RB + F071C8 + F071CB + F071RB + F071V8 + F071VB + F072C8 + F072CB + F072R8 + F072RB + F072V8 + F072VB + F078CB + F078RB + F078VB + F091CB + F091CC + F091RB + F091RC + F091VB + F091VC + F098CC + F098RC + F098VC +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F0 +) + +list(APPEND STM32_FETCH_FAMILIES F0) + +set(CUBE_F0_VERSION v1.11.5) +set(CMSIS_F0_VERSION v2.3.7) +set(HAL_F0_VERSION v1.7.8) diff --git a/cmake/stm32/f1.cmake b/cmake/stm32/f1.cmake index bc97ceb6..a32cb3d6 100644 --- a/cmake/stm32/f1.cmake +++ b/cmake/stm32/f1.cmake @@ -76,3 +76,111 @@ function(stm32f1_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) set(${RAM_SIZE} ${RAM} PARENT_SCOPE) endfunction() + +list(APPEND STM32_ALL_DEVICES + F100C4 + F100C6 + F100C8 + F100CB + F100R4 + F100R6 + F100R8 + F100RB + F100RC + F100RD + F100RE + F100V8 + F100VB + F100VC + F100VD + F100VE + F100ZC + F100ZD + F100ZE + F101C4 + F101C6 + F101C8 + F101CB + F101R4 + F101R6 + F101R8 + F101RB + F101RC + F101RD + F101RE + F101RF + F101RG + F101T4 + F101T6 + F101T8 + F101TB + F101V8 + F101VB + F101VC + F101VD + F101VE + F101VF + F101VG + F101ZC + F101ZD + F101ZE + F101ZF + F101ZG + F102C4 + F102C6 + F102C8 + F102CB + F102R4 + F102R6 + F102R8 + F102RB + F103C4 + F103C6 + F103C8 + F103CB + F103R4 + F103R6 + F103R8 + F103RB + F103RC + F103RD + F103RE + F103RF + F103RG + F103T4 + F103T6 + F103T8 + F103TB + F103V8 + F103VB + F103VC + F103VD + F103VE + F103VF + F103VG + F103ZC + F103ZD + F103ZE + F103ZF + F103ZG + F105R8 + F105RB + F105RC + F105V8 + F105VB + F105VC + F107RB + F107RC + F107VB + F107VC +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F1 +) + +list(APPEND STM32_FETCH_FAMILIES F1) + +set(CUBE_F1_VERSION v1.8.5) +set(CMSIS_F1_VERSION v4.3.4) +set(HAL_F1_VERSION v1.1.9) diff --git a/cmake/stm32/f2.cmake b/cmake/stm32/f2.cmake index 38c2c2a5..c59f4379 100644 --- a/cmake/stm32/f2.cmake +++ b/cmake/stm32/f2.cmake @@ -37,3 +37,54 @@ function(stm32f2_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) set(${RAM_SIZE} ${RAM} PARENT_SCOPE) endif() endfunction() + +list(APPEND STM32_ALL_DEVICES + F205RB + F205RC + F205RE + F205RF + F205RG + F205VB + F205VC + F205VE + F205VF + F205VG + F205ZC + F205ZE + F205ZF + F205ZG + F207IC + F207IE + F207IF + F207IG + F207VC + F207VE + F207VF + F207VG + F207ZC + F207ZE + F207ZF + F207ZG + F215RE + F215RG + F215VE + F215VG + F215ZE + F215ZG + F217IE + F217IG + F217VE + F217VG + F217ZE + F217ZG +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F2 +) + +list(APPEND STM32_FETCH_FAMILIES F2) + +set(CUBE_F2_VERSION v1.9.4) +set(CMSIS_F2_VERSION v2.2.6) +set(HAL_F2_VERSION v1.2.8) diff --git a/cmake/stm32/f3.cmake b/cmake/stm32/f3.cmake index 7c3845b4..8d7003a7 100644 --- a/cmake/stm32/f3.cmake +++ b/cmake/stm32/f3.cmake @@ -57,3 +57,85 @@ function(stm32f3_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) set(${RAM_SIZE} ${RAM} PARENT_SCOPE) endif() endfunction() + +list(APPEND STM32_ALL_DEVICES + F301C6 + F301C8 + F301K6 + F301K8 + F301R6 + F301R8 + F302C6 + F302C8 + F302CB + F302CC + F302K6 + F302K8 + F302R6 + F302R8 + F302RB + F302RC + F302RD + F302RE + F302VB + F302VC + F302VD + F302VE + F302ZD + F302ZE + F303C6 + F303C8 + F303CB + F303CC + F303K6 + F303K8 + F303R6 + F303R8 + F303RB + F303RC + F303RD + F303RE + F303VB + F303VC + F303VD + F303VE + F303ZD + F303ZE + F318C8 + F318K8 + F328C8 + F334C4 + F334C6 + F334C8 + F334K4 + F334K6 + F334K8 + F334R6 + F334R8 + F358CC + F358RC + F358VC + F373C8 + F373CB + F373CC + F373R8 + F373RB + F373RC + F373V8 + F373VB + F373VC + F378CC + F378RC + F378VC + F398VE +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F3 +) + +list(APPEND STM32_FETCH_FAMILIES F3) + +set(CUBE_F3_VERSION v1.11.5) +set(CMSIS_F3_VERSION v2.3.8) +set(HAL_F3_VERSION v1.5.8) diff --git a/cmake/stm32/f4.cmake b/cmake/stm32/f4.cmake index 06d1d9eb..a98cfba6 100644 --- a/cmake/stm32/f4.cmake +++ b/cmake/stm32/f4.cmake @@ -27,3 +27,165 @@ target_compile_options(STM32::F4 INTERFACE target_link_options(STM32::F4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + F401CB + F401CC + F401CD + F401CE + F401RB + F401RC + F401RD + F401RE + F401VB + F401VC + F401VD + F401VE + F405OE + F405OG + F405RG + F405VG + F405ZG + F407IE + F407IG + F407VE + F407VG + F407ZE + F407ZG + F410C8 + F410CB + F410R8 + F410RB + F410T8 + F410TB + F411CC + F411CE + F411RC + F411RE + F411VC + F411VE + F412CE + F412CG + F412RE + F412RG + F412VE + F412VG + F412ZE + F412ZG + F413CG + F413CH + F413MG + F413MH + F413RG + F413RH + F413VG + F413VH + F413ZG + F413ZH + F415OG + F415RG + F415VG + F415ZG + F417IE + F417IG + F417VE + F417VG + F417ZE + F417ZG + F423CH + F423MH + F423RH + F423VH + F423ZH + F427AG + F427AI + F427IG + F427II + F427VG + F427VI + F427ZG + F427ZI + F429AG + F429AI + F429BE + F429BG + F429BI + F429IE + F429IG + F429II + F429NE + F429NG + F429NI + F429VE + F429VG + F429VI + F429ZE + F429ZG + F429ZI + F437AI + F437IG + F437II + F437VG + F437VI + F437ZG + F437ZI + F439AI + F439BG + F439BI + F439IG + F439II + F439NG + F439NI + F439VG + F439VI + F439ZG + F439ZI + F446MC + F446ME + F446RC + F446RE + F446VC + F446VE + F446ZC + F446ZE + F469AE + F469AG + F469AI + F469BE + F469BG + F469BI + F469IE + F469IG + F469II + F469NE + F469NG + F469NI + F469VE + F469VG + F469VI + F469ZE + F469ZG + F469ZI + F479AG + F479AI + F479BG + F479BI + F479IG + F479II + F479NG + F479NI + F479VG + F479VI + F479ZG + F479ZI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F4 +) + +list(APPEND STM32_FETCH_FAMILIES F4) + +set(CUBE_F4_VERSION v1.28.0) +set(CMSIS_F4_VERSION v2.6.9) +set(HAL_F4_VERSION v1.8.2) diff --git a/cmake/stm32/f7.cmake b/cmake/stm32/f7.cmake index cd9d87e7..32f5465d 100644 --- a/cmake/stm32/f7.cmake +++ b/cmake/stm32/f7.cmake @@ -23,3 +23,101 @@ target_compile_options(STM32::F7 INTERFACE target_link_options(STM32::F7 INTERFACE -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + F722IC + F722IE + F722RC + F722RE + F722VC + F722VE + F722ZC + F722ZE + F723IC + F723IE + F723VE + F723ZC + F723ZE + F730I8 + F730R8 + F730V8 + F730Z8 + F732IE + F732RE + F732VE + F732ZE + F733IE + F733VE + F733ZE + F745IE + F745IG + F745VE + F745VG + F745ZE + F745ZG + F746BE + F746BG + F746IE + F746IG + F746NE + F746NG + F746VE + F746VG + F746ZE + F746ZG + F750N8 + F750V8 + F750Z8 + F756BG + F756IG + F756NG + F756VG + F756ZG + F765BG + F765BI + F765IG + F765II + F765NG + F765NI + F765VG + F765VI + F765ZG + F765ZI + F767BG + F767BI + F767IG + F767II + F767NG + F767NI + F767VG + F767VI + F767ZG + F767ZI + F769AI + F769BG + F769BI + F769IG + F769II + F769NG + F769NI + F777BI + F777II + F777NI + F777VI + F777ZI + F778AI + F779AI + F779BI + F779II + F779NI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32F7 +) + +list(APPEND STM32_FETCH_FAMILIES F7) + +set(CUBE_F7_VERSION v1.17.1) +set(CMSIS_F7_VERSION v1.2.8) +set(HAL_F7_VERSION v1.3.0) diff --git a/cmake/stm32/g0.cmake b/cmake/stm32/g0.cmake index ce362099..ad2155c6 100644 --- a/cmake/stm32/g0.cmake +++ b/cmake/stm32/g0.cmake @@ -23,3 +23,119 @@ target_compile_options(STM32::G0 INTERFACE target_link_options(STM32::G0 INTERFACE -mcpu=cortex-m0plus ) + +list(APPEND STM32_ALL_DEVICES + G030C6 + G030C8 + G030F6 + G030J6 + G030K6 + G030K8 + G031C4 + G031C6 + G031C8 + G031F4 + G031F6 + G031F8 + G031G4 + G031G6 + G031G8 + G031J4 + G031J6 + G031K4 + G031K6 + G031K8 + G031Y8 + G041C6 + G041C8 + G041F6 + G041F8 + G041G6 + G041G8 + G041J6 + G041K6 + G041K8 + G041Y8 + G050C6 + G050C8 + G050F6 + G050K6 + G050K8 + G051C6 + G051C8 + G051F6 + G051F8 + G051G6 + G051G8 + G051K6 + G051K8 + G061C6 + G061C8 + G061F6 + G061F8 + G061G6 + G061G8 + G061K6 + G061K8 + G070CB + G070KB + G070RB + G071C6 + G071C8 + G071CB + G071EB + G071G6 + G071G8 + G071GB + G071K6 + G071K8 + G071KB + G071R6 + G071R8 + G071RB + G081CB + G081EB + G081GB + G081KB + G081RB + G0B0CE + G0B0KE + G0B0RE + G0B0VE + G0B1CB + G0B1CC + G0B1CE + G0B1KB + G0B1KC + G0B1KE + G0B1MB + G0B1MC + G0B1ME + G0B1NE + G0B1RB + G0B1RC + G0B1RE + G0B1VB + G0B1VC + G0B1VE + G0C1CC + G0C1CE + G0C1KC + G0C1KE + G0C1MC + G0C1ME + G0C1RC + G0C1RE + G0C1VC + G0C1VE +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32G0 +) + +list(APPEND STM32_FETCH_FAMILIES G0) + +set(CUBE_G0_VERSION v1.6.2) +set(CMSIS_G0_VERSION v1.4.4) +set(HAL_G0_VERSION v1.4.6) diff --git a/cmake/stm32/g4.cmake b/cmake/stm32/g4.cmake index f05b5757..dcfc3006 100644 --- a/cmake/stm32/g4.cmake +++ b/cmake/stm32/g4.cmake @@ -23,3 +23,110 @@ target_compile_options(STM32::G4 INTERFACE target_link_options(STM32::G4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + G431C6 + G431C8 + G431CB + G431K6 + G431K8 + G431KB + G431M6 + G431M8 + G431MB + G431R6 + G431R8 + G431RB + G431V6 + G431V8 + G431VB + G441CB + G441KB + G441MB + G441RB + G441VB + G471CC + G471CE + G471MC + G471ME + G471QC + G471QE + G471RC + G471RE + G471VC + G471VE + G473CB + G473CC + G473CE + G473MB + G473MC + G473ME + G473PB + G473PC + G473PE + G473QB + G473QC + G473QE + G473RB + G473RC + G473RE + G473VB + G473VC + G473VE + G474CB + G474CC + G474CE + G474MB + G474MC + G474ME + G474PB + G474PC + G474PE + G474QB + G474QC + G474QE + G474RB + G474RC + G474RE + G474VB + G474VC + G474VE + G483CE + G483ME + G483PE + G483QE + G483RE + G483VE + G484CE + G484ME + G484PE + G484QE + G484RE + G484VE + G491CC + G491KC + G491MC + G491RC + G491VC + G491CE + G491KE + G491ME + G491RE + G491VE + G4A1CE + G4A1KE + G4A1ME + G4A1RE + G4A1VE + GBK1CB +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32G4 +) + +list(APPEND STM32_FETCH_FAMILIES G4) + +set(CUBE_G4_VERSION v1.5.2) +set(CMSIS_G4_VERSION v1.2.3) +set(HAL_G4_VERSION v1.2.3) diff --git a/cmake/stm32/h5.cmake b/cmake/stm32/h5.cmake index 620b5f2e..76499c35 100644 --- a/cmake/stm32/h5.cmake +++ b/cmake/stm32/h5.cmake @@ -21,3 +21,47 @@ target_compile_options(STM32::H5 INTERFACE target_link_options(STM32::H5 INTERFACE -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb ) + +list(APPEND STM32_ALL_DEVICES + H503CB + H503EB + H503KB + H503RB + H562AG + H562AI + H562IG + H562II + H562RG + H562RI + H562VG + H562VI + H562ZG + H562ZI + H563AG + H563AI + H563IG + H563II + H563MI + H563RG + H563RI + H563VG + H563VI + H563ZG + H563ZI + H573AI + H573II + H573MI + H573RI + H573VI + H573ZI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32H5 +) + +list(APPEND STM32_FETCH_FAMILIES H5) + +set(CUBE_H5_VERSION v1.2.0) +set(CMSIS_H5_VERSION v1.2.0) +set(HAL_H5_VERSION v1.2.0) diff --git a/cmake/stm32/h7.cmake b/cmake/stm32/h7.cmake index b9410148..b355f174 100644 --- a/cmake/stm32/h7.cmake +++ b/cmake/stm32/h7.cmake @@ -85,3 +85,130 @@ function(stm32h7_get_device_cores DEVICE TYPE CORES) set(${CORES} M7 PARENT_SCOPE) endif() endfunction() + +list(APPEND STM32_ALL_DEVICES + H723VE + H723VG + H723ZE + H723ZG + H725AE + H725AG + H725IE + H725IG + H725RE + H725RG + H725VE + H725VG + H725ZE + H725ZG + H730AB + H730IB + H730VB + H730ZB + H733VG + H733ZG + H735AG + H735IG + H735RG + H735VG + H735ZG + H742AG + H742AI + H742BG + H742BI + H742IG + H742II + H742VG + H742VI + H742XG + H742XI + H742ZG + H742ZI + H743AG + H743AI + H743BG + H743BI + H743IG + H743II + H743VG + H743VI + H743XG + H743XI + H743ZG + H743ZI + H745BG + H745BI + H745IG + H745II + H745XG + H745XI + H745ZG + H745ZI + H747AG + H747AI + H747BG + H747BI + H747IG + H747II + H747XG + H747XI + H747ZI + H750IB + H750VB + H750XB + H750ZB + H753AI + H753BI + H753II + H753VI + H753XI + H753ZI + H755BI + H755II + H755XI + H755ZI + H757AI + H757BI + H757II + H757XI + H757ZI + H7A3AG + H7A3AI + H7A3IG + H7A3II + H7A3LG + H7A3LI + H7A3NG + H7A3NI + H7A3QI + H7A3RG + H7A3RI + H7A3VG + H7A3VI + H7A3ZG + H7A3ZI + H7B0AB + H7B0IB + H7B0RB + H7B0VB + H7B0ZB + H7B3AI + H7B3II + H7B3LI + H7B3NI + H7B3QI + H7B3RI + H7B3VI + H7B3ZI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32H7_M4 + STM32H7_M7 +) + +list(APPEND STM32_FETCH_FAMILIES H7) + +set(CUBE_H7_VERSION v1.11.2) +set(CMSIS_H7_VERSION v1.10.4) +set(HAL_H7_VERSION v1.11.3) diff --git a/cmake/stm32/l0.cmake b/cmake/stm32/l0.cmake index abc5dfd1..cb8a1c17 100644 --- a/cmake/stm32/l0.cmake +++ b/cmake/stm32/l0.cmake @@ -27,3 +27,114 @@ target_compile_options(STM32::L0 INTERFACE target_link_options(STM32::L0 INTERFACE -mcpu=cortex-m0plus ) + +list(APPEND STM32_ALL_DEVICES + L010C6 + L010F4 + L010K4 + L010K8 + L010R8 + L010RB + L011D3 + L011D4 + L011E3 + L011E4 + L011F3 + L011F4 + L011G3 + L011G4 + L011K3 + L011K4 + L021D4 + L021F4 + L021G4 + L021K4 + L031C4 + L031C6 + L031E4 + L031E6 + L031F4 + L031F6 + L031G4 + L031G6 + L031K4 + L031K6 + L041C6 + L041E6 + L041F6 + L041G6 + L041K6 + L051C6 + L051C8 + L051K6 + L051K8 + L051R6 + L051R8 + L051T6 + L051T8 + L052C6 + L052C8 + L052K6 + L052K8 + L052R6 + L052R8 + L052T6 + L052T8 + L053C6 + L053C8 + L053R6 + L053R8 + L062C8 + L062K8 + L063C8 + L063R8 + L071C8 + L071CB + L071CZ + L071K8 + L071KB + L071KZ + L071RB + L071RZ + L071V8 + L071VB + L071VZ + L072CB + L072CZ + L072KB + L072KZ + L072RB + L072RZ + L072V8 + L072VB + L072VZ + L073CB + L073CZ + L073RB + L073RZ + L073V8 + L073VB + L073VZ + L081CB + L081CZ + L081KZ + L082CZ + L082KZ + L083CB + L083CZ + L083RB + L083RZ + L083V8 + L083VB + L083VZ +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32L0 +) + +list(APPEND STM32_FETCH_FAMILIES L0) + +set(CUBE_L0_VERSION v1.12.2) +set(CMSIS_L0_VERSION v1.9.3) +set(HAL_L0_VERSION v1.10.6) diff --git a/cmake/stm32/l1.cmake b/cmake/stm32/l1.cmake index 84feb792..66dac794 100644 --- a/cmake/stm32/l1.cmake +++ b/cmake/stm32/l1.cmake @@ -71,3 +71,75 @@ function(stm32l1_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) set(${RAM_SIZE} ${RAM} PARENT_SCOPE) endif() endfunction() + +list(APPEND STM32_ALL_DEVICES + L100C6 + L100R8 + L100RB + L100RC + L151C6 + L151C8 + L151CB + L151CC + L151QC + L151QD + L151QE + L151R6 + L151R8 + L151RB + L151RC + L151RD + L151RE + L151UC + L151V8 + L151VB + L151VC + L151VD + L151VE + L151ZC + L151ZD + L151ZE + L152C6 + L152C8 + L152CB + L152CC + L152QC + L152QD + L152QE + L152R6 + L152R8 + L152RB + L152RC + L152RD + L152RE + L152UC + L152V8 + L152VB + L152VC + L152VD + L152VE + L152ZC + L152ZD + L152ZE + L162QC + L162QD + L162RC + L162RD + L162RE + L162VC + L162VD + L162VE + L162ZC + L162ZD + L162ZE +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32L1 +) + +list(APPEND STM32_FETCH_FAMILIES L1) + +set(CUBE_L1_VERSION v1.10.4) +set(CMSIS_L1_VERSION v2.3.3) +set(HAL_L1_VERSION v1.4.5) diff --git a/cmake/stm32/l4.cmake b/cmake/stm32/l4.cmake index 64f70f7d..7adc1b54 100644 --- a/cmake/stm32/l4.cmake +++ b/cmake/stm32/l4.cmake @@ -38,3 +38,154 @@ target_compile_options(STM32::L4 INTERFACE target_link_options(STM32::L4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + L412C8 + L412CB + L412K8 + L412KB + L412R8 + L412RB + L412T8 + L412TB + L422CB + L422KB + L422RB + L422TB + L431CB + L431CC + L431KB + L431KC + L431RB + L431RC + L431VC + L432KB + L432KC + L433CB + L433CC + L433RB + L433RC + L433VC + L442KC + L443CC + L443RC + L443VC + L451CC + L451CE + L451RC + L451RE + L451VC + L451VE + L452CC + L452CE + L452RC + L452RE + L452VC + L452VE + L462CE + L462RE + L462VE + L471QE + L471QG + L471RE + L471RG + L471VE + L471VG + L471ZE + L471ZG + L475RC + L475RE + L475RG + L475VC + L475VE + L475VG + L476JE + L476JG + L476ME + L476MG + L476QE + L476QG + L476RC + L476RE + L476RG + L476VC + L476VE + L476VG + L476ZE + L476ZG + L486JG + L486QG + L486RG + L486VG + L486ZG + L496AE + L496AG + L496QE + L496QG + L496RE + L496RG + L496VE + L496VG + L496ZE + L496ZG + L4A6AG + L4A6QG + L4A6RG + L4A6VG + L4A6ZG + L4P5AE + L4P5AG + L4P5CE + L4P5CG + L4P5QE + L4P5QG + L4P5RE + L4P5RG + L4P5VE + L4P5VG + L4P5ZE + L4P5ZG + L4Q5AG + L4Q5CG + L4Q5QG + L4Q5RG + L4Q5VG + L4Q5ZG + L4R5AG + L4R5AI + L4R5QG + L4R5QI + L4R5VG + L4R5VI + L4R5ZG + L4R5ZI + L4R7AI + L4R7VI + L4R7ZI + L4R9AG + L4R9AI + L4R9VG + L4R9VI + L4R9ZG + L4R9ZI + L4S5AI + L4S5QI + L4S5VI + L4S5ZI + L4S7AI + L4S7VI + L4S7ZI + L4S9AI + L4S9VI + L4S9ZI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32L4 +) + +list(APPEND STM32_FETCH_FAMILIES L4) + +set(CUBE_L4_VERSION v1.18.0) +set(CMSIS_L4_VERSION v1.7.3) +set(HAL_L4_VERSION v1.13.4) diff --git a/cmake/stm32/l5.cmake b/cmake/stm32/l5.cmake index 7663b8b6..4c23d6ac 100644 --- a/cmake/stm32/l5.cmake +++ b/cmake/stm32/l5.cmake @@ -20,3 +20,33 @@ target_compile_options(STM32::L5 INTERFACE target_link_options(STM32::L5 INTERFACE -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + L552CC + L552CE + L552ME + L552QC + L552QE + L552RC + L552RE + L552VC + L552VE + L552ZC + L552ZE + L562CE + L562ME + L562QE + L562RE + L562VE + L562ZE +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32L5 +) + +list(APPEND STM32_FETCH_FAMILIES L5) + +set(CUBE_L5_VERSION v1.5.1) +set(CMSIS_L5_VERSION v1.0.6) +set(HAL_L5_VERSION v1.0.6) diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index 4c8afd63..fb36f9bf 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -29,3 +29,28 @@ function(stm32mp1_get_memory_info DEVICE TYPE FLASH_SIZE) set(${FLASH_SIZE} "0KB" PARENT_SCOPE) endif() endfunction() + +list(APPEND STM32_ALL_DEVICES + MP151A + MP151C + MP151D + MP151F + MP153A + MP153C + MP153D + MP153F + MP157A + MP157C + MP157D + MP157F +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32MP1_M4 +) + +list(APPEND STM32_FETCH_FAMILIES MP1) + +set(CUBE_MP1_VERSION 1.6.0) +set(CMSIS_MP1_VERSION cube) +set(HAL_MP1_VERSION cube) diff --git a/cmake/stm32/u0.cmake b/cmake/stm32/u0.cmake index 25fcde87..561f60fe 100644 --- a/cmake/stm32/u0.cmake +++ b/cmake/stm32/u0.cmake @@ -27,3 +27,37 @@ target_compile_options(STM32::U0 INTERFACE target_link_options(STM32::U0 INTERFACE -mcpu=cortex-m0plus ) + +list(APPEND STM32_ALL_DEVICES + U031C6 + U031C8 + U031F4 + U031F6 + U031F8 + U031G6 + U031G8 + U031K4 + U031K8 + U031R6 + U031R8 + U073CC + U073HC + U073KC + U073MC + U073RC + U083CC + U083HC + U083KC + U083MC + U083RC +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32U0 +) + +list(APPEND STM32_FETCH_FAMILIES U0) + +set(CUBE_U0_VERSION v1.0.0) +set(CMSIS_U0_VERSION v1.0.0) +set(HAL_U0_VERSION v1.0.0) diff --git a/cmake/stm32/u5.cmake b/cmake/stm32/u5.cmake index 4dcbd7bb..2fef30bb 100644 --- a/cmake/stm32/u5.cmake +++ b/cmake/stm32/u5.cmake @@ -17,3 +17,37 @@ target_compile_options(STM32::U5 INTERFACE target_link_options(STM32::U5 INTERFACE -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard ) + +list(APPEND STM32_ALL_DEVICES + U575CG + U575CI + U585CI + U575RG + U575RI + U585RI + U5750G + U5750I + U5850I + U575VG + U575VI + U585VI + U575QG + U575QI + U585QI + U575ZG + U575ZI + U585ZI + U575AG + U575AI + U585AI +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32U5 +) + +list(APPEND STM32_FETCH_FAMILIES U5) + +set(CUBE_U5_VERSION v1.5.0) +set(CMSIS_U5_VERSION v1.4.0) +set(HAL_U5_VERSION v1.5.0) diff --git a/cmake/stm32/utilities.cmake b/cmake/stm32/utilities.cmake deleted file mode 100644 index 26845657..00000000 --- a/cmake/stm32/utilities.cmake +++ /dev/null @@ -1,162 +0,0 @@ -function(stm32_util_create_family_targets FAMILY) - set(CORES ${ARGN}) - list(LENGTH CORES NUM_CORES) - if(${NUM_CORES} EQUAL 0) - set(CORE "") - set(CORE_C "") - elseif(${NUM_CORES} EQUAL 1) - set(CORE "_${CORES}") - set(CORE_C "::${CORES}") - else() - message(FATAL_ERROR "Expected at most one core for family ${FAMILY}: ${CORES}") - endif() - - if(NOT (TARGET STM32::${FAMILY}${CORE_C})) - add_library(STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED) - # Set compiler flags for target - # -Wall: all warnings activated - # -ffunction-sections -fdata-sections: remove unused code - target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE - -mthumb -Wall -ffunction-sections -fdata-sections - ) - # Set linker flags - # -mthumb: Generate thumb code - # -Wl,--gc-sections: Remove unused code - target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE - -mthumb -Wl,--gc-sections - ) - target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE - STM32${FAMILY} - ) - endif() - foreach(TYPE ${STM32_${FAMILY}_TYPES}) - if(NOT (TARGET STM32::${TYPE}${CORE_C})) - add_library(STM32::${TYPE}${CORE_C} INTERFACE IMPORTED) - target_link_libraries(STM32::${TYPE}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C}) - target_compile_definitions(STM32::${TYPE}${CORE_C} INTERFACE - STM32${TYPE} - ) - endif() - endforeach() -endfunction() - -include(FetchContent) - -# A CMSIS or HAL driver can specify 'cube' as version number to indicate that the driver is taken from the Cube repository -set(STM32_FETCH_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H5 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL ) -set(STM32_FETCH_CUBE_VERSIONS v1.1.0 v1.11.2 v1.8.4 v1.9.3 v1.11.2 v1.28.0 v1.16.1 v1.4.1 v1.4.0 v1.1.0 v1.9.0 v1.12.0 v1.10.3 v1.17.0 v1.4.0 1.5.0 v1.0.0 v1.4.0 v1.12.0 v1.1.0) -set(STM32_FETCH_CMSIS_VERSIONS v1.1.0 v2.3.5 v4.3.3 v2.2.5 v2.3.5 v2.6.9 v1.2.6 v1.4.0 v1.2.1 v1.1.0 v1.10.0 v1.9.1 v2.3.2 v1.7.1 v1.0.4 cube v1.0.0 v1.3.1 v1.9.0 v1.1.0) - -set(STM32_FETCH_HAL_VERSIONS v1.1.0 v1.7.5 v1.1.8 v1.2.7 v1.5.5 v1.8.2 v1.2.9 v1.4.1 v1.2.1 v1.1.0 v1.10.0 v1.10.4 v1.4.4 v1.13.0 v1.0.4 cube v1.0.0 v1.4.0 v1.9.0 v1.1.0) - - - -FetchContent_Declare( - STM32-CMSIS - GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_core/ - GIT_TAG v5.6.0 - GIT_PROGRESS TRUE -) - -set(IDX 0) -foreach(FAMILY ${STM32_FETCH_FAMILIES}) - string(TOLOWER ${FAMILY} FAMILY_L) - list(GET STM32_FETCH_CUBE_VERSIONS ${IDX} CUBE_VERSION) - list(GET STM32_FETCH_CMSIS_VERSIONS ${IDX} CMSIS_VERSION) - list(GET STM32_FETCH_HAL_VERSIONS ${IDX} HAL_VERSION) - - FetchContent_Declare( - STM32Cube${FAMILY} - GIT_REPOSITORY https://github.com/STMicroelectronics/STM32Cube${FAMILY}/ - GIT_TAG ${CUBE_VERSION} - GIT_PROGRESS TRUE - ) - - if(CMSIS_VERSION STREQUAL cube) - set(STM32_USE_CMSIS_FROM_CUBE_${FAMILY} ON) - else() - FetchContent_Declare( - STM32-CMSIS-${FAMILY} - GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L}/ - GIT_TAG ${CMSIS_VERSION} - GIT_PROGRESS TRUE - ) - endif() - - if(HAL_VERSION STREQUAL cube) - set(STM32_USE_HAL_FROM_CUBE_${FAMILY} ON) - else() - FetchContent_Declare( - STM32-HAL-${FAMILY} - GIT_REPOSITORY https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/ - GIT_TAG ${HAL_VERSION} - GIT_PROGRESS TRUE - ) - endif() - - math(EXPR IDX "${IDX} + 1") -endforeach() - -function(stm32_fetch_cube) - foreach(FAMILY ${ARGV}) - set(CUBE_NAME STM32Cube${FAMILY}) - string(TOLOWER ${CUBE_NAME} CUBE_NAME_L) - - if(STM32_CUBE_${FAMILY}_PATH) - message(VERBOSE "STM32_CUBE_${FAMILY}_PATH specified, skipping fetch for ${CUBE_NAME}") - continue() - endif() - - FetchContent_MakeAvailable(${CUBE_NAME}) - set(STM32_CUBE_${FAMILY}_PATH ${${CUBE_NAME_L}_SOURCE_DIR} PARENT_SCOPE) - endforeach() -endfunction() - -function(stm32_fetch_cmsis) - if(NOT STM32_CMSIS_PATH) - FetchContent_MakeAvailable(STM32-CMSIS) - set(STM32_CMSIS_PATH ${stm32-cmsis_SOURCE_DIR} PARENT_SCOPE) - else() - message(INFO "STM32_CMSIS_PATH specified, skipping fetch for STM32-CMSIS") - endif() - - foreach(FAMILY ${ARGV}) - if(STM32_USE_CMSIS_FROM_CUBE_${FAMILY}) - stm32_fetch_cube(${FAMILY}) - message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") - set(STM32_CMSIS_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx PARENT_SCOPE) - else() - set(CMSIS_NAME STM32-CMSIS-${FAMILY}) - string(TOLOWER ${CMSIS_NAME} CMSIS_NAME_L) - - if(STM32_CMSIS_${FAMILY}_PATH) - message(INFO "STM32_CMSIS_${FAMILY}_PATH specified, skipping fetch for ${CMSIS_NAME}") - continue() - endif() - - FetchContent_MakeAvailable(${CMSIS_NAME}) - set(STM32_CMSIS_${FAMILY}_PATH ${${CMSIS_NAME_L}_SOURCE_DIR} PARENT_SCOPE) - endif() - endforeach() -endfunction() - -function(stm32_fetch_hal) - foreach(FAMILY ${ARGV}) - if(STM32_USE_HAL_FROM_CUBE_${FAMILY}) - stm32_fetch_cube(${FAMILY}) - message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") - set(STM32_HAL_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver PARENT_SCOPE) - else() - set(HAL_NAME STM32-HAL-${FAMILY}) - string(TOLOWER ${HAL_NAME} HAL_NAME_L) - - if(STM32_HAL_${FAMILY}_PATH) - message(INFO "STM32_HAL_${FAMILY}_PATH specified, skipping fetch for ${HAL_NAME}") - continue() - endif() - - FetchContent_MakeAvailable(${HAL_NAME}) - set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE) - endif() - endforeach() -endfunction() diff --git a/cmake/stm32/wb.cmake b/cmake/stm32/wb.cmake index 77dfbec6..4f455588 100644 --- a/cmake/stm32/wb.cmake +++ b/cmake/stm32/wb.cmake @@ -36,3 +36,32 @@ function(stm32wb_get_memory_info DEVICE TYPE CORE RAM RAM_ORIGIN TWO_FLASH_BANKS set(${RAM_ORIGIN} 0x20000004 PARENT_SCOPE) endfunction() +list(APPEND STM32_ALL_DEVICES + WB5MMG + WB50CG + WB30CE + WB10CC + WB55CC + WB55CE + WB55CG + WB55RC + WB55RE + WB55RG + WB55VC + WB55VE + WB55VG + WB55VY + WB15CC + WB35CC + WB35CE +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32WB_M4 +) + +list(APPEND STM32_FETCH_FAMILIES WB) + +set(CUBE_WB_VERSION v1.19.0) +set(CMSIS_WB_VERSION v1.12.1) +set(HAL_WB_VERSION v1.14.2) diff --git a/cmake/stm32/wl.cmake b/cmake/stm32/wl.cmake index eb54897e..2dc7564f 100644 --- a/cmake/stm32/wl.cmake +++ b/cmake/stm32/wl.cmake @@ -66,12 +66,40 @@ function(stm32wl_get_memory_info DEVICE TYPE CORE RAM FLASH_ORIGIN RAM_ORIGIN TW endif() endfunction() - - function(stm32wl_get_device_cores DEVICE TYPE CORES) if(${TYPE} IN_LIST STM32_WL_DUAL_CORE) set(${CORES} M4 M0PLUS PARENT_SCOPE) else() set(${CORES} M4 PARENT_SCOPE) endif() -endfunction() \ No newline at end of file +endfunction() + +list(APPEND STM32_ALL_DEVICES + WL55CC + WL54CC + WL55JC + WL54JC + WLE5J8 + WLE5JB + WLE5JC + WLE5C8 + WLE5CB + WLE5CC + WLE4J8 + WLE4JB + WLE4JC + WLE4C8 + WLE4CB + WLE4CC +) + +list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME + STM32WL_M0PLUS + STM32WL_M4 +) + +list(APPEND STM32_FETCH_FAMILIES WL) + +set(CUBE_WL_VERSION v1.3.0) +set(CMSIS_WL_VERSION v1.2.0) +set(HAL_WL_VERSION v1.3.0) From d92c104b80f4c9ae1e0c9337190fd9a7620a0a07 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Sun, 12 May 2024 14:12:13 +0200 Subject: [PATCH 107/119] Create MB_MEM2 shared section for devices with shared RAM up to date startup initialize it --- cmake/stm32/linker_ld.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/stm32/linker_ld.cmake b/cmake/stm32/linker_ld.cmake index 6b15cbb3..e67656fd 100644 --- a/cmake/stm32/linker_ld.cmake +++ b/cmake/stm32/linker_ld.cmake @@ -25,7 +25,13 @@ else() set(RAM_SHARE_SECTION " MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED\n\ MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED\n\ -MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED\n\ +_siMB_MEM2 = LOADADDR(.MB_MEM2);\n\ +.MB_MEM2 :\n\ +{\n\ + _sMB_MEM2 = . ;\n\ + *(MB_MEM2) ;\n\ +_eMB_MEM2 = . ;\n\ +} >RAM_SHARED AT> FLASH\n\ ") endif() From ed42cb8dcda73794f8f2d54728baf215b072f87b Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Sun, 12 May 2024 14:21:06 +0200 Subject: [PATCH 108/119] Latest MP1 system.c needs clocks value that are defaulted by HAL --- tests/fetch/CMakeLists.txt | 5 +++++ tests/hal/CMakeLists.txt | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index 641e4776..2c2f1e64 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -33,4 +33,9 @@ foreach(FAMILY ${TEST_FAMILIES}) add_executable(fetch-test-${FAMILY} ${SOURCES}) target_link_libraries(fetch-test-${FAMILY} STM32::NoSys HAL::STM32::${FAMILY}${CORE}::CORTEX CMSIS::STM32::${DEVICE}${CORE}) + + if(${FAMILY} STREQUAL "MP1") + target_compile_definitions(fetch-test-${FAMILY} PRIVATE USE_HAL_DRIVER) + endif() + endforeach() diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index c1f5da7b..840de8cd 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -36,6 +36,10 @@ foreach(FAMILY ${TEST_FAMILIES}) add_executable(hal-test-${FAMILY} ${SOURCES}) target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_FULL_LL_DRIVER) + if(${FAMILY} STREQUAL "MP1") + target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_HAL_DRIVER) + endif() + foreach(DRIVER ${HAL_DRIVERS_${FAMILY}}) string(TOUPPER ${DRIVER} DRIVER) target_link_libraries(hal-test-${FAMILY} HAL::STM32::${FAMILY}${CORE}::${DRIVER}) From 8396cdabe2a570478e80eed6f688729eccd0050c Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Mon, 20 May 2024 22:13:36 +0200 Subject: [PATCH 109/119] Revert "Latest MP1 system.c needs clocks value that are defaulted by HAL" This reverts commit ed42cb8dcda73794f8f2d54728baf215b072f87b. --- tests/fetch/CMakeLists.txt | 5 ----- tests/hal/CMakeLists.txt | 4 ---- 2 files changed, 9 deletions(-) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index 2c2f1e64..641e4776 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -33,9 +33,4 @@ foreach(FAMILY ${TEST_FAMILIES}) add_executable(fetch-test-${FAMILY} ${SOURCES}) target_link_libraries(fetch-test-${FAMILY} STM32::NoSys HAL::STM32::${FAMILY}${CORE}::CORTEX CMSIS::STM32::${DEVICE}${CORE}) - - if(${FAMILY} STREQUAL "MP1") - target_compile_definitions(fetch-test-${FAMILY} PRIVATE USE_HAL_DRIVER) - endif() - endforeach() diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index 840de8cd..c1f5da7b 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -36,10 +36,6 @@ foreach(FAMILY ${TEST_FAMILIES}) add_executable(hal-test-${FAMILY} ${SOURCES}) target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_FULL_LL_DRIVER) - if(${FAMILY} STREQUAL "MP1") - target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_HAL_DRIVER) - endif() - foreach(DRIVER ${HAL_DRIVERS_${FAMILY}}) string(TOUPPER ${DRIVER} DRIVER) target_link_libraries(hal-test-${FAMILY} HAL::STM32::${FAMILY}${CORE}::${DRIVER}) From 86deaa191e0566edee8273dc51545d9ac474355e Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Mon, 20 May 2024 22:14:18 +0200 Subject: [PATCH 110/119] Revert "Create MB_MEM2 shared section for devices with shared RAM up to date startup initialize it" This reverts commit d92c104b80f4c9ae1e0c9337190fd9a7620a0a07. --- cmake/stm32/linker_ld.cmake | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cmake/stm32/linker_ld.cmake b/cmake/stm32/linker_ld.cmake index e67656fd..6b15cbb3 100644 --- a/cmake/stm32/linker_ld.cmake +++ b/cmake/stm32/linker_ld.cmake @@ -25,13 +25,7 @@ else() set(RAM_SHARE_SECTION " MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED\n\ MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED\n\ -_siMB_MEM2 = LOADADDR(.MB_MEM2);\n\ -.MB_MEM2 :\n\ -{\n\ - _sMB_MEM2 = . ;\n\ - *(MB_MEM2) ;\n\ -_eMB_MEM2 = . ;\n\ -} >RAM_SHARED AT> FLASH\n\ +MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED\n\ ") endif() From b208c2f06729a5b6f8653fe221fc21fc3994304e Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Mon, 20 May 2024 22:22:27 +0200 Subject: [PATCH 111/119] Revert to pre-split versions of CUBE HAL and CMSIS --- cmake/stm32/f0.cmake | 6 +++--- cmake/stm32/f1.cmake | 6 +++--- cmake/stm32/f2.cmake | 6 +++--- cmake/stm32/f3.cmake | 6 +++--- cmake/stm32/f7.cmake | 6 +++--- cmake/stm32/g0.cmake | 6 +++--- cmake/stm32/g4.cmake | 6 +++--- cmake/stm32/h5.cmake | 6 +++--- cmake/stm32/h7.cmake | 6 +++--- cmake/stm32/l0.cmake | 6 +++--- cmake/stm32/l1.cmake | 6 +++--- cmake/stm32/l4.cmake | 6 +++--- cmake/stm32/l5.cmake | 6 +++--- cmake/stm32/mp1.cmake | 2 +- cmake/stm32/u5.cmake | 6 +++--- cmake/stm32/wb.cmake | 6 +++--- cmake/stm32/wl.cmake | 6 +++--- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/cmake/stm32/f0.cmake b/cmake/stm32/f0.cmake index 48471149..e52846bd 100644 --- a/cmake/stm32/f0.cmake +++ b/cmake/stm32/f0.cmake @@ -106,6 +106,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES F0) -set(CUBE_F0_VERSION v1.11.5) -set(CMSIS_F0_VERSION v2.3.7) -set(HAL_F0_VERSION v1.7.8) +set(CUBE_F0_VERSION v1.11.2) +set(CMSIS_F0_VERSION v2.3.5) +set(HAL_F0_VERSION v1.7.5) diff --git a/cmake/stm32/f1.cmake b/cmake/stm32/f1.cmake index a32cb3d6..08d68892 100644 --- a/cmake/stm32/f1.cmake +++ b/cmake/stm32/f1.cmake @@ -181,6 +181,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES F1) -set(CUBE_F1_VERSION v1.8.5) -set(CMSIS_F1_VERSION v4.3.4) -set(HAL_F1_VERSION v1.1.9) +set(CUBE_F1_VERSION v1.8.4) +set(CMSIS_F1_VERSION v4.3.3) +set(HAL_F1_VERSION v1.1.8) diff --git a/cmake/stm32/f2.cmake b/cmake/stm32/f2.cmake index c59f4379..2f266c70 100644 --- a/cmake/stm32/f2.cmake +++ b/cmake/stm32/f2.cmake @@ -85,6 +85,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES F2) -set(CUBE_F2_VERSION v1.9.4) -set(CMSIS_F2_VERSION v2.2.6) -set(HAL_F2_VERSION v1.2.8) +set(CUBE_F2_VERSION v1.9.3) +set(CMSIS_F2_VERSION v2.2.5) +set(HAL_F2_VERSION v1.2.7) diff --git a/cmake/stm32/f3.cmake b/cmake/stm32/f3.cmake index 8d7003a7..49a2a551 100644 --- a/cmake/stm32/f3.cmake +++ b/cmake/stm32/f3.cmake @@ -136,6 +136,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES F3) -set(CUBE_F3_VERSION v1.11.5) -set(CMSIS_F3_VERSION v2.3.8) -set(HAL_F3_VERSION v1.5.8) +set(CUBE_F3_VERSION v1.11.2) +set(CMSIS_F3_VERSION v2.3.5) +set(HAL_F3_VERSION v1.5.5) diff --git a/cmake/stm32/f7.cmake b/cmake/stm32/f7.cmake index 32f5465d..68c5acef 100644 --- a/cmake/stm32/f7.cmake +++ b/cmake/stm32/f7.cmake @@ -118,6 +118,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES F7) -set(CUBE_F7_VERSION v1.17.1) -set(CMSIS_F7_VERSION v1.2.8) -set(HAL_F7_VERSION v1.3.0) +set(CUBE_F7_VERSION v1.16.1) +set(CMSIS_F7_VERSION v1.2.6) +set(HAL_F7_VERSION v1.2.9) diff --git a/cmake/stm32/g0.cmake b/cmake/stm32/g0.cmake index ad2155c6..f3c20a55 100644 --- a/cmake/stm32/g0.cmake +++ b/cmake/stm32/g0.cmake @@ -136,6 +136,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES G0) -set(CUBE_G0_VERSION v1.6.2) -set(CMSIS_G0_VERSION v1.4.4) -set(HAL_G0_VERSION v1.4.6) +set(CUBE_G0_VERSION v1.4.1) +set(CMSIS_G0_VERSION v1.4.0) +set(HAL_G0_VERSION v1.4.1) diff --git a/cmake/stm32/g4.cmake b/cmake/stm32/g4.cmake index dcfc3006..380f1a9b 100644 --- a/cmake/stm32/g4.cmake +++ b/cmake/stm32/g4.cmake @@ -127,6 +127,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES G4) -set(CUBE_G4_VERSION v1.5.2) -set(CMSIS_G4_VERSION v1.2.3) -set(HAL_G4_VERSION v1.2.3) +set(CUBE_G4_VERSION v1.4.0) +set(CMSIS_G4_VERSION v1.2.1) +set(HAL_G4_VERSION v1.2.1) diff --git a/cmake/stm32/h5.cmake b/cmake/stm32/h5.cmake index 76499c35..ec3e9003 100644 --- a/cmake/stm32/h5.cmake +++ b/cmake/stm32/h5.cmake @@ -62,6 +62,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES H5) -set(CUBE_H5_VERSION v1.2.0) -set(CMSIS_H5_VERSION v1.2.0) -set(HAL_H5_VERSION v1.2.0) +set(CUBE_H5_VERSION v1.1.0) +set(CMSIS_H5_VERSION v1.1.0) +set(HAL_H5_VERSION v1.1.0) diff --git a/cmake/stm32/h7.cmake b/cmake/stm32/h7.cmake index b355f174..ac5d5d76 100644 --- a/cmake/stm32/h7.cmake +++ b/cmake/stm32/h7.cmake @@ -209,6 +209,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES H7) -set(CUBE_H7_VERSION v1.11.2) -set(CMSIS_H7_VERSION v1.10.4) -set(HAL_H7_VERSION v1.11.3) +set(CUBE_H7_VERSION v1.9.0) +set(CMSIS_H7_VERSION v1.10.0) +set(HAL_H7_VERSION v1.10.0) diff --git a/cmake/stm32/l0.cmake b/cmake/stm32/l0.cmake index cb8a1c17..01d6053c 100644 --- a/cmake/stm32/l0.cmake +++ b/cmake/stm32/l0.cmake @@ -135,6 +135,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES L0) -set(CUBE_L0_VERSION v1.12.2) -set(CMSIS_L0_VERSION v1.9.3) -set(HAL_L0_VERSION v1.10.6) +set(CUBE_L0_VERSION v1.12.0) +set(CMSIS_L0_VERSION v1.9.1) +set(HAL_L0_VERSION v1.10.4) diff --git a/cmake/stm32/l1.cmake b/cmake/stm32/l1.cmake index 66dac794..3d5a6a90 100644 --- a/cmake/stm32/l1.cmake +++ b/cmake/stm32/l1.cmake @@ -140,6 +140,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES L1) -set(CUBE_L1_VERSION v1.10.4) -set(CMSIS_L1_VERSION v2.3.3) -set(HAL_L1_VERSION v1.4.5) +set(CUBE_L1_VERSION v1.10.3) +set(CMSIS_L1_VERSION v2.3.2) +set(HAL_L1_VERSION v1.4.4) diff --git a/cmake/stm32/l4.cmake b/cmake/stm32/l4.cmake index 7adc1b54..ecd5e030 100644 --- a/cmake/stm32/l4.cmake +++ b/cmake/stm32/l4.cmake @@ -186,6 +186,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES L4) -set(CUBE_L4_VERSION v1.18.0) -set(CMSIS_L4_VERSION v1.7.3) -set(HAL_L4_VERSION v1.13.4) +set(CUBE_L4_VERSION v1.17.0) +set(CMSIS_L4_VERSION v1.7.1) +set(HAL_L4_VERSION v1.13.0) diff --git a/cmake/stm32/l5.cmake b/cmake/stm32/l5.cmake index 4c23d6ac..d74025b0 100644 --- a/cmake/stm32/l5.cmake +++ b/cmake/stm32/l5.cmake @@ -47,6 +47,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES L5) -set(CUBE_L5_VERSION v1.5.1) -set(CMSIS_L5_VERSION v1.0.6) -set(HAL_L5_VERSION v1.0.6) +set(CUBE_L5_VERSION v1.4.0) +set(CMSIS_L5_VERSION v1.0.4) +set(HAL_L5_VERSION v1.0.4) diff --git a/cmake/stm32/mp1.cmake b/cmake/stm32/mp1.cmake index fb36f9bf..14a2f75e 100644 --- a/cmake/stm32/mp1.cmake +++ b/cmake/stm32/mp1.cmake @@ -51,6 +51,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES MP1) -set(CUBE_MP1_VERSION 1.6.0) +set(CUBE_MP1_VERSION 1.5.0) set(CMSIS_MP1_VERSION cube) set(HAL_MP1_VERSION cube) diff --git a/cmake/stm32/u5.cmake b/cmake/stm32/u5.cmake index 2fef30bb..7199aea0 100644 --- a/cmake/stm32/u5.cmake +++ b/cmake/stm32/u5.cmake @@ -48,6 +48,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES U5) -set(CUBE_U5_VERSION v1.5.0) -set(CMSIS_U5_VERSION v1.4.0) -set(HAL_U5_VERSION v1.5.0) +set(CUBE_U5_VERSION v1.4.0) +set(CMSIS_U5_VERSION v1.3.1) +set(HAL_U5_VERSION v1.4.0) diff --git a/cmake/stm32/wb.cmake b/cmake/stm32/wb.cmake index 4f455588..1e88432d 100644 --- a/cmake/stm32/wb.cmake +++ b/cmake/stm32/wb.cmake @@ -62,6 +62,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES WB) -set(CUBE_WB_VERSION v1.19.0) -set(CMSIS_WB_VERSION v1.12.1) -set(HAL_WB_VERSION v1.14.2) +set(CUBE_WB_VERSION v1.12.0) +set(CMSIS_WB_VERSION v1.9.0) +set(HAL_WB_VERSION v1.9.0) diff --git a/cmake/stm32/wl.cmake b/cmake/stm32/wl.cmake index 2dc7564f..9649a60a 100644 --- a/cmake/stm32/wl.cmake +++ b/cmake/stm32/wl.cmake @@ -100,6 +100,6 @@ list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME list(APPEND STM32_FETCH_FAMILIES WL) -set(CUBE_WL_VERSION v1.3.0) -set(CMSIS_WL_VERSION v1.2.0) -set(HAL_WL_VERSION v1.3.0) +set(CUBE_WL_VERSION v1.1.0) +set(CMSIS_WL_VERSION v1.1.0) +set(HAL_WL_VERSION v1.1.0) From 4876547c11761872726bc33287d6d393c73d3aa6 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Fri, 24 May 2024 22:19:04 +0200 Subject: [PATCH 112/119] Update deprecated checkout action to revision --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 00ff1e55..5a2a66e8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install ARM toolchain run: sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi From eb1e312b342aa3be383d6579f76a53ec23162259 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Fri, 24 May 2024 22:20:00 +0200 Subject: [PATCH 113/119] Dynamically create family matrix for CI jobs --- .github/workflows/cmake.yml | 7 +++++-- .github/workflows/create-matrix.yml | 30 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/create-matrix.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5a2a66e8..dabda153 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -7,11 +7,14 @@ env: BUILD_TYPE: Release jobs: + RetrieveTargetsMatrix: + uses: ./.github/workflows/create-matrix.yml + test-ubuntu: runs-on: ubuntu-20.04 + needs: RetrieveTargetsMatrix strategy: - matrix: - family: [C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U0, U5, WB, WL, MP1] + matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} fail-fast: false steps: diff --git a/.github/workflows/create-matrix.yml b/.github/workflows/create-matrix.yml new file mode 100644 index 00000000..41c66270 --- /dev/null +++ b/.github/workflows/create-matrix.yml @@ -0,0 +1,30 @@ +name: MatrixCreator + +run-name: "Creates supported family matrix for other jobs" + +on: + workflow_call: + outputs: + matrix: + description: "Supported family for job matrixing" + value: ${{ jobs.CreateMatrix.outputs.matrix }} + +jobs: + CreateMatrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.create-matrix.outputs.matrix }} + steps: + - name: Checkout repo + id: checkout + uses: actions/checkout@v4 + + - name: Create matrix + id: create-matrix + run: | + files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) + deletes="COMMON DEVICES LINKER_LD" + for del in $deletes; do + files=(${files[@]/$del}) + done + echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT From e067e06b7ecdd58da2c38c8c543ce694b0a645f1 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Wed, 5 Jun 2024 10:23:18 +0200 Subject: [PATCH 114/119] split matrix creation into steps --- .github/workflows/create-matrix.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-matrix.yml b/.github/workflows/create-matrix.yml index 41c66270..c2acbbed 100644 --- a/.github/workflows/create-matrix.yml +++ b/.github/workflows/create-matrix.yml @@ -19,12 +19,23 @@ jobs: id: checkout uses: actions/checkout@v4 - - name: Create matrix - id: create-matrix + - name: Get uppercase no-extension ordered file names + id: find-files + run: | + files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) + echo "files=\"${files[@]}\"" >> $GITHUB_OUTPUT + + - name: Filter out non family files + id: get-famillies run: | - files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) + files=${{ steps.find-files.outputs.files }} deletes="COMMON DEVICES LINKER_LD" for del in $deletes; do files=(${files[@]/$del}) done - echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT + echo "files=\"${files[@]\"" >> $GITHUB_OUTPUT + + - name: Create matrix + id: create-matrix + run: | + echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${{ steps.get-famillies.outputs.files }})}" >> $GITHUB_OUTPUT From ee94679eaffbe9bbe3cfccc6e2fb9d3bb366cd0b Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Wed, 5 Jun 2024 10:36:24 +0200 Subject: [PATCH 115/119] Revert "split matrix creation into steps" This reverts commit e067e06b7ecdd58da2c38c8c543ce694b0a645f1. --- .github/workflows/create-matrix.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/create-matrix.yml b/.github/workflows/create-matrix.yml index c2acbbed..41c66270 100644 --- a/.github/workflows/create-matrix.yml +++ b/.github/workflows/create-matrix.yml @@ -19,23 +19,12 @@ jobs: id: checkout uses: actions/checkout@v4 - - name: Get uppercase no-extension ordered file names - id: find-files - run: | - files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) - echo "files=\"${files[@]}\"" >> $GITHUB_OUTPUT - - - name: Filter out non family files - id: get-famillies + - name: Create matrix + id: create-matrix run: | - files=${{ steps.find-files.outputs.files }} + files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) deletes="COMMON DEVICES LINKER_LD" for del in $deletes; do files=(${files[@]/$del}) done - echo "files=\"${files[@]\"" >> $GITHUB_OUTPUT - - - name: Create matrix - id: create-matrix - run: | - echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${{ steps.get-famillies.outputs.files }})}" >> $GITHUB_OUTPUT + echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT From 2557bd6a2ee067d6dfa403b0fd5cd186d722f3a4 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Sat, 8 Jun 2024 15:50:37 +0200 Subject: [PATCH 116/119] find CMSIS only for family under test --- tests/cmsis/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index 4e4f94e3..f7fd9cd0 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -15,7 +15,8 @@ if(FETCH_ST_SOURCES) stm32_fetch_cmsis(${TEST_FAMILIES}) endif() -find_package(CMSIS REQUIRED) +list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) +find_package(CMSIS COMPONENTS "${TEST_FAMILIES_LONG_NAMES}" REQUIRED) set(SOURCES main.c) From aae801448d84cbf72ef29fc0be99e82de6191a32 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN - XANTHIO Date: Sat, 8 Jun 2024 15:51:49 +0200 Subject: [PATCH 117/119] Fix the typo that made the test not creating executable for second core --- tests/cmsis/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index f7fd9cd0..89e9b1da 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -35,7 +35,7 @@ foreach(FAMILY ${TEST_FAMILIES}) add_executable(cmsis-test-${DEVICE} ${SOURCES}) target_link_libraries(cmsis-test-${DEVICE} CMSIS::STM32::${DEVICE} STM32::NoSys) else() - stm32_get_cores(CORES FAMILY ${FAMILY} DEVICE ${DEVICE}) + stm32_get_cores(DEV_CORES FAMILY ${FAMILY} DEVICE ${DEVICE}) foreach(CORE ${DEV_CORES}) stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} FLASH SIZE FLASH_SIZE) stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM SIZE RAM_SIZE) From b1f62c97de13603ca4d793cdaff701814e970099 Mon Sep 17 00:00:00 2001 From: Ciu-Zhienki Date: Mon, 10 Jun 2024 16:18:16 +0800 Subject: [PATCH 118/119] Fix RAM size output of stm32_get_memory_info --- cmake/stm32/common.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 391c34ab..d5b60146 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -266,21 +266,21 @@ function(stm32_get_memory_info) set(RAM_SHARE_ORIGIN 0x20030000) unset(TWO_FLASH_BANKS) - if(FAMILY STREQUAL "F1") + if(INFO_FAMILY STREQUAL "F1") stm32f1_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH RAM) - elseif(FAMILY STREQUAL "L1") + elseif(INFO_FAMILY STREQUAL "L1") stm32l1_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH RAM) - elseif(FAMILY STREQUAL "F2") + elseif(INFO_FAMILY STREQUAL "F2") stm32f2_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH RAM) - elseif(FAMILY STREQUAL "F3") + elseif(INFO_FAMILY STREQUAL "F3") stm32f3_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH RAM) - elseif(FAMILY STREQUAL "H7") + elseif(INFO_FAMILY STREQUAL "H7") stm32h7_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} "${INFO_CORE}" RAM FLASH_ORIGIN RAM_ORIGIN TWO_FLASH_BANKS) - elseif(FAMILY STREQUAL "WL") + elseif(INFO_FAMILY STREQUAL "WL") stm32wl_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} "${INFO_CORE}" RAM FLASH_ORIGIN RAM_ORIGIN TWO_FLASH_BANKS) - elseif(FAMILY STREQUAL "WB") + elseif(INFO_FAMILY STREQUAL "WB") stm32wb_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} "${INFO_CORE}" RAM RAM_ORIGIN TWO_FLASH_BANKS) - elseif(FAMILY STREQUAL "MP1") + elseif(INFO_FAMILY STREQUAL "MP1") stm32mp1_get_memory_info(${INFO_DEVICE} ${INFO_TYPE} FLASH) endif() # when a device is dual core, each core uses half of total flash From 73dba75c000dfb3c60ddbad6ab69d1a75251ac05 Mon Sep 17 00:00:00 2001 From: Konstantin Oblaukhov Date: Mon, 4 Aug 2025 19:11:50 +0700 Subject: [PATCH 119/119] Fix CI. More info: https://github.com/actions/runner-images/issues/11101 --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index dabda153..0d29e8fc 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/create-matrix.yml test-ubuntu: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: RetrieveTargetsMatrix strategy: matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }}