├── .gitmodules ├── .gitignore ├── tests ├── bsp │ ├── main.c │ ├── stm32g4xx_nucleo_conf.h │ ├── b_g474e_dpow1_conf.h │ ├── CMakeLists.txt │ ├── stm32g474e_eval_conf.h │ ├── stm32c0xx_hal_conf.h │ └── stm32l1xx_hal_conf.h ├── hal │ ├── main.c │ ├── CMakeLists.txt │ ├── stm32c0xx_hal_conf.h │ └── stm32l1xx_hal_conf.h ├── cmsis │ ├── main.c │ └── CMakeLists.txt └── fetch │ ├── main.c │ ├── CMakeLists.txt │ ├── stm32c0xx_hal_conf.h │ └── stm32l1xx_hal_conf.h ├── examples ├── fetch-cube │ ├── main.c │ └── CMakeLists.txt ├── multi-core │ ├── main.c │ └── CMakeLists.txt ├── template │ ├── main.c │ └── CMakeLists.txt ├── fetch-cmsis-hal │ ├── main.c │ └── CMakeLists.txt ├── custom-linker-script │ ├── main.c │ ├── CMakeLists.txt │ └── F407VG.ld ├── freertos │ ├── main.h │ ├── main.cpp │ ├── FreeRTOSConfig.h │ └── CMakeLists.txt ├── blinky-ll │ ├── CMakeLists.txt │ └── blinky.c └── blinky │ ├── blinky.c │ ├── blinky.cpp │ └── CMakeLists.txt ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug-report.md └── workflows │ ├── create-matrix.yml │ └── cmake.yml ├── cmake ├── stm32 │ ├── c0.cmake │ ├── l5.cmake │ ├── u5.cmake │ ├── u0.cmake │ ├── h5.cmake │ ├── mp1.cmake │ ├── wb.cmake │ ├── f2.cmake │ ├── f0.cmake │ ├── f7.cmake │ ├── g4.cmake │ ├── g0.cmake │ ├── l0.cmake │ ├── wl.cmake │ ├── f3.cmake │ ├── l1.cmake │ ├── f4.cmake │ ├── l4.cmake │ ├── linker_ld.cmake │ ├── f1.cmake │ ├── h7.cmake │ └── devices.cmake ├── stm32_gcc.cmake └── FindFreeRTOS.cmake ├── LICENSE ├── docs └── MAINTAIN.md └── CHANGELOG.md /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /tests/bsp/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/hal/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/cmsis/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fetch/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/fetch-cube/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/multi-core/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/template/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/fetch-cmsis-hal/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/custom-linker-script/main.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | for (;;); 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /examples/freertos/main.h: -------------------------------------------------------------------------------- 1 | #ifndef STM32_CMAKE_EXAMPLES_FREERTOS_MAIN_H_ 2 | #define STM32_CMAKE_EXAMPLES_FREERTOS_MAIN_H_ 3 | 4 | namespace blinky { 5 | 6 | void init(); 7 | static void blinkTask(void* args); 8 | 9 | } 10 | 11 | #endif /* STM32_CMAKE_EXAMPLES_FREERTOS_MAIN_H_ */ 12 | -------------------------------------------------------------------------------- /examples/custom-linker-script/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-custom-linker-script C ASM) 5 | 6 | find_package(CMSIS COMPONENTS STM32F407VG REQUIRED) 7 | 8 | set(PROJECT_SOURCES 9 | main.c 10 | ) 11 | 12 | add_executable(stm32-custom-linker-script ${PROJECT_SOURCES}) 13 | target_link_libraries(stm32-custom-linker-script CMSIS::STM32::F407xx STM32::NoSys) 14 | stm32_add_linker_script(stm32-custom-linker-script PRIVATE F407VG.ld) 15 | stm32_print_size_of_target(stm32-custom-linker-script) 16 | -------------------------------------------------------------------------------- /examples/template/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-template C ASM) 5 | 6 | find_package(CMSIS COMPONENTS STM32F407VG REQUIRED) 7 | # Find CMSIS for all F4 devices: 8 | #find_package(CMSIS COMPONENTS STM32F4 REQUIRED) 9 | # Find CMSIS for all devices: 10 | #find_package(CMSIS REQUIRED) 11 | 12 | set(PROJECT_SOURCES 13 | main.c 14 | ) 15 | 16 | add_executable(stm32-template ${PROJECT_SOURCES}) 17 | target_link_libraries(stm32-template CMSIS::STM32::F407VG STM32::NoSys) 18 | stm32_print_size_of_target(stm32-template) 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /examples/fetch-cube/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-fetch-cube C ASM) 5 | 6 | stm32_fetch_cube(F4 L0) 7 | 8 | find_package(CMSIS COMPONENTS STM32F407VG STM32L053C8 REQUIRED) 9 | 10 | set(PROJECT_SOURCES 11 | main.c 12 | ) 13 | 14 | add_executable(stm32-fetch-f4 ${PROJECT_SOURCES}) 15 | target_link_libraries(stm32-fetch-f4 CMSIS::STM32::F407VG STM32::NoSys) 16 | stm32_print_size_of_target(stm32-fetch-f4) 17 | 18 | add_executable(stm32-fetch-l0 ${PROJECT_SOURCES}) 19 | target_link_libraries(stm32-fetch-l0 CMSIS::STM32::L053C8 STM32::NoSys) 20 | stm32_print_size_of_target(stm32-fetch-l0) 21 | -------------------------------------------------------------------------------- /examples/fetch-cmsis-hal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-fetch-cmsis-hal C ASM) 5 | 6 | stm32_fetch_cmsis(F4 L0) 7 | stm32_fetch_hal(F4 L0) 8 | 9 | find_package(CMSIS COMPONENTS STM32F407VG STM32L053C8 REQUIRED) 10 | find_package(HAL COMPONENTS STM32F4 STM32L0 REQUIRED) 11 | 12 | set(PROJECT_SOURCES 13 | main.c 14 | ) 15 | 16 | add_executable(stm32-fetch-f4 ${PROJECT_SOURCES}) 17 | target_link_libraries(stm32-fetch-f4 CMSIS::STM32::F407VG STM32::NoSys) 18 | stm32_print_size_of_target(stm32-fetch-f4) 19 | 20 | add_executable(stm32-fetch-l0 ${PROJECT_SOURCES}) 21 | target_link_libraries(stm32-fetch-l0 CMSIS::STM32::L053C8 STM32::NoSys) 22 | stm32_print_size_of_target(stm32-fetch-l0) 23 | -------------------------------------------------------------------------------- /cmake/stm32/c0.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_C0_TYPES 2 | C011xx 3 | C031xx 4 | ) 5 | set(STM32_C0_TYPE_MATCH 6 | "C011.[46]" 7 | "C031.[46]" 8 | ) 9 | set(STM32_C0_RAM_SIZES 10 | 6K 11 | 12K 12 | ) 13 | set(STM32_C0_CCRAM_SIZES 14 | 0K 15 | 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(C0) 19 | 20 | target_compile_options(STM32::C0 INTERFACE 21 | -mcpu=cortex-m0plus 22 | ) 23 | target_link_options(STM32::C0 INTERFACE 24 | -mcpu=cortex-m0plus 25 | ) 26 | 27 | list(APPEND STM32_ALL_DEVICES 28 | C011D6 29 | C011F4 30 | C011F6 31 | C011J4 32 | C011J6 33 | C031C4 34 | C031C6 35 | C031F4 36 | C031F6 37 | C031G4 38 | C031G6 39 | C031K4 40 | C031K6 41 | ) 42 | 43 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 44 | STM32C0 45 | ) 46 | 47 | list(APPEND STM32_FETCH_FAMILIES C0) 48 | 49 | set(CUBE_C0_VERSION v1.1.0) 50 | set(CMSIS_C0_VERSION v1.1.0) 51 | set(HAL_C0_VERSION v1.1.0) 52 | -------------------------------------------------------------------------------- /cmake/stm32_gcc.cmake: -------------------------------------------------------------------------------- 1 | if(${CMAKE_VERSION} VERSION_LESS "3.16.0") 2 | message(WARNING "Current CMake version is ${CMAKE_VERSION}. stm32-cmake requires CMake 3.16 or greater") 3 | 4 | endif() 5 | 6 | get_filename_component(STM32_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) 7 | list(APPEND CMAKE_MODULE_PATH ${STM32_CMAKE_DIR}) 8 | 9 | include(stm32/common) 10 | include(stm32/devices) 11 | 12 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 13 | 14 | find_program(CMAKE_C_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc HINTS ${TOOLCHAIN_BIN_PATH}) 15 | find_program(CMAKE_CXX_COMPILER NAMES ${STM32_TARGET_TRIPLET}-g++ HINTS ${TOOLCHAIN_BIN_PATH}) 16 | find_program(CMAKE_ASM_COMPILER NAMES ${STM32_TARGET_TRIPLET}-gcc HINTS ${TOOLCHAIN_BIN_PATH}) 17 | 18 | set(CMAKE_EXECUTABLE_SUFFIX_C .elf) 19 | set(CMAKE_EXECUTABLE_SUFFIX_CXX .elf) 20 | set(CMAKE_EXECUTABLE_SUFFIX_ASM .elf) 21 | 22 | # This should be safe to set for a bare-metal cross-compiler 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | -------------------------------------------------------------------------------- /cmake/stm32/l5.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_L5_TYPES 2 | L552xx L562xx 3 | ) 4 | set(STM32_L5_TYPE_MATCH 5 | "L552.." "L562.." 6 | ) 7 | 8 | set(STM32_L5_RAM_SIZES 9 | 256K 256K 10 | ) 11 | set(STM32_L5_CCRAM_SIZES 12 | 0K 0K 13 | ) 14 | 15 | stm32_util_create_family_targets(L5) 16 | 17 | target_compile_options(STM32::L5 INTERFACE 18 | -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 19 | ) 20 | target_link_options(STM32::L5 INTERFACE 21 | -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 22 | ) 23 | 24 | list(APPEND STM32_ALL_DEVICES 25 | L552CC 26 | L552CE 27 | L552ME 28 | L552QC 29 | L552QE 30 | L552RC 31 | L552RE 32 | L552VC 33 | L552VE 34 | L552ZC 35 | L552ZE 36 | L562CE 37 | L562ME 38 | L562QE 39 | L562RE 40 | L562VE 41 | L562ZE 42 | ) 43 | 44 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 45 | STM32L5 46 | ) 47 | 48 | list(APPEND STM32_FETCH_FAMILIES L5) 49 | 50 | set(CUBE_L5_VERSION v1.4.0) 51 | set(CMSIS_L5_VERSION v1.0.4) 52 | set(HAL_L5_VERSION v1.0.4) 53 | -------------------------------------------------------------------------------- /cmake/stm32/u5.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_U5_TYPES 2 | U575xx U585xx 3 | ) 4 | set(STM32_U5_TYPE_MATCH 5 | "U575.." "U585.." 6 | ) 7 | 8 | set(STM32_U5_RAM_SIZES 9 | 768K 768K 10 | ) 11 | 12 | stm32_util_create_family_targets(U5) 13 | 14 | target_compile_options(STM32::U5 INTERFACE 15 | -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 16 | ) 17 | target_link_options(STM32::U5 INTERFACE 18 | -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 19 | ) 20 | 21 | list(APPEND STM32_ALL_DEVICES 22 | U575CG 23 | U575CI 24 | U585CI 25 | U575RG 26 | U575RI 27 | U585RI 28 | U5750G 29 | U5750I 30 | U5850I 31 | U575VG 32 | U575VI 33 | U585VI 34 | U575QG 35 | U575QI 36 | U585QI 37 | U575ZG 38 | U575ZI 39 | U585ZI 40 | U575AG 41 | U575AI 42 | U585AI 43 | ) 44 | 45 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 46 | STM32U5 47 | ) 48 | 49 | list(APPEND STM32_FETCH_FAMILIES U5) 50 | 51 | set(CUBE_U5_VERSION v1.4.0) 52 | set(CMSIS_U5_VERSION v1.3.1) 53 | set(HAL_U5_VERSION v1.4.0) 54 | -------------------------------------------------------------------------------- /.github/workflows/create-matrix.yml: -------------------------------------------------------------------------------- 1 | name: MatrixCreator 2 | 3 | run-name: "Creates supported family matrix for other jobs" 4 | 5 | on: 6 | workflow_call: 7 | outputs: 8 | matrix: 9 | description: "Supported family for job matrixing" 10 | value: ${{ jobs.CreateMatrix.outputs.matrix }} 11 | 12 | jobs: 13 | CreateMatrix: 14 | runs-on: ubuntu-latest 15 | outputs: 16 | matrix: ${{ steps.create-matrix.outputs.matrix }} 17 | steps: 18 | - name: Checkout repo 19 | id: checkout 20 | uses: actions/checkout@v4 21 | 22 | - name: Create matrix 23 | id: create-matrix 24 | run: | 25 | files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) 26 | deletes="COMMON DEVICES LINKER_LD" 27 | for del in $deletes; do 28 | files=(${files[@]/$del}) 29 | done 30 | echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT 31 | -------------------------------------------------------------------------------- /examples/multi-core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-template C ASM) 5 | 6 | #Find CMSIS for both cores 7 | find_package(CMSIS COMPONENTS STM32H757VG_M4 STM32H757VG_M7 REQUIRED) 8 | find_package(HAL COMPONENTS STM32H757VG_M4 STM32H757VG_M7 REQUIRED) 9 | 10 | #Creating both binaries 11 | add_executable(m7core main.c) 12 | add_executable(m4core main.c) 13 | 14 | target_include_directories(m7core PRIVATE Inc) 15 | target_include_directories(m4core PRIVATE Inc) 16 | 17 | target_link_libraries(m7core PRIVATE 18 | HAL::STM32::H7::M7::RCC 19 | HAL::STM32::H7::M7::GPIO 20 | HAL::STM32::H7::M7::CORTEX 21 | CMSIS::STM32::H757VG::M7 22 | STM32::NoSys 23 | ) 24 | stm32_print_size_of_target(m7core) 25 | 26 | target_link_libraries(m4core PRIVATE 27 | HAL::STM32::H7::M4::RCC 28 | HAL::STM32::H7::M4::GPIO 29 | HAL::STM32::H7::M4::CORTEX 30 | CMSIS::STM32::H757VG::M4 31 | STM32::NoSys 32 | ) 33 | stm32_print_size_of_target(m4core) 34 | -------------------------------------------------------------------------------- /cmake/stm32/u0.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_U0_TYPES 2 | U031xx 3 | U073xx 4 | U083xx 5 | ) 6 | set(STM32_U0_TYPE_MATCH 7 | "U031.[468]" 8 | "U073.C" 9 | "U083.C" 10 | ) 11 | set(STM32_U0_RAM_SIZES 12 | 12K 13 | 40K 14 | 40K 15 | ) 16 | set(STM32_U0_CCRAM_SIZES 17 | 0K 18 | 0K 19 | 0K 20 | ) 21 | 22 | stm32_util_create_family_targets(U0) 23 | 24 | target_compile_options(STM32::U0 INTERFACE 25 | -mcpu=cortex-m0plus 26 | ) 27 | target_link_options(STM32::U0 INTERFACE 28 | -mcpu=cortex-m0plus 29 | ) 30 | 31 | list(APPEND STM32_ALL_DEVICES 32 | U031C6 33 | U031C8 34 | U031F4 35 | U031F6 36 | U031F8 37 | U031G6 38 | U031G8 39 | U031K4 40 | U031K8 41 | U031R6 42 | U031R8 43 | U073CC 44 | U073HC 45 | U073KC 46 | U073MC 47 | U073RC 48 | U083CC 49 | U083HC 50 | U083KC 51 | U083MC 52 | U083RC 53 | ) 54 | 55 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 56 | STM32U0 57 | ) 58 | 59 | list(APPEND STM32_FETCH_FAMILIES U0) 60 | 61 | set(CUBE_U0_VERSION v1.0.0) 62 | set(CMSIS_U0_VERSION v1.0.0) 63 | set(HAL_U0_VERSION v1.0.0) 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2017 Konstantin Oblaukhov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Sources to reproduce** 14 | Please provide link to repository showing the problem. 15 | - Fork this repository 16 | - Modify an existing example to show the abnormal behavior 17 | - Share the link to the commit in your fork showing the problem 18 | 19 | **Steps to reproduce** 20 | 1. Go to '...' 21 | 2. Click on '....' 22 | 3. Scroll down to '....' 23 | 4. See error 24 | 25 | **Expected behavior** 26 | A clear and concise description of what you expected to happen. 27 | 28 | **Screenshots** 29 | If applicable, add screenshots to help explain your problem. 30 | 31 | **Environment (please complete the following information):** 32 | - OS: [e.g. iOS] 33 | - Compiler: [e.g. arm-none-eabi-gcc +version] 34 | - stm32-cmake: [v2.0 or 86d1dd2 or ...] 35 | - cmake: [e.g 3.21.0] 36 | - HAL/cube/CMSIS: [stm32cubeL4 v1.2.3] 37 | 38 | **Additional context** 39 | Add any other context about the problem here. 40 | -------------------------------------------------------------------------------- /docs/MAINTAIN.md: -------------------------------------------------------------------------------- 1 | # Supporting new families 2 | 3 | ## Write device file 4 | 5 | a file .cmake must be added to the folder cmake/stm32 6 | This file containes the differents devices and the regex used to parse them. 7 | It also give information on the RAM and CCRAM available 8 | 9 | ## Add family to list of know families 10 | 11 | Update the list `STM32_SUPPORTED_FAMILIES_LONG_NAME` located in the cmake/stm32/common.cmake file 12 | 13 | ## Add devices to list of devices in devices.cmake 14 | 15 | Add all known devices to the list of all devices 16 | 17 | ## Update cube, cmsis and hal version in utilities.cmake 18 | 19 | The versions to use can be found as follow: 20 | - Cube version : a valid tag from the repo https://github.com/STMicroelectronics/STM32Cube${FAMILY} 21 | - Cmsis version : a valid tag from the repo https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L} 22 | - Hal version : a valid tag from the repo https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver 23 | 24 | ## Add family to CI 25 | 26 | 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) 27 | Update the cmake.yml workflow file to include the new family 28 | -------------------------------------------------------------------------------- /examples/blinky-ll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | project(stm32-blinky-ll C ASM) 5 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 6 | 7 | find_package(CMSIS COMPONENTS STM32L0 STM32F1 STM32F4 REQUIRED) 8 | find_package(HAL COMPONENTS STM32L0 STM32F1 STM32F4 LL_RCC LL_GPIO REQUIRED) 9 | 10 | # STM32F4-Discovery 11 | add_executable(stm32-blinky-f4 blinky.c) 12 | target_link_libraries(stm32-blinky-f4 13 | HAL::STM32::F4::LL_RCC 14 | HAL::STM32::F4::LL_GPIO 15 | CMSIS::STM32::F407VG 16 | STM32::NoSys 17 | ) 18 | stm32_print_size_of_target(stm32-blinky-f4) 19 | 20 | # STM32VL-Discovery 21 | add_executable(stm32-blinky-f1 blinky.c) 22 | target_link_libraries(stm32-blinky-f1 23 | HAL::STM32::F1::LL_RCC 24 | HAL::STM32::F1::LL_GPIO 25 | CMSIS::STM32::F100RB 26 | STM32::NoSys 27 | ) 28 | stm32_print_size_of_target(stm32-blinky-f1) 29 | 30 | # STM32L0538-Discovery 31 | add_executable(stm32-blinky-l0 blinky.c) 32 | target_link_libraries(stm32-blinky-l0 33 | HAL::STM32::L0::LL_RCC 34 | HAL::STM32::L0::LL_GPIO 35 | CMSIS::STM32::L053C8 36 | STM32::NoSys 37 | ) 38 | stm32_print_size_of_target(stm32-blinky-l0) 39 | -------------------------------------------------------------------------------- /cmake/stm32/h5.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_H5_TYPES 2 | H503xx H562xx H563xx H573xx 3 | ) 4 | 5 | set(STM32_H5_TYPE_MATCH 6 | "H503.." "H562.." "H563.." "H573.." 7 | ) 8 | set(STM32_H5_RAM_SIZES 9 | 32K 640K 640K 640K 10 | ) 11 | set(STM32_H5_CCRAM_SIZES 12 | 0K 0K 0K 0K 13 | ) 14 | 15 | stm32_util_create_family_targets(H5) 16 | 17 | target_compile_options(STM32::H5 INTERFACE 18 | -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb 19 | ) 20 | 21 | target_link_options(STM32::H5 INTERFACE 22 | -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb 23 | ) 24 | 25 | list(APPEND STM32_ALL_DEVICES 26 | H503CB 27 | H503EB 28 | H503KB 29 | H503RB 30 | H562AG 31 | H562AI 32 | H562IG 33 | H562II 34 | H562RG 35 | H562RI 36 | H562VG 37 | H562VI 38 | H562ZG 39 | H562ZI 40 | H563AG 41 | H563AI 42 | H563IG 43 | H563II 44 | H563MI 45 | H563RG 46 | H563RI 47 | H563VG 48 | H563VI 49 | H563ZG 50 | H563ZI 51 | H573AI 52 | H573II 53 | H573MI 54 | H573RI 55 | H573VI 56 | H573ZI 57 | ) 58 | 59 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 60 | STM32H5 61 | ) 62 | 63 | list(APPEND STM32_FETCH_FAMILIES H5) 64 | 65 | set(CUBE_H5_VERSION v1.1.0) 66 | set(CMSIS_H5_VERSION v1.1.0) 67 | set(HAL_H5_VERSION v1.1.0) 68 | -------------------------------------------------------------------------------- /tests/fetch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | if(NOT TEST_FAMILIES) 5 | set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) 6 | endif() 7 | 8 | # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES 9 | list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) 10 | 11 | project(fetch-test C ASM) 12 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 13 | 14 | stm32_fetch_cmsis(${TEST_FAMILIES}) 15 | stm32_fetch_hal(${TEST_FAMILIES}) 16 | 17 | find_package(CMSIS REQUIRED ${TEST_FAMILIES_LONG_NAMES}) 18 | find_package(HAL REQUIRED ${TEST_FAMILIES_LONG_NAMES}) 19 | 20 | set(SOURCES main.c) 21 | 22 | foreach(FAMILY ${TEST_FAMILIES}) 23 | stm32_get_devices_by_family(STM_DEVICES FAMILY ${FAMILY}) 24 | list(GET STM_DEVICES 0 DEVICE) 25 | stm32_get_cores(CORES FAMILY ${FAMILY} DEVICE ${DEVICE}) 26 | 27 | if(CORES) 28 | list(GET CORES 0 CORE) 29 | set(CORE "::${CORE}") 30 | else() 31 | unset(CORE) 32 | endif() 33 | 34 | add_executable(fetch-test-${FAMILY} ${SOURCES}) 35 | target_link_libraries(fetch-test-${FAMILY} STM32::NoSys HAL::STM32::${FAMILY}${CORE}::CORTEX CMSIS::STM32::${DEVICE}${CORE}) 36 | endforeach() 37 | -------------------------------------------------------------------------------- /cmake/stm32/mp1.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_MP1_TYPES 2 | MP151Axx MP151Cxx 3 | MP153Axx MP153Cxx 4 | MP157Axx MP157Cxx) 5 | 6 | set(STM32_MP1_TYPE_MATCH 7 | "MP151[AD](A.?)?" "MP151[CF](A.?)?" 8 | "MP153[AD](A.?)?" "MP153[CF](A.?)?" 9 | "MP157[AD](A.?)?" "MP157[CF](A.?)?") 10 | 11 | set(STM32_MP1_RAM_SIZES 12 | 384K 384K 13 | 384K 384K 14 | 384K 384K) 15 | 16 | set(STM32_MP1_CCRAM_SIZES 17 | 0K 0K 18 | 0K 0K 19 | 0K 0K) 20 | 21 | stm32_util_create_family_targets(MP1 M4) 22 | 23 | target_compile_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) 24 | target_link_options(STM32::MP1::M4 INTERFACE -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard) 25 | target_compile_definitions(STM32::MP1::M4 INTERFACE CORE_CM4) 26 | 27 | function(stm32mp1_get_memory_info DEVICE TYPE FLASH_SIZE) 28 | if(FLASH_SIZE) 29 | set(${FLASH_SIZE} "0KB" PARENT_SCOPE) 30 | endif() 31 | endfunction() 32 | 33 | list(APPEND STM32_ALL_DEVICES 34 | MP151A 35 | MP151C 36 | MP151D 37 | MP151F 38 | MP153A 39 | MP153C 40 | MP153D 41 | MP153F 42 | MP157A 43 | MP157C 44 | MP157D 45 | MP157F 46 | ) 47 | 48 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 49 | STM32MP1_M4 50 | ) 51 | 52 | list(APPEND STM32_FETCH_FAMILIES MP1) 53 | 54 | set(CUBE_MP1_VERSION 1.5.0) 55 | set(CMSIS_MP1_VERSION cube) 56 | set(HAL_MP1_VERSION cube) 57 | -------------------------------------------------------------------------------- /examples/blinky/blinky.c: -------------------------------------------------------------------------------- 1 | #if defined STM32L0 2 | #include 3 | 4 | // STM32L0538-Discovery green led - PB4 5 | #define LED_PORT GPIOB 6 | #define LED_PIN GPIO_PIN_4 7 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE 8 | #elif defined STM32F1 9 | #include 10 | 11 | // STM32VL-Discovery green led - PC9 12 | #define LED_PORT GPIOC 13 | #define LED_PIN GPIO_PIN_9 14 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE 15 | #elif defined STM32F4 16 | #include 17 | 18 | // STM32F4-Discovery green led - PD12 19 | #define LED_PORT GPIOD 20 | #define LED_PIN GPIO_PIN_12 21 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE 22 | #endif 23 | 24 | void SysTick_Handler(void) 25 | { 26 | HAL_IncTick(); 27 | 28 | // 1 Hz blinking 29 | if ((HAL_GetTick() % 500) == 0) 30 | { 31 | HAL_GPIO_TogglePin(LED_PORT, LED_PIN); 32 | } 33 | } 34 | 35 | void initGPIO() 36 | { 37 | GPIO_InitTypeDef GPIO_Config; 38 | 39 | GPIO_Config.Mode = GPIO_MODE_OUTPUT_PP; 40 | GPIO_Config.Pull = GPIO_NOPULL; 41 | GPIO_Config.Speed = GPIO_SPEED_FREQ_HIGH; 42 | 43 | GPIO_Config.Pin = LED_PIN; 44 | 45 | LED_PORT_CLK_ENABLE(); 46 | HAL_GPIO_Init(LED_PORT, &GPIO_Config); 47 | } 48 | 49 | int main(void) 50 | { 51 | HAL_Init(); 52 | initGPIO(); 53 | // 1kHz ticks 54 | HAL_SYSTICK_Config(SystemCoreClock / 1000); 55 | 56 | while(1); 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /examples/blinky/blinky.cpp: -------------------------------------------------------------------------------- 1 | #if defined STM32L0 2 | #include 3 | 4 | // STM32L0538-Discovery green led - PB4 5 | #define LED_PORT GPIOB 6 | #define LED_PIN GPIO_PIN_4 7 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE 8 | #elif defined STM32F1 9 | #include 10 | 11 | // STM32VL-Discovery green led - PC9 12 | #define LED_PORT GPIOC 13 | #define LED_PIN GPIO_PIN_9 14 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE 15 | #elif defined STM32F4 16 | #include 17 | 18 | // STM32F4-Discovery green led - PD12 19 | #define LED_PORT GPIOD 20 | #define LED_PIN GPIO_PIN_12 21 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE 22 | #endif 23 | 24 | //This prevent name mangling for functions used in C/assembly files. 25 | extern "C" 26 | { 27 | void SysTick_Handler(void) 28 | { 29 | HAL_IncTick(); 30 | 31 | // 1 Hz blinking 32 | if ((HAL_GetTick() % 500) == 0) 33 | { 34 | HAL_GPIO_TogglePin(LED_PORT, LED_PIN); 35 | } 36 | } 37 | } 38 | 39 | void initGPIO() 40 | { 41 | GPIO_InitTypeDef GPIO_Config; 42 | 43 | GPIO_Config.Mode = GPIO_MODE_OUTPUT_PP; 44 | GPIO_Config.Pull = GPIO_NOPULL; 45 | GPIO_Config.Speed = GPIO_SPEED_FREQ_HIGH; 46 | 47 | GPIO_Config.Pin = LED_PIN; 48 | 49 | LED_PORT_CLK_ENABLE(); 50 | HAL_GPIO_Init(LED_PORT, &GPIO_Config); 51 | } 52 | 53 | int main(void) 54 | { 55 | HAL_Init(); 56 | initGPIO(); 57 | // 1kHz ticks 58 | HAL_SYSTICK_Config(SystemCoreClock / 1000); 59 | 60 | while(1); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /examples/blinky-ll/blinky.c: -------------------------------------------------------------------------------- 1 | #if defined STM32L0 2 | #include 3 | #include 4 | #include 5 | 6 | // STM32L0538-Discovery green led - PB4 7 | #define LED_PORT GPIOB 8 | #define LED_PIN LL_GPIO_PIN_4 9 | #define LED_PORT_CLK_ENABLE() { RCC->IOPENR |= RCC_IOPENR_GPIOBEN; } 10 | #elif defined STM32F1 11 | #include 12 | #include 13 | #include 14 | 15 | // STM32VL-Discovery green led - PC9 16 | #define LED_PORT GPIOC 17 | #define LED_PIN LL_GPIO_PIN_9 18 | #define LED_PORT_CLK_ENABLE() { RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; } 19 | #elif defined STM32F4 20 | #include 21 | #include 22 | #include 23 | 24 | // STM32F4-Discovery green led - PD12 25 | #define LED_PORT GPIOD 26 | #define LED_PIN LL_GPIO_PIN_12 27 | #define LED_PORT_CLK_ENABLE() { RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; } 28 | #endif 29 | 30 | void SysTick_Handler(void) 31 | { 32 | static int counter = 0; 33 | counter++; 34 | 35 | // 1 Hz blinking 36 | if ((counter % 500) == 0) 37 | LL_GPIO_TogglePin(LED_PORT, LED_PIN); 38 | } 39 | 40 | void initGPIO() 41 | { 42 | LED_PORT_CLK_ENABLE(); 43 | 44 | LL_GPIO_SetPinMode(LED_PORT, LED_PIN, LL_GPIO_MODE_OUTPUT); 45 | LL_GPIO_SetPinOutputType(LED_PORT, LED_PIN, LL_GPIO_OUTPUT_PUSHPULL); 46 | } 47 | 48 | int main(void) 49 | { 50 | initGPIO(); 51 | 52 | // 1kHz ticks 53 | SystemCoreClockUpdate(); 54 | SysTick_Config(SystemCoreClock / 1000); 55 | 56 | while(1); 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /cmake/stm32/wb.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_WB_TYPES 2 | WB55xx WB55xx WB35xx WB15xx WB50xx WB30xx WB10xx WB5Mxx 3 | ) 4 | set(STM32_WB_TYPE_MATCH 5 | "WB55.C" "WB55.[EGY]" "WB35.." "WB15.." "WB50.." "WB30.." "WB10.." "WB5M.." 6 | ) 7 | 8 | # this is not full RAM of the chip but only the part allocated to M4 core (SRAM1 in datasheet) 9 | set(STM32_WB_RAM_SIZES 10 | 64K 192K 32K 12K 64K 32K 12K 192K 11 | ) 12 | 13 | # WB series need special area for SRAM2 shared with core M0PLUS 14 | set(STM32_WB_RAM_SHARE_SIZES 15 | 10K 10K 10K 10K 10K 10K 10K 10K 16 | ) 17 | 18 | set(STM32_WB_CCRAM_SIZES 19 | 0K 0K 0K 0K 0K 0K 0K 0K 20 | ) 21 | 22 | stm32_util_create_family_targets(WB M4) 23 | 24 | target_compile_options(STM32::WB::M4 INTERFACE 25 | -mcpu=cortex-m4 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 26 | ) 27 | target_link_options(STM32::WB::M4 INTERFACE 28 | -mcpu=cortex-m4 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 29 | ) 30 | 31 | function(stm32wb_get_memory_info DEVICE TYPE CORE RAM RAM_ORIGIN TWO_FLASH_BANKS) 32 | set(${TWO_FLASH_BANKS} TRUE PARENT_SCOPE) 33 | list(FIND STM32_WB_TYPES ${TYPE} TYPE_INDEX) 34 | list(GET STM32_WB_RAM_SIZES ${TYPE_INDEX} RAM_VALUE) 35 | set(${RAM} "${RAM_VALUE}-4" PARENT_SCOPE) 36 | set(${RAM_ORIGIN} 0x20000004 PARENT_SCOPE) 37 | endfunction() 38 | 39 | list(APPEND STM32_ALL_DEVICES 40 | WB5MMG 41 | WB50CG 42 | WB30CE 43 | WB10CC 44 | WB55CC 45 | WB55CE 46 | WB55CG 47 | WB55RC 48 | WB55RE 49 | WB55RG 50 | WB55VC 51 | WB55VE 52 | WB55VG 53 | WB55VY 54 | WB15CC 55 | WB35CC 56 | WB35CE 57 | ) 58 | 59 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 60 | STM32WB_M4 61 | ) 62 | 63 | list(APPEND STM32_FETCH_FAMILIES WB) 64 | 65 | set(CUBE_WB_VERSION v1.12.0) 66 | set(CMSIS_WB_VERSION v1.9.0) 67 | set(HAL_WB_VERSION v1.9.0) 68 | -------------------------------------------------------------------------------- /cmake/stm32/f2.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F2_TYPES 2 | F205xx F215xx F207xx F217xx 3 | ) 4 | set(STM32_F2_TYPE_MATCH 5 | "F205.." "F215.." "F207.." "F217.." 6 | ) 7 | set(STM32_F2_RAM_SIZES 8 | 0K 128K 128K 128K 9 | ) 10 | set(STM32_F2_CCRAM_SIZES 11 | 0K 0K 0K 0K 12 | ) 13 | 14 | stm32_util_create_family_targets(F2) 15 | 16 | target_compile_options(STM32::F2 INTERFACE 17 | -mcpu=cortex-m3 18 | ) 19 | target_link_options(STM32::F2 INTERFACE 20 | -mcpu=cortex-m3 21 | ) 22 | 23 | function(stm32f2_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) 24 | string(REGEX REPLACE "F2[0-9][0-9].([468BCDEFGHI])" "\\1" SIZE_CODE ${DEVICE}) 25 | 26 | if(TYPE STREQUAL "F205xx") 27 | if(SIZE_CODE STREQUAL "B") 28 | set(RAM "64K") 29 | elseif(SIZE_CODE STREQUAL "C") 30 | set(RAM "96K") 31 | else() 32 | set(RAM "128K") 33 | endif() 34 | endif() 35 | 36 | if(RAM) 37 | set(${RAM_SIZE} ${RAM} PARENT_SCOPE) 38 | endif() 39 | endfunction() 40 | 41 | list(APPEND STM32_ALL_DEVICES 42 | F205RB 43 | F205RC 44 | F205RE 45 | F205RF 46 | F205RG 47 | F205VB 48 | F205VC 49 | F205VE 50 | F205VF 51 | F205VG 52 | F205ZC 53 | F205ZE 54 | F205ZF 55 | F205ZG 56 | F207IC 57 | F207IE 58 | F207IF 59 | F207IG 60 | F207VC 61 | F207VE 62 | F207VF 63 | F207VG 64 | F207ZC 65 | F207ZE 66 | F207ZF 67 | F207ZG 68 | F215RE 69 | F215RG 70 | F215VE 71 | F215VG 72 | F215ZE 73 | F215ZG 74 | F217IE 75 | F217IG 76 | F217VE 77 | F217VG 78 | F217ZE 79 | F217ZG 80 | ) 81 | 82 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 83 | STM32F2 84 | ) 85 | 86 | list(APPEND STM32_FETCH_FAMILIES F2) 87 | 88 | set(CUBE_F2_VERSION v1.9.3) 89 | set(CMSIS_F2_VERSION v2.2.5) 90 | set(HAL_F2_VERSION v1.2.7) 91 | -------------------------------------------------------------------------------- /tests/hal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | if(NOT TEST_FAMILIES) 5 | set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) 6 | endif() 7 | 8 | # Generate the family long names list by prepending STM32 to elements in TEST_FAMILIES 9 | list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) 10 | 11 | project(hal-test C ASM) 12 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 13 | 14 | if(FETCH_ST_SOURCES) 15 | stm32_fetch_cmsis(${TEST_FAMILIES}) 16 | stm32_fetch_hal(${TEST_FAMILIES}) 17 | endif() 18 | 19 | find_package(CMSIS REQUIRED ${TEST_FAMILIES_LONG_NAMES}) 20 | find_package(HAL REQUIRED ${TEST_FAMILIES_LONG_NAMES}) 21 | 22 | set(SOURCES main.c) 23 | 24 | foreach(FAMILY ${TEST_FAMILIES}) 25 | stm32_get_devices_by_family(STM_DEVICES FAMILY ${FAMILY}) 26 | list(GET STM_DEVICES 0 DEVICE) 27 | stm32_get_cores(CORES FAMILY ${FAMILY} DEVICE ${DEVICE}) 28 | 29 | if(CORES) 30 | list(GET CORES 0 CORE) 31 | set(CORE "::${CORE}") 32 | else() 33 | unset(CORE) 34 | endif() 35 | 36 | add_executable(hal-test-${FAMILY} ${SOURCES}) 37 | target_compile_definitions(hal-test-${FAMILY} PRIVATE USE_FULL_LL_DRIVER) 38 | 39 | foreach(DRIVER ${HAL_DRIVERS_${FAMILY}}) 40 | string(TOUPPER ${DRIVER} DRIVER) 41 | target_link_libraries(hal-test-${FAMILY} HAL::STM32::${FAMILY}${CORE}::${DRIVER}) 42 | endforeach() 43 | foreach(DRIVER ${HAL_EX_DRIVERS_${FAMILY}}) 44 | string(TOUPPER ${DRIVER} DRIVER) 45 | target_link_libraries(hal-test-${FAMILY} HAL::STM32::${FAMILY}${CORE}::${DRIVER}Ex) 46 | endforeach() 47 | foreach(DRIVER ${HAL_LL_DRIVERS_${FAMILY}}) 48 | string(TOUPPER ${DRIVER} DRIVER) 49 | target_link_libraries(hal-test-${FAMILY} HAL::STM32::${FAMILY}${CORE}::LL_${DRIVER}) 50 | endforeach() 51 | target_link_libraries(hal-test-${FAMILY} STM32::NoSys CMSIS::STM32::${DEVICE}${CORE}) 52 | endforeach() 53 | -------------------------------------------------------------------------------- /tests/bsp/stm32g4xx_nucleo_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32g4xx_nucleo_conf_template.h 4 | * @author MCD Application Team 5 | * @brief STM32G4xx_Nucleo board configuration file. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32G4XX_NUCLEO_CONF_H 22 | #define STM32G4XX_NUCLEO_CONF_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32g4xx_hal.h" 30 | 31 | /** @addtogroup BSP 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup STM32G4XX_NUCLEO 36 | * @{ 37 | */ 38 | 39 | /** @defgroup STM32G4XX_NUCLEO_CONFIG Config 40 | * @{ 41 | */ 42 | 43 | /** @defgroup STM32G4XX_NUCLEO_CONFIG_Exported_Constants Exported Constants 44 | * @{ 45 | */ 46 | /* Uncomment one of the board define below */ 47 | /* #define USE_NUCLEO_32 */ 48 | #define USE_NUCLEO_64 49 | 50 | /* COM usage define */ 51 | #define USE_BSP_COM_FEATURE 0U 52 | 53 | /* COM log define */ 54 | #define USE_COM_LOG 0U 55 | 56 | /* IRQ priorities */ 57 | #define BSP_BUTTON_USER_IT_PRIORITY 15U 58 | /** 59 | * @} 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* STM32G4XX_NUCLEO_CONF_H */ 79 | 80 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 81 | -------------------------------------------------------------------------------- /tests/cmsis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | if(NOT TEST_FAMILIES) 5 | set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 U0 U5 WB WL) 6 | endif() 7 | 8 | if("MP1" IN_LIST TEST_FAMILIES) 9 | message(WARNING "CMSIS for MP1 devices requires HAL, this test is expected to fail for the MP1 family") 10 | endif() 11 | 12 | project(cmsis-test C ASM) 13 | 14 | if(FETCH_ST_SOURCES) 15 | stm32_fetch_cmsis(${TEST_FAMILIES}) 16 | endif() 17 | 18 | list(TRANSFORM TEST_FAMILIES PREPEND STM32 OUTPUT_VARIABLE TEST_FAMILIES_LONG_NAMES) 19 | find_package(CMSIS COMPONENTS "${TEST_FAMILIES_LONG_NAMES}" REQUIRED) 20 | 21 | set(SOURCES main.c) 22 | 23 | include(stm32/devices) 24 | 25 | foreach(FAMILY ${TEST_FAMILIES}) 26 | stm32_get_devices_by_family(STM_DEVICES FAMILY ${FAMILY}) 27 | stm32_get_cores(CORES FAMILY ${FAMILY}) 28 | foreach(DEVICE ${STM_DEVICES}) 29 | stm32_get_chip_type(${FAMILY} ${DEVICE} TYPE) 30 | 31 | if(NOT CORES) 32 | stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} FLASH SIZE FLASH_SIZE) 33 | stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} RAM SIZE RAM_SIZE) 34 | message(STATUS "STM32${DEVICE}: ${FAMILY} family, type ${TYPE}, ${FLASH_SIZE} flash, ${RAM_SIZE} RAM") 35 | add_executable(cmsis-test-${DEVICE} ${SOURCES}) 36 | target_link_libraries(cmsis-test-${DEVICE} CMSIS::STM32::${DEVICE} STM32::NoSys) 37 | else() 38 | stm32_get_cores(DEV_CORES FAMILY ${FAMILY} DEVICE ${DEVICE}) 39 | foreach(CORE ${DEV_CORES}) 40 | stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} FLASH SIZE FLASH_SIZE) 41 | stm32_get_memory_info(FAMILY ${FAMILY} DEVICE ${DEVICE} CORE ${CORE} RAM SIZE RAM_SIZE) 42 | message(STATUS "STM32${DEVICE}: ${FAMILY} family, type ${TYPE}, core ${CORE}, ${FLASH_SIZE} flash, ${RAM_SIZE} RAM") 43 | add_executable(cmsis-test-${DEVICE}-${CORE} ${SOURCES}) 44 | target_link_libraries(cmsis-test-${DEVICE}-${CORE} CMSIS::STM32::${DEVICE}::${CORE} STM32::NoSys) 45 | endforeach() 46 | endif() 47 | endforeach() 48 | endforeach() 49 | -------------------------------------------------------------------------------- /tests/bsp/b_g474e_dpow1_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file b_g474e_dpow1_conf_template.h 4 | * @author MCD Application Team 5 | * @brief B-G474E-DPOW1 board configuration file. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef B_G474E_DPOW1_CONF_H 22 | #define B_G474E_DPOW1_CONF_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32g4xx_hal.h" 30 | 31 | /** @addtogroup BSP 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup B-G474E-DPOW1 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup B-G474E-DPOW1_CONFIG 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup B-G474E-DPOW1_CONFIG_Exported_Constants Exported Constants 44 | * @{ 45 | */ 46 | 47 | /* JOYstick define */ 48 | #define USE_BSP_JOY_FEATURE 1U 49 | 50 | /* COM define */ 51 | #define USE_BSP_COM_FEATURE 0U 52 | 53 | /* COM LOG define */ 54 | #define USE_COM_LOG 0U 55 | 56 | /* USBPD BSP PWR TRACE define */ 57 | #define USE_BSP_PWR_TRACE 0U 58 | 59 | #if (USE_BSP_PWR_TRACE > 0u) 60 | #define USBPD_PWR_TRACE(_PORT_,...) UTIL_ADV_TRACE_FSend(__VA_ARGS__) 61 | #else 62 | #define USBPD_PWR_TRACE(_PORT_,...) 63 | #endif /* USE_BSP_PWR_TRACE */ 64 | 65 | /* IRQ priorities */ 66 | #define BSP_JOY_SEL_IT_PRIORITY 15U 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* B_G474E_DPOW1_CONF_H */ 89 | 90 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 91 | -------------------------------------------------------------------------------- /cmake/stm32/f0.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F0_TYPES 2 | F030x6 F030x8 F031x6 F038xx F042x6 F048xx F051x8 F058xx 3 | F070x6 F070xB F071xB F072xB F078xx F091xC F098xx F030xC 4 | ) 5 | set(STM32_F0_TYPE_MATCH 6 | "F030.[46]" "F030.8" "F031.[46]" "F038.." "F042.[46]" "F048.." "F051.[468]" "F058.." 7 | "F070.6" "F070.B" "F071.[8B]" "F072.[8B]" "F078.." "F091.[BC]" "F098.." "F030.C" 8 | ) 9 | set(STM32_F0_RAM_SIZES 10 | 4K 8K 4K 4K 6K 6K 8K 8K 11 | 6K 16K 16K 16K 16K 32K 32K 32K 12 | ) 13 | set(STM32_F0_CCRAM_SIZES 14 | 0K 0K 0K 0K 0K 0K 0K 0K 15 | 0K 0K 0K 0K 0K 0K 0K 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(F0) 19 | 20 | target_compile_options(STM32::F0 INTERFACE 21 | -mcpu=cortex-m0 22 | ) 23 | target_link_options(STM32::F0 INTERFACE 24 | -mcpu=cortex-m0 25 | ) 26 | 27 | list(APPEND STM32_ALL_DEVICES 28 | F030C6 29 | F030C8 30 | F030CC 31 | F030F4 32 | F030K6 33 | F030R8 34 | F030RC 35 | F031C4 36 | F031C6 37 | F031E6 38 | F031F4 39 | F031F6 40 | F031G4 41 | F031G6 42 | F031K4 43 | F031K6 44 | F038C6 45 | F038E6 46 | F038F6 47 | F038G6 48 | F038K6 49 | F042C4 50 | F042C6 51 | F042F4 52 | F042F6 53 | F042G4 54 | F042G6 55 | F042K4 56 | F042K6 57 | F042T6 58 | F048C6 59 | F048G6 60 | F048T6 61 | F051C4 62 | F051C6 63 | F051C8 64 | F051K4 65 | F051K6 66 | F051K8 67 | F051R4 68 | F051R6 69 | F051R8 70 | F051T8 71 | F058C8 72 | F058R8 73 | F058T8 74 | F070C6 75 | F070CB 76 | F070F6 77 | F070RB 78 | F071C8 79 | F071CB 80 | F071RB 81 | F071V8 82 | F071VB 83 | F072C8 84 | F072CB 85 | F072R8 86 | F072RB 87 | F072V8 88 | F072VB 89 | F078CB 90 | F078RB 91 | F078VB 92 | F091CB 93 | F091CC 94 | F091RB 95 | F091RC 96 | F091VB 97 | F091VC 98 | F098CC 99 | F098RC 100 | F098VC 101 | ) 102 | 103 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 104 | STM32F0 105 | ) 106 | 107 | list(APPEND STM32_FETCH_FAMILIES F0) 108 | 109 | set(CUBE_F0_VERSION v1.11.2) 110 | set(CMSIS_F0_VERSION v2.3.5) 111 | set(HAL_F0_VERSION v1.7.5) 112 | -------------------------------------------------------------------------------- /.github/workflows/cmake.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 7 | BUILD_TYPE: Release 8 | 9 | jobs: 10 | RetrieveTargetsMatrix: 11 | uses: ./.github/workflows/create-matrix.yml 12 | 13 | test-ubuntu: 14 | runs-on: ubuntu-latest 15 | needs: RetrieveTargetsMatrix 16 | strategy: 17 | matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} 18 | fail-fast: false 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Install ARM toolchain 24 | run: sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi 25 | 26 | - name: Create build directory for tests/fetch 27 | run: cmake -E make_directory ${{runner.workspace}}/tests/fetch/build 28 | 29 | - name: Configure tests/fetch 30 | shell: bash 31 | working-directory: ${{runner.workspace}}/tests/fetch/build 32 | run: cmake -DTEST_FAMILIES=${{ matrix.family }} $GITHUB_WORKSPACE/tests/fetch/ 33 | 34 | - name: Build tests/fetch 35 | working-directory: ${{runner.workspace}}/tests/fetch/build 36 | shell: bash 37 | run: cmake --build . --config $BUILD_TYPE 38 | 39 | - name: Create build directory for tests/cmsis 40 | run: cmake -E make_directory ${{runner.workspace}}/tests/cmsis/build 41 | if: ${{ matrix.family != 'MP1' }} 42 | 43 | - name: Configure tests/cmsis 44 | shell: bash 45 | working-directory: ${{runner.workspace}}/tests/cmsis/build 46 | run: cmake -DTEST_FAMILIES=${{ matrix.family }} -DFETCH_ST_SOURCES=TRUE $GITHUB_WORKSPACE/tests/cmsis/ 47 | if: ${{ matrix.family != 'MP1' }} 48 | 49 | - name: Build tests/cmsis 50 | working-directory: ${{runner.workspace}}/tests/cmsis/build 51 | shell: bash 52 | run: cmake --build . --config $BUILD_TYPE 53 | if: ${{ matrix.family != 'MP1' }} 54 | 55 | - name: Create build directory for tests/hal 56 | run: cmake -E make_directory ${{runner.workspace}}/tests/hal/build 57 | 58 | - name: Configure tests/hal 59 | shell: bash 60 | working-directory: ${{runner.workspace}}/tests/hal/build 61 | run: cmake -DTEST_FAMILIES=${{ matrix.family }} -DFETCH_ST_SOURCES=TRUE $GITHUB_WORKSPACE/tests/hal/ 62 | 63 | - name: Build tests/hal 64 | working-directory: ${{runner.workspace}}/tests/hal/build 65 | shell: bash 66 | run: cmake --build . --config $BUILD_TYPE 67 | -------------------------------------------------------------------------------- /examples/freertos/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #if defined STM32F1 7 | #include 8 | 9 | // STM32VL-Discovery green led - PC9 10 | #define LED_PORT GPIOC 11 | #define LED_PIN GPIO_PIN_9 12 | // STM32VL-Discovery blue led - PC8 13 | //#define LED_PIN GPIO_PIN_8 14 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOC_CLK_ENABLE 15 | #elif defined STM32H7 16 | #include 17 | 18 | // STM32H743ZI blue LED 19 | #define LED_PORT GPIOB 20 | #define LED_PIN GPIO_PIN_7 21 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE 22 | #elif defined STM32F4 23 | #include 24 | 25 | // STM32F4-Discovery green led - PD12 26 | #define LED_PORT GPIOD 27 | #define LED_PIN GPIO_PIN_12 28 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOD_CLK_ENABLE 29 | #elif defined STM32L5 30 | #include 31 | 32 | // NUCLEO-L552ZE-Q blue led - PB7 33 | #define LED_PORT GPIOB 34 | #define LED_PIN GPIO_PIN_7 35 | #define LED_PORT_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE 36 | #endif 37 | 38 | static void blinky::blinkTask(void *arg) 39 | { 40 | for(;;) 41 | { 42 | vTaskDelay(500); 43 | HAL_GPIO_TogglePin(LED_PORT, LED_PIN); 44 | } 45 | } 46 | 47 | void blinky::init() 48 | { 49 | GPIO_InitTypeDef GPIO_Config; 50 | 51 | GPIO_Config.Mode = GPIO_MODE_OUTPUT_PP; 52 | GPIO_Config.Pull = GPIO_NOPULL; 53 | GPIO_Config.Speed = GPIO_SPEED_FREQ_HIGH; 54 | 55 | GPIO_Config.Pin = LED_PIN; 56 | 57 | LED_PORT_CLK_ENABLE(); 58 | HAL_GPIO_Init(LED_PORT, &GPIO_Config); 59 | } 60 | 61 | int main(void) 62 | { 63 | SystemInit(); 64 | blinky::init(); 65 | 66 | xTaskCreate(blinky::blinkTask, "blinky", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); 67 | 68 | vTaskStartScheduler(); 69 | for (;;); 70 | 71 | return 0; 72 | } 73 | 74 | extern "C" void vApplicationTickHook(void) 75 | { 76 | } 77 | 78 | extern "C" void vApplicationIdleHook(void) 79 | { 80 | } 81 | 82 | extern "C" void vApplicationMallocFailedHook(void) 83 | { 84 | taskDISABLE_INTERRUPTS(); 85 | for(;;); 86 | } 87 | 88 | extern "C" void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) 89 | { 90 | (void) pcTaskName; 91 | (void) pxTask; 92 | 93 | taskDISABLE_INTERRUPTS(); 94 | for(;;); 95 | } 96 | -------------------------------------------------------------------------------- /cmake/stm32/f7.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F7_TYPES 2 | F756xx F746xx F745xx F765xx F767xx F769xx F777xx F779xx 3 | F722xx F723xx F732xx F733xx F730xx F750xx 4 | ) 5 | set(STM32_F7_TYPE_MATCH 6 | "F756.." "F746.." "F745.." "F765.." "F767.." "F769.." "F777.." "F77[89].." 7 | "F722.." "F723.." "F732.." "F733.." "F730.." "F750.." 8 | ) 9 | set(STM32_F7_RAM_SIZES 10 | 320K 320K 320K 512K 512K 512K 512K 512K 11 | 256K 256K 256K 256K 256K 320K 12 | ) 13 | set(STM32_F7_CCRAM_SIZES 14 | 0K 0K 0K 0K 0K 0K 0K 0K 15 | 0K 0K 0K 0K 0K 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(F7) 19 | 20 | target_compile_options(STM32::F7 INTERFACE 21 | -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 22 | ) 23 | target_link_options(STM32::F7 INTERFACE 24 | -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 25 | ) 26 | 27 | list(APPEND STM32_ALL_DEVICES 28 | F722IC 29 | F722IE 30 | F722RC 31 | F722RE 32 | F722VC 33 | F722VE 34 | F722ZC 35 | F722ZE 36 | F723IC 37 | F723IE 38 | F723VE 39 | F723ZC 40 | F723ZE 41 | F730I8 42 | F730R8 43 | F730V8 44 | F730Z8 45 | F732IE 46 | F732RE 47 | F732VE 48 | F732ZE 49 | F733IE 50 | F733VE 51 | F733ZE 52 | F745IE 53 | F745IG 54 | F745VE 55 | F745VG 56 | F745ZE 57 | F745ZG 58 | F746BE 59 | F746BG 60 | F746IE 61 | F746IG 62 | F746NE 63 | F746NG 64 | F746VE 65 | F746VG 66 | F746ZE 67 | F746ZG 68 | F750N8 69 | F750V8 70 | F750Z8 71 | F756BG 72 | F756IG 73 | F756NG 74 | F756VG 75 | F756ZG 76 | F765BG 77 | F765BI 78 | F765IG 79 | F765II 80 | F765NG 81 | F765NI 82 | F765VG 83 | F765VI 84 | F765ZG 85 | F765ZI 86 | F767BG 87 | F767BI 88 | F767IG 89 | F767II 90 | F767NG 91 | F767NI 92 | F767VG 93 | F767VI 94 | F767ZG 95 | F767ZI 96 | F769AI 97 | F769BG 98 | F769BI 99 | F769IG 100 | F769II 101 | F769NG 102 | F769NI 103 | F777BI 104 | F777II 105 | F777NI 106 | F777VI 107 | F777ZI 108 | F778AI 109 | F779AI 110 | F779BI 111 | F779II 112 | F779NI 113 | ) 114 | 115 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 116 | STM32F7 117 | ) 118 | 119 | list(APPEND STM32_FETCH_FAMILIES F7) 120 | 121 | set(CUBE_F7_VERSION v1.16.1) 122 | set(CMSIS_F7_VERSION v1.2.6) 123 | set(HAL_F7_VERSION v1.2.9) 124 | -------------------------------------------------------------------------------- /cmake/stm32/g4.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_G4_TYPES 2 | G431xx G441xx G471xx G473xx G483xx G474xx G484xx 3 | G491xx G4A1xx 4 | ) 5 | set(STM32_G4_TYPE_MATCH 6 | "G431.." "G441.." "G471.." "G473.." "G483.." "G474.." "G484.." 7 | "G491.." "G4A1.." 8 | ) 9 | set(STM32_G4_RAM_SIZES 10 | 32K 32K 128K 128K 128K 128K 128K 11 | 112K 112K 12 | ) 13 | set(STM32_G4_CCRAM_SIZES 14 | 0K 0K 0K 0K 0K 0K 0K 15 | 0K 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(G4) 19 | 20 | target_compile_options(STM32::G4 INTERFACE 21 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 22 | ) 23 | target_link_options(STM32::G4 INTERFACE 24 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 25 | ) 26 | 27 | list(APPEND STM32_ALL_DEVICES 28 | G431C6 29 | G431C8 30 | G431CB 31 | G431K6 32 | G431K8 33 | G431KB 34 | G431M6 35 | G431M8 36 | G431MB 37 | G431R6 38 | G431R8 39 | G431RB 40 | G431V6 41 | G431V8 42 | G431VB 43 | G441CB 44 | G441KB 45 | G441MB 46 | G441RB 47 | G441VB 48 | G471CC 49 | G471CE 50 | G471MC 51 | G471ME 52 | G471QC 53 | G471QE 54 | G471RC 55 | G471RE 56 | G471VC 57 | G471VE 58 | G473CB 59 | G473CC 60 | G473CE 61 | G473MB 62 | G473MC 63 | G473ME 64 | G473PB 65 | G473PC 66 | G473PE 67 | G473QB 68 | G473QC 69 | G473QE 70 | G473RB 71 | G473RC 72 | G473RE 73 | G473VB 74 | G473VC 75 | G473VE 76 | G474CB 77 | G474CC 78 | G474CE 79 | G474MB 80 | G474MC 81 | G474ME 82 | G474PB 83 | G474PC 84 | G474PE 85 | G474QB 86 | G474QC 87 | G474QE 88 | G474RB 89 | G474RC 90 | G474RE 91 | G474VB 92 | G474VC 93 | G474VE 94 | G483CE 95 | G483ME 96 | G483PE 97 | G483QE 98 | G483RE 99 | G483VE 100 | G484CE 101 | G484ME 102 | G484PE 103 | G484QE 104 | G484RE 105 | G484VE 106 | G491CC 107 | G491KC 108 | G491MC 109 | G491RC 110 | G491VC 111 | G491CE 112 | G491KE 113 | G491ME 114 | G491RE 115 | G491VE 116 | G4A1CE 117 | G4A1KE 118 | G4A1ME 119 | G4A1RE 120 | G4A1VE 121 | GBK1CB 122 | ) 123 | 124 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 125 | STM32G4 126 | ) 127 | 128 | list(APPEND STM32_FETCH_FAMILIES G4) 129 | 130 | set(CUBE_G4_VERSION v1.4.0) 131 | set(CMSIS_G4_VERSION v1.2.1) 132 | set(HAL_G4_VERSION v1.2.1) 133 | -------------------------------------------------------------------------------- /cmake/stm32/g0.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_G0_TYPES 2 | G030xx G031xx G041xx G050xx G051xx G061xx 3 | G070xx G071xx G081xx G0B0xx G0B1xx G0C1xx 4 | ) 5 | set(STM32_G0_TYPE_MATCH 6 | "G030.." "G031.." "G041.." "G050.." "G051.." "G061.." 7 | "G070.." "G071.." "G081.." "G0B0.." "G0B1.." "G0C1.." 8 | ) 9 | set(STM32_G0_RAM_SIZES 10 | 8K 8K 8K 18K 18K 18K 11 | 36K 36K 36K 144K 144K 144K 12 | ) 13 | set(STM32_G0_CCRAM_SIZES 14 | 0K 0K 0K 0K 0K 0K 15 | 0K 0K 0K 0K 0K 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(G0) 19 | 20 | target_compile_options(STM32::G0 INTERFACE 21 | -mcpu=cortex-m0plus 22 | ) 23 | target_link_options(STM32::G0 INTERFACE 24 | -mcpu=cortex-m0plus 25 | ) 26 | 27 | list(APPEND STM32_ALL_DEVICES 28 | G030C6 29 | G030C8 30 | G030F6 31 | G030J6 32 | G030K6 33 | G030K8 34 | G031C4 35 | G031C6 36 | G031C8 37 | G031F4 38 | G031F6 39 | G031F8 40 | G031G4 41 | G031G6 42 | G031G8 43 | G031J4 44 | G031J6 45 | G031K4 46 | G031K6 47 | G031K8 48 | G031Y8 49 | G041C6 50 | G041C8 51 | G041F6 52 | G041F8 53 | G041G6 54 | G041G8 55 | G041J6 56 | G041K6 57 | G041K8 58 | G041Y8 59 | G050C6 60 | G050C8 61 | G050F6 62 | G050K6 63 | G050K8 64 | G051C6 65 | G051C8 66 | G051F6 67 | G051F8 68 | G051G6 69 | G051G8 70 | G051K6 71 | G051K8 72 | G061C6 73 | G061C8 74 | G061F6 75 | G061F8 76 | G061G6 77 | G061G8 78 | G061K6 79 | G061K8 80 | G070CB 81 | G070KB 82 | G070RB 83 | G071C6 84 | G071C8 85 | G071CB 86 | G071EB 87 | G071G6 88 | G071G8 89 | G071GB 90 | G071K6 91 | G071K8 92 | G071KB 93 | G071R6 94 | G071R8 95 | G071RB 96 | G081CB 97 | G081EB 98 | G081GB 99 | G081KB 100 | G081RB 101 | G0B0CE 102 | G0B0KE 103 | G0B0RE 104 | G0B0VE 105 | G0B1CB 106 | G0B1CC 107 | G0B1CE 108 | G0B1KB 109 | G0B1KC 110 | G0B1KE 111 | G0B1MB 112 | G0B1MC 113 | G0B1ME 114 | G0B1NE 115 | G0B1RB 116 | G0B1RC 117 | G0B1RE 118 | G0B1VB 119 | G0B1VC 120 | G0B1VE 121 | G0C1CC 122 | G0C1CE 123 | G0C1KC 124 | G0C1KE 125 | G0C1MC 126 | G0C1ME 127 | G0C1RC 128 | G0C1RE 129 | G0C1VC 130 | G0C1VE 131 | ) 132 | 133 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 134 | STM32G0 135 | ) 136 | 137 | list(APPEND STM32_FETCH_FAMILIES G0) 138 | 139 | set(CUBE_G0_VERSION v1.4.1) 140 | set(CMSIS_G0_VERSION v1.4.0) 141 | set(HAL_G0_VERSION v1.4.1) 142 | -------------------------------------------------------------------------------- /cmake/stm32/l0.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_L0_TYPES 2 | L010x4 L010x6 L010x8 L010xB L011xx L021xx L031xx L041xx 3 | L051xx L052xx L053xx L061xx L062xx L063xx L071xx L072xx 4 | L073xx L081xx L082xx L083xx 5 | ) 6 | set(STM32_L0_TYPE_MATCH 7 | "L010.4" "L010.6" "L010.8" "L010.B" "L011.." "L021.." "L031.." "L041.." 8 | "L051.." "L052.." "L053.." "L061.." "L062.." "L063.." "L071.." "L072.." 9 | "L073.." "L081.." "L082.." "L083.." 10 | ) 11 | set(STM32_L0_RAM_SIZES 12 | 2K 8K 8K 20K 2K 2K 8K 8K 13 | 8K 8K 8K 8K 8K 8K 20K 20K 14 | 20K 20K 20K 20K 15 | ) 16 | set(STM32_L0_CCRAM_SIZES 17 | 0K 0K 0K 0K 0K 0K 0K 0K 18 | 0K 0K 0K 0K 0K 0K 0K 0K 19 | 0K 0K 0K 0K 20 | ) 21 | 22 | stm32_util_create_family_targets(L0) 23 | 24 | target_compile_options(STM32::L0 INTERFACE 25 | -mcpu=cortex-m0plus 26 | ) 27 | target_link_options(STM32::L0 INTERFACE 28 | -mcpu=cortex-m0plus 29 | ) 30 | 31 | list(APPEND STM32_ALL_DEVICES 32 | L010C6 33 | L010F4 34 | L010K4 35 | L010K8 36 | L010R8 37 | L010RB 38 | L011D3 39 | L011D4 40 | L011E3 41 | L011E4 42 | L011F3 43 | L011F4 44 | L011G3 45 | L011G4 46 | L011K3 47 | L011K4 48 | L021D4 49 | L021F4 50 | L021G4 51 | L021K4 52 | L031C4 53 | L031C6 54 | L031E4 55 | L031E6 56 | L031F4 57 | L031F6 58 | L031G4 59 | L031G6 60 | L031K4 61 | L031K6 62 | L041C6 63 | L041E6 64 | L041F6 65 | L041G6 66 | L041K6 67 | L051C6 68 | L051C8 69 | L051K6 70 | L051K8 71 | L051R6 72 | L051R8 73 | L051T6 74 | L051T8 75 | L052C6 76 | L052C8 77 | L052K6 78 | L052K8 79 | L052R6 80 | L052R8 81 | L052T6 82 | L052T8 83 | L053C6 84 | L053C8 85 | L053R6 86 | L053R8 87 | L062C8 88 | L062K8 89 | L063C8 90 | L063R8 91 | L071C8 92 | L071CB 93 | L071CZ 94 | L071K8 95 | L071KB 96 | L071KZ 97 | L071RB 98 | L071RZ 99 | L071V8 100 | L071VB 101 | L071VZ 102 | L072CB 103 | L072CZ 104 | L072KB 105 | L072KZ 106 | L072RB 107 | L072RZ 108 | L072V8 109 | L072VB 110 | L072VZ 111 | L073CB 112 | L073CZ 113 | L073RB 114 | L073RZ 115 | L073V8 116 | L073VB 117 | L073VZ 118 | L081CB 119 | L081CZ 120 | L081KZ 121 | L082CZ 122 | L082KZ 123 | L083CB 124 | L083CZ 125 | L083RB 126 | L083RZ 127 | L083V8 128 | L083VB 129 | L083VZ 130 | ) 131 | 132 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 133 | STM32L0 134 | ) 135 | 136 | list(APPEND STM32_FETCH_FAMILIES L0) 137 | 138 | set(CUBE_L0_VERSION v1.12.0) 139 | set(CMSIS_L0_VERSION v1.9.1) 140 | set(HAL_L0_VERSION v1.10.4) 141 | -------------------------------------------------------------------------------- /examples/custom-linker-script/F407VG.ld: -------------------------------------------------------------------------------- 1 | ENTRY(Reset_Handler) 2 | 3 | _estack = 0x20000000 + 128K; 4 | _Min_Heap_Size = 0x200; 5 | _Min_Stack_Size = 0x400; 6 | 7 | MEMORY 8 | { 9 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K 10 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 11 | CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K 12 | 13 | } 14 | 15 | SECTIONS 16 | { 17 | .isr_vector : 18 | { 19 | . = ALIGN(4); 20 | KEEP(*(.isr_vector)) 21 | . = ALIGN(4); 22 | } >FLASH 23 | 24 | .text : 25 | { 26 | . = ALIGN(4); 27 | *(.text) 28 | *(.text*) 29 | *(.glue_7) 30 | *(.glue_7t) 31 | *(.eh_frame) 32 | 33 | KEEP (*(.init)) 34 | KEEP (*(.fini)) 35 | 36 | . = ALIGN(4); 37 | _etext = .; 38 | } >FLASH 39 | 40 | .rodata : 41 | { 42 | . = ALIGN(4); 43 | *(.rodata) 44 | *(.rodata*) 45 | . = ALIGN(4); 46 | } >FLASH 47 | 48 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 49 | .ARM : { 50 | __exidx_start = .; 51 | *(.ARM.exidx*) 52 | __exidx_end = .; 53 | } >FLASH 54 | 55 | .preinit_array : 56 | { 57 | PROVIDE_HIDDEN (__preinit_array_start = .); 58 | KEEP (*(.preinit_array*)) 59 | PROVIDE_HIDDEN (__preinit_array_end = .); 60 | } >FLASH 61 | .init_array : 62 | { 63 | PROVIDE_HIDDEN (__init_array_start = .); 64 | KEEP (*(SORT(.init_array.*))) 65 | KEEP (*(.init_array*)) 66 | PROVIDE_HIDDEN (__init_array_end = .); 67 | } >FLASH 68 | .fini_array : 69 | { 70 | PROVIDE_HIDDEN (__fini_array_start = .); 71 | KEEP (*(SORT(.fini_array.*))) 72 | KEEP (*(.fini_array*)) 73 | PROVIDE_HIDDEN (__fini_array_end = .); 74 | } >FLASH 75 | 76 | _sidata = LOADADDR(.data); 77 | 78 | .data : 79 | { 80 | . = ALIGN(4); 81 | _sdata = .; 82 | *(.data) 83 | *(.data*) 84 | 85 | . = ALIGN(4); 86 | _edata = .; 87 | } >RAM AT> FLASH 88 | 89 | _siccmram = LOADADDR(.ccmram); 90 | .ccmram : 91 | { 92 | . = ALIGN(4); 93 | _sccmram = .; 94 | *(.ccmram) 95 | *(.ccmram*) 96 | . = ALIGN(4); 97 | _eccmram = .; 98 | } >CCMRAM AT> FLASH 99 | 100 | . = ALIGN(4); 101 | .bss : 102 | { 103 | _sbss = .; 104 | __bss_start__ = _sbss; 105 | *(.bss) 106 | *(.bss*) 107 | *(COMMON) 108 | 109 | . = ALIGN(4); 110 | _ebss = .; 111 | __bss_end__ = _ebss; 112 | } >RAM 113 | 114 | ._user_heap_stack : 115 | { 116 | . = ALIGN(8); 117 | PROVIDE ( end = . ); 118 | PROVIDE ( _end = . ); 119 | . = . + _Min_Heap_Size; 120 | . = . + _Min_Stack_Size; 121 | . = ALIGN(8); 122 | } >RAM 123 | 124 | /DISCARD/ : 125 | { 126 | libc.a ( * ) 127 | libm.a ( * ) 128 | libgcc.a ( * ) 129 | } 130 | 131 | .ARM.attributes 0 : { *(.ARM.attributes) } 132 | } -------------------------------------------------------------------------------- /examples/blinky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | # Configure here which STM32 target(s) to build 5 | option(BLINKY_F4_EXAMPLE "Compile F4 example" ON) 6 | option(BLINKY_F1_EXAMPLE "Compile F1 example" OFF) 7 | option(BLINKY_L0_EXAMPLE "Compile L0 example" OFF) 8 | 9 | option(USE_CPP_FILE "Use the .cpp example file instead of the .c one" OFF) 10 | 11 | if(USE_CPP_FILE) 12 | project(stm32-blinky C CXX ASM) 13 | set(MAIN_SOURCE_FILE blinky.cpp) 14 | else() 15 | project(stm32-blinky C ASM) 16 | set(MAIN_SOURCE_FILE blinky.c) 17 | endif() 18 | 19 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 20 | 21 | 22 | set(HAL_COMP_LIST RCC GPIO CORTEX) 23 | set(CMSIS_COMP_LIST "") 24 | 25 | if(BLINKY_F4_EXAMPLE) 26 | list(APPEND CMSIS_COMP_LIST STM32F4) 27 | list(APPEND HAL_COMP_LIST STM32F4) 28 | endif() 29 | 30 | if(BLINKY_F1_EXAMPLE) 31 | list(APPEND CMSIS_COMP_LIST STM32F1) 32 | list(APPEND HAL_COMP_LIST STM32F1) 33 | endif() 34 | 35 | if(BLINKY_L0_EXAMPLE) 36 | list(APPEND CMSIS_COMP_LIST STM32L0) 37 | list(APPEND HAL_COMP_LIST STM32L0) 38 | endif() 39 | 40 | find_package(CMSIS COMPONENTS "${CMSIS_COMP_LIST}" REQUIRED) 41 | find_package(HAL COMPONENTS "${HAL_COMP_LIST}" REQUIRED) 42 | 43 | # Find all device specific drivers: 44 | #find_package(HAL COMPONENTS STM32L0 STM32F1 STM32F4 REQUIRED) 45 | # Find drivers for all families: 46 | #find_package(HAL COMPONENTS RCC GPIO CORTEX REQUIRED) 47 | # Find LL driver: 48 | #find_package(HAL COMPONENTS LL_GPIO REQUIRED) 49 | # Find everything: 50 | #find_package(HAL REQUIRED) 51 | 52 | # STM32F4-Discovery 53 | if(BLINKY_F4_EXAMPLE) 54 | add_executable(stm32-blinky-f4 ${MAIN_SOURCE_FILE} stm32f4xx_hal_conf.h) 55 | target_link_libraries(stm32-blinky-f4 56 | HAL::STM32::F4::RCC 57 | HAL::STM32::F4::GPIO 58 | HAL::STM32::F4::CORTEX 59 | CMSIS::STM32::F407VG 60 | STM32::NoSys 61 | ) 62 | stm32_print_size_of_target(stm32-blinky-f4) 63 | endif() 64 | 65 | # STM32VL-Discovery 66 | if(BLINKY_F1_EXAMPLE) 67 | add_executable(stm32-blinky-f1 ${MAIN_SOURCE_FILE} stm32f1xx_hal_conf.h) 68 | target_link_libraries(stm32-blinky-f1 69 | HAL::STM32::F1::RCC 70 | HAL::STM32::F1::GPIO 71 | HAL::STM32::F1::CORTEX 72 | CMSIS::STM32::F100RB 73 | STM32::NoSys 74 | ) 75 | stm32_print_size_of_target(stm32-blinky-f1) 76 | endif() 77 | 78 | # STM32L0538-Discovery 79 | if(BLINKY_L0_EXAMPLE) 80 | add_executable(stm32-blinky-l0 ${MAIN_SOURCE_FILE} stm32l0xx_hal_conf.h) 81 | target_link_libraries(stm32-blinky-l0 82 | HAL::STM32::L0::RCC 83 | HAL::STM32::L0::GPIO 84 | HAL::STM32::L0::CORTEX 85 | CMSIS::STM32::L053C8 86 | STM32::NoSys 87 | ) 88 | stm32_print_size_of_target(stm32-blinky-l0) 89 | endif() 90 | -------------------------------------------------------------------------------- /tests/bsp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake) 3 | 4 | if(NOT TEST_FAMILIES) 5 | set(TEST_FAMILIES C0 F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5 MP1 U0 U5 WB WL) 6 | endif() 7 | 8 | # Nucleo boards can have different devices on it 9 | set(DEVICE_STM32C0xx_Nucleo C031C6) 10 | set(DEVICE_STM32F0xx_Nucleo_32 F031K6) 11 | set(DEVICE_STM32F0xx_Nucleo F030R8) 12 | set(DEVICE_STM32F1xx_Nucleo F103RB) 13 | set(DEVICE_STM32F2xx_Nucleo_144 F207ZG) 14 | set(DEVICE_STM32F3xx_Nucleo_32 F303K8) 15 | set(DEVICE_STM32F3xx_Nucleo F334R8) 16 | set(DEVICE_STM32F3xx_Nucleo_144 F303ZE) 17 | set(DEVICE_STM32F4xx_Nucleo_144 F429ZI) 18 | set(DEVICE_STM32F4xx_Nucleo F446RE) 19 | set(DEVICE_STM32F7xx_Nucleo_144 F746ZG) 20 | set(DEVICE_STM32G0xx_Nucleo G070RB) 21 | set(DEVICE_STM32G0xx_Nucleo_32 G031K8) 22 | set(DEVICE_STM32G4xx_Nucleo G474RE) 23 | set(DEVICE_STM32L0xx_Nucleo L053R8) 24 | set(DEVICE_STM32L0xx_Nucleo_32 L011K4) 25 | set(DEVICE_STM32L1xx_Nucleo L152RE) 26 | set(DEVICE_STM32L4xx_Nucleo L412RB) 27 | set(DEVICE_STM32L4xx_Nucleo_32 L412KB) 28 | set(DEVICE_STM32L4xx_Nucleo_144 L496ZG) 29 | set(DEVICE_STM32MP15xx_DISCO MP157CAC) 30 | set(DEVICE_STM32MP15xx_EVAL MP157FAA) 31 | set(DEVICE_STM32U0xx_Nucleo U031R8) 32 | set(DEVICE_STM32U0xx_DISCO U083CC) 33 | set(DEFINES_STM32469I_EVAL USE_IOEXPANDER) 34 | set(DEFINES_STM32F769I_EVAL USE_IOEXPANDER) 35 | set(DEFINES_STM32L476G_EVAL USE_IOEXPANDER) 36 | set(DEFINES_STM32L4R9I_EVAL USE_ROCKTECH_480x272) 37 | 38 | # Ban some boards because their BSP need non-free components 39 | set(BANNED_BOARDS STM32756G_EVAL) 40 | 41 | project(bsp-test C ASM) 42 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 43 | 44 | if(FETCH_ST_SOURCES) 45 | stm32_fetch_cube(${TEST_FAMILIES}) 46 | endif() 47 | 48 | find_package(CMSIS REQUIRED) 49 | find_package(HAL REQUIRED) 50 | find_package(BSP REQUIRED) 51 | 52 | set(SOURCES main.c) 53 | 54 | foreach(FAMILY ${TEST_FAMILIES}) 55 | foreach(BOARD ${BSP_${FAMILY}_BOARDS}) 56 | string(REPLACE "-" "_" BOARD ${BOARD}) 57 | 58 | if(BOARD IN_LIST BANNED_BOARDS) 59 | continue() 60 | endif() 61 | 62 | add_executable(bsp-test-${BOARD} ${SOURCES}) 63 | target_link_libraries(bsp-test-${BOARD} 64 | BSP::STM32::${BOARD} 65 | HAL::STM32::${FAMILY} 66 | STM32::NoSys 67 | ) 68 | if(DEVICE_${BOARD}) 69 | target_link_libraries(bsp-test-${BOARD} CMSIS::STM32::${DEVICE_${BOARD}}) 70 | endif() 71 | if(DEFINES_${BOARD}) 72 | target_compile_definitions(bsp-test-${BOARD} PRIVATE ${DEFINES_${BOARD}}) 73 | endif() 74 | foreach(COMP ${BSP_${FAMILY}_COMPONENTS}) 75 | string(TOUPPER ${COMP} COMP) 76 | # Workaround - F3 has both CS43L22 and CS43L52 that conflicts 77 | if((FAMILY STREQUAL F3) AND (COMP STREQUAL CS43L22)) 78 | continue() 79 | endif() 80 | target_link_libraries(bsp-test-${BOARD} BSP::STM32::${FAMILY}::${COMP}) 81 | endforeach() 82 | endforeach() 83 | endforeach() 84 | -------------------------------------------------------------------------------- /cmake/stm32/wl.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_WL_TYPES 2 | WL54xx WL55xx WLE4xx WLE5xx WLE4xx WLE5xx WLE4xx WLE5xx 3 | ) 4 | set(STM32_WL_TYPE_MATCH 5 | "WL54.." "WL55.." "WLE4.8" "WLE5.8" "WLE4.B" "WLE5.B" "WLE4.C" "WLE5.C" 6 | ) 7 | 8 | # this is RAM size allocated to M4 core 9 | # Note devices with 20 and 48K RAM can use only half of available RAM because 10 | # there are 2 split sections of RAM and our default linker script only manages 11 | # one section. 12 | set(STM32_WL_RAM_SIZES 13 | 32K 32K 10K 10K 24K 24K 64K 64K 14 | ) 15 | 16 | # this is RAM size allocated to M0PLUS core 17 | set(STM32_WL_M0PLUS_RAM_SIZES 18 | 32K 32K 0K 0K 0K 0K 0K 0K 19 | ) 20 | 21 | set(STM32_WL_CCRAM_SIZES 22 | 0K 0K 0K 0K 0K 0K 0K 0K 23 | ) 24 | 25 | set(STM32_WL_DUAL_CORE 26 | WL54xx WL55xx 27 | ) 28 | 29 | stm32_util_create_family_targets(WL M4) 30 | 31 | target_compile_options(STM32::WL::M4 INTERFACE 32 | -mcpu=cortex-m4 -mfloat-abi=soft 33 | ) 34 | target_link_options(STM32::WL::M4 INTERFACE 35 | -mcpu=cortex-m4 -mfloat-abi=soft 36 | ) 37 | 38 | stm32_util_create_family_targets(WL M0PLUS) 39 | 40 | target_compile_options(STM32::WL::M0PLUS INTERFACE 41 | -mcpu=cortex-m0plus -mfloat-abi=soft 42 | ) 43 | target_link_options(STM32::WL::M0PLUS INTERFACE 44 | -mcpu=cortex-m0plus -mfloat-abi=soft 45 | ) 46 | 47 | function(stm32wl_get_memory_info DEVICE TYPE CORE RAM FLASH_ORIGIN RAM_ORIGIN TWO_FLASH_BANKS) 48 | if(${TYPE} IN_LIST STM32_WL_DUAL_CORE) 49 | set(${TWO_FLASH_BANKS} TRUE PARENT_SCOPE) 50 | else() 51 | set(${TWO_FLASH_BANKS} FALSE PARENT_SCOPE) 52 | endif() 53 | list(FIND STM32_WL_TYPES ${TYPE} TYPE_INDEX) 54 | if(CORE STREQUAL "M4") 55 | list(GET STM32_WL_RAM_SIZES ${TYPE_INDEX} RAM_VALUE) 56 | set(${RAM} ${RAM_VALUE} PARENT_SCOPE) 57 | set(${FLASH_ORIGIN} 0x8000000 PARENT_SCOPE) 58 | set(${RAM_ORIGIN} 0x20000000 PARENT_SCOPE) 59 | elseif((${TYPE} IN_LIST STM32_WL_DUAL_CORE) AND (CORE STREQUAL "M0PLUS")) 60 | list(GET STM32_WL_M0PLUS_RAM_SIZES ${TYPE_INDEX} RAM_VALUE) 61 | set(${RAM} ${RAM_VALUE} PARENT_SCOPE) 62 | set(${FLASH_ORIGIN} 0x8020000 PARENT_SCOPE) 63 | set(${RAM_ORIGIN} 0x20008000 PARENT_SCOPE) 64 | else() 65 | message(FATAL_ERROR "Unknown core ${CORE}") 66 | endif() 67 | endfunction() 68 | 69 | function(stm32wl_get_device_cores DEVICE TYPE CORES) 70 | if(${TYPE} IN_LIST STM32_WL_DUAL_CORE) 71 | set(${CORES} M4 M0PLUS PARENT_SCOPE) 72 | else() 73 | set(${CORES} M4 PARENT_SCOPE) 74 | endif() 75 | endfunction() 76 | 77 | list(APPEND STM32_ALL_DEVICES 78 | WL55CC 79 | WL54CC 80 | WL55JC 81 | WL54JC 82 | WLE5J8 83 | WLE5JB 84 | WLE5JC 85 | WLE5C8 86 | WLE5CB 87 | WLE5CC 88 | WLE4J8 89 | WLE4JB 90 | WLE4JC 91 | WLE4C8 92 | WLE4CB 93 | WLE4CC 94 | ) 95 | 96 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 97 | STM32WL_M0PLUS 98 | STM32WL_M4 99 | ) 100 | 101 | list(APPEND STM32_FETCH_FAMILIES WL) 102 | 103 | set(CUBE_WL_VERSION v1.1.0) 104 | set(CMSIS_WL_VERSION v1.1.0) 105 | set(HAL_WL_VERSION v1.1.0) 106 | -------------------------------------------------------------------------------- /cmake/stm32/f3.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F3_TYPES 2 | F301x8 F302x8 F302xC F302xE F303x8 F303xC 3 | F303xE F318xx F328xx F334x8 F358xx F373xC 4 | F378xx F398xx 5 | ) 6 | set(STM32_F3_TYPE_MATCH 7 | "301.[68]" "302.[68]" "302.[BC]" "302.[DE]" "303.[68]" "303.[BC]" 8 | "303.[DE]" "318.." "328.." "334.[468]" "358.." "373.[8BC]" 9 | "378.." "398.." 10 | ) 11 | set(STM32_F3_RAM_SIZES 12 | 16K 16K 0K 64K 12K 0K 13 | 64K 16K 12K 12K 40K 0K 14 | 32K 64K 15 | ) 16 | set(STM32_F3_CCRAM_SIZES 17 | 0K 0K 0K 0K 4K 8K 18 | 16K 0K 4K 4K 8K 0K 19 | 0K 16K 20 | ) 21 | 22 | stm32_util_create_family_targets(F3) 23 | 24 | target_compile_options(STM32::F3 INTERFACE 25 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 26 | ) 27 | target_link_options(STM32::F3 INTERFACE 28 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 29 | ) 30 | 31 | function(stm32f3_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) 32 | string(REGEX REPLACE "F3[0-9][0-9].([468BCDEFGHI])" "\\1" SIZE_CODE ${DEVICE}) 33 | 34 | if(TYPE STREQUAL "F302xC") 35 | if(SIZE_CODE STREQUAL "C") 36 | set(RAM "40K") 37 | else() 38 | set(RAM "32K") 39 | endif() 40 | elseif(TYPE STREQUAL "F303xC") 41 | if(SIZE_CODE STREQUAL "C") 42 | set(RAM "40K") 43 | else() 44 | set(RAM "32K") 45 | endif() 46 | elseif(TYPE STREQUAL "F373xC") 47 | if(SIZE_CODE STREQUAL "B") 48 | set(RAM "24K") 49 | elseif(SIZE_CODE STREQUAL "C") 50 | set(RAM "32K") 51 | else() 52 | set(RAM "16K") 53 | endif() 54 | endif() 55 | 56 | if(RAM) 57 | set(${RAM_SIZE} ${RAM} PARENT_SCOPE) 58 | endif() 59 | endfunction() 60 | 61 | list(APPEND STM32_ALL_DEVICES 62 | F301C6 63 | F301C8 64 | F301K6 65 | F301K8 66 | F301R6 67 | F301R8 68 | F302C6 69 | F302C8 70 | F302CB 71 | F302CC 72 | F302K6 73 | F302K8 74 | F302R6 75 | F302R8 76 | F302RB 77 | F302RC 78 | F302RD 79 | F302RE 80 | F302VB 81 | F302VC 82 | F302VD 83 | F302VE 84 | F302ZD 85 | F302ZE 86 | F303C6 87 | F303C8 88 | F303CB 89 | F303CC 90 | F303K6 91 | F303K8 92 | F303R6 93 | F303R8 94 | F303RB 95 | F303RC 96 | F303RD 97 | F303RE 98 | F303VB 99 | F303VC 100 | F303VD 101 | F303VE 102 | F303ZD 103 | F303ZE 104 | F318C8 105 | F318K8 106 | F328C8 107 | F334C4 108 | F334C6 109 | F334C8 110 | F334K4 111 | F334K6 112 | F334K8 113 | F334R6 114 | F334R8 115 | F358CC 116 | F358RC 117 | F358VC 118 | F373C8 119 | F373CB 120 | F373CC 121 | F373R8 122 | F373RB 123 | F373RC 124 | F373V8 125 | F373VB 126 | F373VC 127 | F378CC 128 | F378RC 129 | F378VC 130 | F398VE 131 | ) 132 | 133 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 134 | STM32F3 135 | ) 136 | 137 | list(APPEND STM32_FETCH_FAMILIES F3) 138 | 139 | set(CUBE_F3_VERSION v1.11.2) 140 | set(CMSIS_F3_VERSION v2.3.5) 141 | set(HAL_F3_VERSION v1.5.5) 142 | -------------------------------------------------------------------------------- /tests/bsp/stm32g474e_eval_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32g474e_eval_conf_template.h 4 | * @author MCD Application Team 5 | * @brief STM32G474E-EVAL board configuration file. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32G474E_EVAL_CONF_H 22 | #define STM32G474E_EVAL_CONF_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32g4xx_hal.h" 30 | #include "stm32g474e_eval_errno.h" 31 | /** @addtogroup BSP 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup STM32G474E-EVAL 36 | * @{ 37 | */ 38 | 39 | /** @defgroup STM32G474E-EVAL_CONFIG STM32G474E-EVAL CONFIG 40 | * @{ 41 | */ 42 | 43 | /** @defgroup STM32G474E-EVAL_CONFIG_Exported_Constants Exported Constants 44 | * @{ 45 | */ 46 | 47 | /* COM define */ 48 | #define USE_BSP_COM_FEATURE 1U 49 | 50 | /* COM LOG define */ 51 | #define USE_COM_LOG 0U 52 | 53 | /* POT define */ 54 | #define USE_BSP_POT_FEATURE 1U 55 | 56 | /* COMP define : 57 | depends on SB8 and SB10 configuration : refer to UM */ 58 | #define USE_BSP_POT_COMP_FEATURE 0U 59 | 60 | /* IO Expander define */ 61 | #define USE_BSP_IO_CLASS 1U 62 | 63 | /* JOY define */ 64 | #define USE_BSP_JOY_FEATURE 1U 65 | 66 | /* USBPD BSP PWR TRACE define */ 67 | #define USE_BSP_PWR_TRACE 0U 68 | 69 | #if (USE_BSP_PWR_TRACE > 0u) 70 | #define USBPD_PWR_TRACE(_PORT_,...) UTIL_ADV_TRACE_FSend(__VA_ARGS__) 71 | #else 72 | #define USBPD_PWR_TRACE(_PORT_,...) 73 | #endif /* USE_BSP_PWR_TRACE */ 74 | 75 | /* IRQ priorities */ 76 | #define BSP_SRAM_IT_PRIORITY 15U 77 | #define BSP_IOEXPANDER_IT_PRIORITY 14U 78 | #define BSP_BUTTON_USER_IT_PRIORITY 15U 79 | #define BSP_AUDIO_OUT_IT_PRIORITY 13U 80 | #define BSP_AUDIO_IN_IT_PRIORITY 12U 81 | 82 | /* Audio codecs defines */ 83 | #define USE_AUDIO_CODEC_WM8994 1U 84 | 85 | /* Default Audio IN internal buffer size */ 86 | #define DEFAULT_AUDIO_IN_BUFFER_SIZE 2048U 87 | 88 | /* I2C3 Frequency in Hz */ 89 | #define BUS_I2C3_FREQUENCY 100000U /* Frequency of I2C3 = 100 kHz*/ 90 | 91 | /* SPI2 Baud rate in bps */ 92 | #define BUS_SPI2_BAUDRATE 12500000U /* baud rate of SPIn = 12.5 Mbps */ 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif /* STM32G474E_EVAL_CONF_H */ 114 | 115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | ## v2.1.0 (2021/08/09) 6 | 7 | #### Enhancements: 8 | 9 | - Add support for U5 family ([PR #249](https://github.com/ObKo/stm32-cmake/pull/249)) 10 | - Add support for WB and WL families ([PR #235](https://github.com/ObKo/stm32-cmake/pull/235)) 11 | - Add support for L5 family ([PR #172](https://github.com/ObKo/stm32-cmake/pull/172)) 12 | - Add support for new devices ([PR #165](https://github.com/ObKo/stm32-cmake/pull/165)) 13 | - Add support for CMSIS RTOS ([PR #253](https://github.com/ObKo/stm32-cmake/pull/253)) 14 | - Add support for Newlib-Nano ([Issue #179](https://github.com/ObKo/stm32-cmake/issues/179) and [Issue #208](https://github.com/ObKo/stm32-cmake/issues/208) and [Issue #213](https://github.com/ObKo/stm32-cmake/issues/213)) 15 | - Allow setting toolchain PATH through env vars ([PR #233](https://github.com/ObKo/stm32-cmake/pull/233)) 16 | - Allow setting ST repositories PATH through env vars ([PR #226](https://github.com/ObKo/stm32-cmake/pull/226) and [PR #244](https://github.com/ObKo/stm32-cmake/pull/244)) 17 | - Add function `stm32_print_devices_by_family` ([PR #205](https://github.com/ObKo/stm32-cmake/pull/205)) 18 | - Generate binary files with `.elf` extension ([PR #163](https://github.com/ObKo/stm32-cmake/pull/163) and [PR #174](https://github.com/ObKo/stm32-cmake/pull/174)) 19 | - Add functions to generate `hex` and `bin`files ([PR #221](https://github.com/ObKo/stm32-cmake/pull/221)) 20 | - Handle package version on find_package, for HAL and CMSIS ([Issue #177](https://github.com/ObKo/stm32-cmake/issues/177)) 21 | - Update ST repositories versions for fetch ([Issue #217](https://github.com/ObKo/stm32-cmake/issues/217) and [PR #255](https://github.com/ObKo/stm32-cmake/pull/255)) 22 | - Enhance continuous integration by running GitHub Actions on each PR ([PR #220](https://github.com/ObKo/stm32-cmake/pull/220)) 23 | - Add issue template to repository ([Issue #196](https://github.com/ObKo/stm32-cmake/issues/196)) 24 | - Clarify documentation for H7 and dual-core MCUs usage ([Issue #155](https://github.com/ObKo/stm32-cmake/issues/155)) 25 | - Code refactoring ([PR #161](https://github.com/ObKo/stm32-cmake/pull/161) and [PR #225](https://github.com/ObKo/stm32-cmake/pull/225)) 26 | 27 | #### Bug Fixes: 28 | 29 | - Add dependency on liker script in `stm32_add_linker_script` ([PR #192](https://github.com/ObKo/stm32-cmake/pull/192)) 30 | - Fix `find_package(BSP)` ([Issue #198](https://github.com/ObKo/stm32-cmake/issues/198)) 31 | - Fix `find_package(FreeRTOS)` ([Issue #150](https://github.com/ObKo/stm32-cmake/issues/150) and [Issue #153](https://github.com/ObKo/stm32-cmake/issues/153) and [PR #202](https://github.com/ObKo/stm32-cmake/pull/202) and [PR #260](https://github.com/ObKo/stm32-cmake/pull/260)) 32 | - Check and correct RAM and CCRAM management for all families ([Issue #164](https://github.com/ObKo/stm32-cmake/issues/164)) 33 | - Correct minimum CMake version to be 3.16 ([PR #245](https://github.com/ObKo/stm32-cmake/pull/245)) 34 | - Correct build flags ([Issue #228](https://github.com/ObKo/stm32-cmake/issues/228)) 35 | - Restore function to print binary size at build ([Issue #166](https://github.com/ObKo/stm32-cmake/issues/166) and [PR #207](https://github.com/ObKo/stm32-cmake/pull/207)) 36 | - Correct errors in README.md file ([PR #167](https://github.com/ObKo/stm32-cmake/pull/167) and [PR #175](https://github.com/ObKo/stm32-cmake/pull/175) and [PR #210](https://github.com/ObKo/stm32-cmake/pull/210)) 37 | 38 | --- 39 | 40 | ## v2.0 (2020/11/01) 41 | *Initial realease using moden cmake approach* 42 | -------------------------------------------------------------------------------- /cmake/stm32/l1.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_L1_TYPES 2 | L100xB L100xBA L100xC L151xB L151xBA L151xC L151xCA L151xD 3 | L151xDX L151xE L152xB L152xBA L152xC L152xCA L152xD L152xDX 4 | L152xE L162xC L162xCA L162xD L162xDX L162xE 5 | ) 6 | set(STM32_L1_TYPE_MATCH 7 | "L100.[68B]" "L100.[68B]A" "L100.C" "L151.[68B]" "L151.[68B]A" "L151.C" "L151.CA" "L151.D" 8 | "L151.DX" "L151.E" "L152.[68B]" "L152.[68B]A" "L152.C" "L152.CA" "L152.D" "L152.DX" 9 | "L152.E" "L162.C" "L162.CA" "L162.D" "L162.DX" "L162.E" 10 | ) 11 | set(STM32_L1_RAM_SIZES 12 | 0K 0K 16K 0K 0K 32K 32K 48K 13 | 80K 80K 0K 0K 32K 32K 48K 80K 14 | 80K 32K 32K 48K 80K 80K 15 | ) 16 | set(STM32_L1_CCRAM_SIZES 17 | 0K 0K 0K 0K 0K 0K 0K 0K 18 | 0K 0K 0K 0K 0K 0K 0K 0K 19 | 0K 0K 0K 0K 0K 0K 20 | ) 21 | 22 | stm32_util_create_family_targets(L1) 23 | 24 | target_compile_options(STM32::L1 INTERFACE 25 | -mcpu=cortex-m3 26 | ) 27 | target_link_options(STM32::L1 INTERFACE 28 | -mcpu=cortex-m3 29 | ) 30 | 31 | function(stm32l1_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) 32 | string(REGEX REPLACE "L1[0-9][0-9].([68BCDE])" "\\1" SIZE_CODE ${DEVICE}) 33 | 34 | unset(RAM) 35 | 36 | if((TYPE STREQUAL "L100xB")) 37 | if(SIZE_CODE STREQUAL "6") 38 | set(RAM "4K") 39 | elseif(SIZE_CODE STREQUAL "8") 40 | set(RAM "8K") 41 | elseif(SIZE_CODE STREQUAL "B") 42 | set(RAM "10K") 43 | endif() 44 | elseif((TYPE STREQUAL "L100xBA")) 45 | if(SIZE_CODE STREQUAL "6") 46 | set(RAM "4K") 47 | elseif(SIZE_CODE STREQUAL "8") 48 | set(RAM "8K") 49 | elseif(SIZE_CODE STREQUAL "B") 50 | set(RAM "16K") 51 | endif() 52 | elseif((TYPE STREQUAL "L151xB") OR (TYPE STREQUAL "L152xB")) 53 | if(SIZE_CODE STREQUAL "6") 54 | set(RAM "10K") 55 | elseif(SIZE_CODE STREQUAL "8") 56 | set(RAM "10K") 57 | elseif(SIZE_CODE STREQUAL "B") 58 | set(RAM "16K") 59 | endif() 60 | elseif((TYPE STREQUAL "L151xBA") OR (TYPE STREQUAL "L152xBA")) 61 | if(SIZE_CODE STREQUAL "6") 62 | set(RAM "16K") 63 | elseif(SIZE_CODE STREQUAL "8") 64 | set(RAM "32K") 65 | elseif(SIZE_CODE STREQUAL "B") 66 | set(RAM "32K") 67 | endif() 68 | endif() 69 | 70 | if(RAM) 71 | set(${RAM_SIZE} ${RAM} PARENT_SCOPE) 72 | endif() 73 | endfunction() 74 | 75 | list(APPEND STM32_ALL_DEVICES 76 | L100C6 77 | L100R8 78 | L100RB 79 | L100RC 80 | L151C6 81 | L151C8 82 | L151CB 83 | L151CC 84 | L151QC 85 | L151QD 86 | L151QE 87 | L151R6 88 | L151R8 89 | L151RB 90 | L151RC 91 | L151RD 92 | L151RE 93 | L151UC 94 | L151V8 95 | L151VB 96 | L151VC 97 | L151VD 98 | L151VE 99 | L151ZC 100 | L151ZD 101 | L151ZE 102 | L152C6 103 | L152C8 104 | L152CB 105 | L152CC 106 | L152QC 107 | L152QD 108 | L152QE 109 | L152R6 110 | L152R8 111 | L152RB 112 | L152RC 113 | L152RD 114 | L152RE 115 | L152UC 116 | L152V8 117 | L152VB 118 | L152VC 119 | L152VD 120 | L152VE 121 | L152ZC 122 | L152ZD 123 | L152ZE 124 | L162QC 125 | L162QD 126 | L162RC 127 | L162RD 128 | L162RE 129 | L162VC 130 | L162VD 131 | L162VE 132 | L162ZC 133 | L162ZD 134 | L162ZE 135 | ) 136 | 137 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 138 | STM32L1 139 | ) 140 | 141 | list(APPEND STM32_FETCH_FAMILIES L1) 142 | 143 | set(CUBE_L1_VERSION v1.10.3) 144 | set(CMSIS_L1_VERSION v2.3.2) 145 | set(HAL_L1_VERSION v1.4.4) 146 | -------------------------------------------------------------------------------- /cmake/stm32/f4.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F4_TYPES 2 | F401xC F401xE F405xx F407xx F410Cx F410Rx F410Tx F411xE 3 | F412Cx F412Rx F412Vx F412Zx F413xx F415xx F417xx F423xx 4 | F427xx F429xx F437xx F439xx F446xx F469xx F479xx 5 | ) 6 | set(STM32_F4_TYPE_MATCH 7 | "F401.[CB]" "F401.[ED]" "F405.." "F407.." "F410C." "F410R." "F410T." "F411.[CE]" 8 | "F412C." "F412R." "F412V." "F412Z." "F413.." "F415.." "F417.." "F423.." 9 | "F427.." "F429.." "F437.." "F439.." "F446.." "F469.." "F479.." 10 | ) 11 | set(STM32_F4_RAM_SIZES 12 | 64K 96K 128K 128K 32K 32K 32K 128K 13 | 256K 256K 256K 256K 320K 128K 128K 320K 14 | 192K 192K 192K 192K 128K 320K 320K 15 | ) 16 | set(STM32_F4_CCRAM_SIZES 17 | 0K 0K 64K 64K 0K 0K 0K 0K 18 | 0K 0K 0K 0K 0K 64K 64K 0K 19 | 64K 64K 64K 64K 0K 64K 64K 20 | ) 21 | 22 | stm32_util_create_family_targets(F4) 23 | 24 | target_compile_options(STM32::F4 INTERFACE 25 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 26 | ) 27 | target_link_options(STM32::F4 INTERFACE 28 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 29 | ) 30 | 31 | list(APPEND STM32_ALL_DEVICES 32 | F401CB 33 | F401CC 34 | F401CD 35 | F401CE 36 | F401RB 37 | F401RC 38 | F401RD 39 | F401RE 40 | F401VB 41 | F401VC 42 | F401VD 43 | F401VE 44 | F405OE 45 | F405OG 46 | F405RG 47 | F405VG 48 | F405ZG 49 | F407IE 50 | F407IG 51 | F407VE 52 | F407VG 53 | F407ZE 54 | F407ZG 55 | F410C8 56 | F410CB 57 | F410R8 58 | F410RB 59 | F410T8 60 | F410TB 61 | F411CC 62 | F411CE 63 | F411RC 64 | F411RE 65 | F411VC 66 | F411VE 67 | F412CE 68 | F412CG 69 | F412RE 70 | F412RG 71 | F412VE 72 | F412VG 73 | F412ZE 74 | F412ZG 75 | F413CG 76 | F413CH 77 | F413MG 78 | F413MH 79 | F413RG 80 | F413RH 81 | F413VG 82 | F413VH 83 | F413ZG 84 | F413ZH 85 | F415OG 86 | F415RG 87 | F415VG 88 | F415ZG 89 | F417IE 90 | F417IG 91 | F417VE 92 | F417VG 93 | F417ZE 94 | F417ZG 95 | F423CH 96 | F423MH 97 | F423RH 98 | F423VH 99 | F423ZH 100 | F427AG 101 | F427AI 102 | F427IG 103 | F427II 104 | F427VG 105 | F427VI 106 | F427ZG 107 | F427ZI 108 | F429AG 109 | F429AI 110 | F429BE 111 | F429BG 112 | F429BI 113 | F429IE 114 | F429IG 115 | F429II 116 | F429NE 117 | F429NG 118 | F429NI 119 | F429VE 120 | F429VG 121 | F429VI 122 | F429ZE 123 | F429ZG 124 | F429ZI 125 | F437AI 126 | F437IG 127 | F437II 128 | F437VG 129 | F437VI 130 | F437ZG 131 | F437ZI 132 | F439AI 133 | F439BG 134 | F439BI 135 | F439IG 136 | F439II 137 | F439NG 138 | F439NI 139 | F439VG 140 | F439VI 141 | F439ZG 142 | F439ZI 143 | F446MC 144 | F446ME 145 | F446RC 146 | F446RE 147 | F446VC 148 | F446VE 149 | F446ZC 150 | F446ZE 151 | F469AE 152 | F469AG 153 | F469AI 154 | F469BE 155 | F469BG 156 | F469BI 157 | F469IE 158 | F469IG 159 | F469II 160 | F469NE 161 | F469NG 162 | F469NI 163 | F469VE 164 | F469VG 165 | F469VI 166 | F469ZE 167 | F469ZG 168 | F469ZI 169 | F479AG 170 | F479AI 171 | F479BG 172 | F479BI 173 | F479IG 174 | F479II 175 | F479NG 176 | F479NI 177 | F479VG 178 | F479VI 179 | F479ZG 180 | F479ZI 181 | ) 182 | 183 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 184 | STM32F4 185 | ) 186 | 187 | list(APPEND STM32_FETCH_FAMILIES F4) 188 | 189 | set(CUBE_F4_VERSION v1.28.0) 190 | set(CMSIS_F4_VERSION v2.6.9) 191 | set(HAL_F4_VERSION v1.8.2) 192 | -------------------------------------------------------------------------------- /cmake/stm32/l4.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_L4_TYPES 2 | L412xx L422xx L431xx L432xx L433xx L442xx 3 | L443xx L451xx L452xx L462xx L471xx L475xx 4 | L476xx L485xx L486xx L496xx L4A6xx L4P5xx 5 | L4Q5xx L4R5xx L4R7xx L4R9xx L4S5xx L4S7xx 6 | L4S9xx 7 | ) 8 | set(STM32_L4_TYPE_MATCH 9 | "L412.." "L422.." "L431.." "L432.." "L433.." "L442.." 10 | "L443.." "L451.." "L452.." "L462.." "L471.." "L475.." 11 | "L476.." "L485.." "L486.." "L496.." "L4A6.." "L4P5.." 12 | "L4Q5.." "L4R5.." "L4R7.." "L4R9.." "L4S5.." "L4S7.." 13 | "L4S9.." 14 | ) 15 | 16 | set(STM32_L4_RAM_SIZES 17 | 40K 40K 64K 64K 64K 64K 18 | 64K 160K 160K 160K 96K 96K 19 | 96K 96K 96K 320K 320K 320K 20 | 320K 640K 640K 640K 640K 640K 21 | 640K 22 | ) 23 | # on devices where CCRAM is remapped to be contiguous with RAM it is included into RAM section 24 | # If you want to have dedicated section then you will need to use custom linker script 25 | set(STM32_L4_CCRAM_SIZES 26 | 0K 0K 0K 0K 0K 0K 27 | 0K 0K 0K 0K 32K 32K 28 | 32K 32K 32K 0K 0K 0K 29 | 0K 0K 0K 0K 0K 0K 30 | 0K 31 | ) 32 | 33 | stm32_util_create_family_targets(L4) 34 | 35 | target_compile_options(STM32::L4 INTERFACE 36 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 37 | ) 38 | target_link_options(STM32::L4 INTERFACE 39 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 40 | ) 41 | 42 | list(APPEND STM32_ALL_DEVICES 43 | L412C8 44 | L412CB 45 | L412K8 46 | L412KB 47 | L412R8 48 | L412RB 49 | L412T8 50 | L412TB 51 | L422CB 52 | L422KB 53 | L422RB 54 | L422TB 55 | L431CB 56 | L431CC 57 | L431KB 58 | L431KC 59 | L431RB 60 | L431RC 61 | L431VC 62 | L432KB 63 | L432KC 64 | L433CB 65 | L433CC 66 | L433RB 67 | L433RC 68 | L433VC 69 | L442KC 70 | L443CC 71 | L443RC 72 | L443VC 73 | L451CC 74 | L451CE 75 | L451RC 76 | L451RE 77 | L451VC 78 | L451VE 79 | L452CC 80 | L452CE 81 | L452RC 82 | L452RE 83 | L452VC 84 | L452VE 85 | L462CE 86 | L462RE 87 | L462VE 88 | L471QE 89 | L471QG 90 | L471RE 91 | L471RG 92 | L471VE 93 | L471VG 94 | L471ZE 95 | L471ZG 96 | L475RC 97 | L475RE 98 | L475RG 99 | L475VC 100 | L475VE 101 | L475VG 102 | L476JE 103 | L476JG 104 | L476ME 105 | L476MG 106 | L476QE 107 | L476QG 108 | L476RC 109 | L476RE 110 | L476RG 111 | L476VC 112 | L476VE 113 | L476VG 114 | L476ZE 115 | L476ZG 116 | L486JG 117 | L486QG 118 | L486RG 119 | L486VG 120 | L486ZG 121 | L496AE 122 | L496AG 123 | L496QE 124 | L496QG 125 | L496RE 126 | L496RG 127 | L496VE 128 | L496VG 129 | L496ZE 130 | L496ZG 131 | L4A6AG 132 | L4A6QG 133 | L4A6RG 134 | L4A6VG 135 | L4A6ZG 136 | L4P5AE 137 | L4P5AG 138 | L4P5CE 139 | L4P5CG 140 | L4P5QE 141 | L4P5QG 142 | L4P5RE 143 | L4P5RG 144 | L4P5VE 145 | L4P5VG 146 | L4P5ZE 147 | L4P5ZG 148 | L4Q5AG 149 | L4Q5CG 150 | L4Q5QG 151 | L4Q5RG 152 | L4Q5VG 153 | L4Q5ZG 154 | L4R5AG 155 | L4R5AI 156 | L4R5QG 157 | L4R5QI 158 | L4R5VG 159 | L4R5VI 160 | L4R5ZG 161 | L4R5ZI 162 | L4R7AI 163 | L4R7VI 164 | L4R7ZI 165 | L4R9AG 166 | L4R9AI 167 | L4R9VG 168 | L4R9VI 169 | L4R9ZG 170 | L4R9ZI 171 | L4S5AI 172 | L4S5QI 173 | L4S5VI 174 | L4S5ZI 175 | L4S7AI 176 | L4S7VI 177 | L4S7ZI 178 | L4S9AI 179 | L4S9VI 180 | L4S9ZI 181 | ) 182 | 183 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 184 | STM32L4 185 | ) 186 | 187 | list(APPEND STM32_FETCH_FAMILIES L4) 188 | 189 | set(CUBE_L4_VERSION v1.17.0) 190 | set(CMSIS_L4_VERSION v1.7.1) 191 | set(HAL_L4_VERSION v1.13.0) 192 | -------------------------------------------------------------------------------- /cmake/stm32/linker_ld.cmake: -------------------------------------------------------------------------------- 1 | if((NOT CCRAM_SIZE) OR (CCRAM_SIZE STREQUAL "0K")) 2 | set(CCRAM_DEFINITION "") 3 | set(CCRAM_SECTION "") 4 | else() 5 | set(CCRAM_DEFINITION " CCMRAM (rw) : ORIGIN = ${CCRAM_ORIGIN}, LENGTH = ${CCRAM_SIZE}\n") 6 | set(CCRAM_SECTION " 7 | _siccmram = LOADADDR(.ccmram);\n\ 8 | .ccmram :\n\ 9 | {\n\ 10 | . = ALIGN(4);\n\ 11 | _sccmram = .;\n\ 12 | *(.ccmram)\n\ 13 | *(.ccmram*)\n\ 14 | . = ALIGN(4);\n\ 15 | _eccmram = .;\n\ 16 | } >CCMRAM AT> FLASH\n\ 17 | ") 18 | endif() 19 | 20 | if((NOT RAM_SHARE_SIZE) OR (RAM_SHARE_SIZE STREQUAL "0K")) 21 | set(RAM_SHARE_DEFINITION "") 22 | set(RAM_SHARE_SECTION "") 23 | else() 24 | set(RAM_SHARE_DEFINITION " RAM_SHARED (rw) : ORIGIN = ${RAM_SHARE_ORIGIN}, LENGTH = ${RAM_SHARE_SIZE}\n") 25 | set(RAM_SHARE_SECTION " 26 | MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED\n\ 27 | MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED\n\ 28 | MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED\n\ 29 | ") 30 | endif() 31 | 32 | set(SCRIPT_TEXT 33 | "ENTRY(Reset_Handler)\n\ 34 | \n\ 35 | _estack = ${RAM_ORIGIN} + ${RAM_SIZE};\n\ 36 | _Min_Heap_Size = ${HEAP_SIZE};\n\ 37 | _Min_Stack_Size = ${STACK_SIZE};\n\ 38 | \n\ 39 | MEMORY\n\ 40 | {\n\ 41 | FLASH (rx) : ORIGIN = ${FLASH_ORIGIN}, LENGTH = ${FLASH_SIZE}\n\ 42 | RAM (xrw) : ORIGIN = ${RAM_ORIGIN}, LENGTH = ${RAM_SIZE}\n\ 43 | ${CCRAM_DEFINITION}\n\ 44 | ${RAM_SHARE_DEFINITION}\n\ 45 | }\n\ 46 | \n\ 47 | SECTIONS\n\ 48 | {\n\ 49 | .isr_vector :\n\ 50 | {\n\ 51 | . = ALIGN(4);\n\ 52 | KEEP(*(.isr_vector))\n\ 53 | . = ALIGN(4);\n\ 54 | } >FLASH\n\ 55 | \n\ 56 | .text :\n\ 57 | {\n\ 58 | . = ALIGN(4);\n\ 59 | *(.text)\n\ 60 | *(.text*)\n\ 61 | *(.glue_7)\n\ 62 | *(.glue_7t)\n\ 63 | *(.eh_frame)\n\ 64 | \n\ 65 | KEEP (*(.init))\n\ 66 | KEEP (*(.fini))\n\ 67 | \n\ 68 | . = ALIGN(4);\n\ 69 | _etext = .;\n\ 70 | } >FLASH\n\ 71 | \n\ 72 | .rodata :\n\ 73 | {\n\ 74 | . = ALIGN(4);\n\ 75 | *(.rodata)\n\ 76 | *(.rodata*)\n\ 77 | . = ALIGN(4);\n\ 78 | } >FLASH\n\ 79 | \n\ 80 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH\n\ 81 | .ARM : {\n\ 82 | __exidx_start = .;\n\ 83 | *(.ARM.exidx*)\n\ 84 | __exidx_end = .;\n\ 85 | } >FLASH\n\ 86 | \n\ 87 | .preinit_array :\n\ 88 | {\n\ 89 | PROVIDE_HIDDEN (__preinit_array_start = .);\n\ 90 | KEEP (*(.preinit_array*))\n\ 91 | PROVIDE_HIDDEN (__preinit_array_end = .);\n\ 92 | } >FLASH\n\ 93 | .init_array :\n\ 94 | {\n\ 95 | PROVIDE_HIDDEN (__init_array_start = .);\n\ 96 | KEEP (*(SORT(.init_array.*)))\n\ 97 | KEEP (*(.init_array*))\n\ 98 | PROVIDE_HIDDEN (__init_array_end = .);\n\ 99 | } >FLASH\n\ 100 | .fini_array :\n\ 101 | {\n\ 102 | PROVIDE_HIDDEN (__fini_array_start = .);\n\ 103 | KEEP (*(SORT(.fini_array.*)))\n\ 104 | KEEP (*(.fini_array*))\n\ 105 | PROVIDE_HIDDEN (__fini_array_end = .);\n\ 106 | } >FLASH\n\ 107 | \n\ 108 | _sidata = LOADADDR(.data);\n\ 109 | \n\ 110 | .data : \n\ 111 | {\n\ 112 | . = ALIGN(4);\n\ 113 | _sdata = .; \n\ 114 | *(.data)\n\ 115 | *(.data*)\n\ 116 | \n\ 117 | . = ALIGN(4);\n\ 118 | _edata = .;\n\ 119 | } >RAM AT> FLASH\n\ 120 | ${CCRAM_SECTION}\n\ 121 | . = ALIGN(4);\n\ 122 | .bss :\n\ 123 | {\n\ 124 | _sbss = .;\n\ 125 | __bss_start__ = _sbss;\n\ 126 | *(.bss)\n\ 127 | *(.bss*)\n\ 128 | *(COMMON)\n\ 129 | \n\ 130 | . = ALIGN(4);\n\ 131 | _ebss = .;\n\ 132 | __bss_end__ = _ebss;\n\ 133 | } >RAM\n\ 134 | \n\ 135 | ._user_heap_stack :\n\ 136 | {\n\ 137 | . = ALIGN(8);\n\ 138 | PROVIDE ( end = . );\n\ 139 | PROVIDE ( _end = . );\n\ 140 | . = . + _Min_Heap_Size;\n\ 141 | . = . + _Min_Stack_Size;\n\ 142 | . = ALIGN(8);\n\ 143 | } >RAM\n\ 144 | \n\ 145 | /DISCARD/ :\n\ 146 | {\n\ 147 | libc.a ( * )\n\ 148 | libm.a ( * )\n\ 149 | libgcc.a ( * )\n\ 150 | }\n\ 151 | \n\ 152 | .ARM.attributes 0 : { *(.ARM.attributes) }\n\ 153 | ${RAM_SHARE_SECTION}\n\ 154 | }" 155 | ) 156 | file(WRITE "${LINKER_SCRIPT}" "${SCRIPT_TEXT}") 157 | 158 | 159 | -------------------------------------------------------------------------------- /cmake/stm32/f1.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_F1_TYPES 2 | F100xB F100xE F101x6 F101xB F101xE F101xG F102x6 F102xB 3 | F103x6 F103xB F103xE F103xG F105xC F107xC 4 | ) 5 | set(STM32_F1_TYPE_MATCH 6 | "F100.[468B]" "F100.[CDE]" "F101.[46]" "F101.[8B]" "F101.[CDE]" "F101.[FG]" "F102.[46]" "F102.[8B]" 7 | "F103.[46]" "F103.[8B]" "F103.[CDE]" "F103.[FG]" "F105.[8BC]" "F107.[BC]" 8 | ) 9 | set(STM32_F1_RAM_SIZES 10 | 0K 0K 0K 0K 0K 0K 0K 0K 11 | 0K 0K 0K 0K 0K 0K 12 | ) 13 | set(STM32_F1_CCRAM_SIZES 14 | 0K 0K 0K 0K 0K 0K 0K 0K 15 | 0K 0K 0K 0K 0K 0K 16 | ) 17 | 18 | stm32_util_create_family_targets(F1) 19 | 20 | target_compile_options(STM32::F1 INTERFACE 21 | -mcpu=cortex-m3 22 | ) 23 | target_link_options(STM32::F1 INTERFACE 24 | -mcpu=cortex-m3 25 | ) 26 | 27 | function(stm32f1_get_memory_info DEVICE TYPE FLASH_SIZE RAM_SIZE) 28 | string(REGEX REPLACE "F1[0-9][0-9].([468BCDEFGHI])" "\\1" SIZE_CODE ${DEVICE}) 29 | 30 | if((TYPE STREQUAL "F100xB") OR (TYPE STREQUAL "F100xE")) 31 | if((SIZE_CODE STREQUAL "4") OR (SIZE_CODE STREQUAL "6")) 32 | set(RAM "4K") 33 | elseif((SIZE_CODE STREQUAL "8") OR (SIZE_CODE STREQUAL "B")) 34 | set(RAM "8K") 35 | elseif(SIZE_CODE STREQUAL "C") 36 | set(RAM "24K") 37 | elseif((SIZE_CODE STREQUAL "D") OR (SIZE_CODE STREQUAL "E")) 38 | set(RAM "32K") 39 | endif() 40 | elseif((TYPE STREQUAL "F101x6") OR (TYPE STREQUAL "F101xB") OR 41 | (TYPE STREQUAL "F101xE") OR (TYPE STREQUAL "F101xG") OR 42 | (TYPE STREQUAL "F102x6") OR (TYPE STREQUAL "F102xB")) 43 | if(SIZE_CODE STREQUAL "4") 44 | set(RAM "4K") 45 | elseif(SIZE_CODE STREQUAL "6") 46 | set(RAM "6K") 47 | elseif(SIZE_CODE STREQUAL "8") 48 | set(RAM "10K") 49 | elseif(SIZE_CODE STREQUAL "B") 50 | set(RAM "16K") 51 | elseif(SIZE_CODE STREQUAL "C") 52 | set(RAM "32K") 53 | elseif((SIZE_CODE STREQUAL "D") OR (SIZE_CODE STREQUAL "E")) 54 | set(RAM "48K") 55 | elseif((SIZE_CODE STREQUAL "F") OR (SIZE_CODE STREQUAL "G")) 56 | set(RAM "80K") 57 | endif() 58 | elseif((TYPE STREQUAL "F103x6") OR (TYPE STREQUAL "F103xB") OR 59 | (TYPE STREQUAL "F103xE") OR (TYPE STREQUAL "F103xG")) 60 | if(SIZE_CODE STREQUAL "4") 61 | set(RAM "6K") 62 | elseif(SIZE_CODE STREQUAL "6") 63 | set(RAM "10K") 64 | elseif((SIZE_CODE STREQUAL "8") OR (SIZE_CODE STREQUAL "B")) 65 | set(RAM "20K") 66 | elseif(SIZE_CODE STREQUAL "C") 67 | set(RAM "48K") 68 | elseif((SIZE_CODE STREQUAL "D") OR (SIZE_CODE STREQUAL "E")) 69 | set(RAM "64K") 70 | elseif((SIZE_CODE STREQUAL "F") OR (SIZE_CODE STREQUAL "G")) 71 | set(RAM "96K") 72 | endif() 73 | elseif((TYPE STREQUAL "F105xC") OR (TYPE STREQUAL "F107xC")) 74 | set(RAM "64K") 75 | endif() 76 | 77 | set(${RAM_SIZE} ${RAM} PARENT_SCOPE) 78 | endfunction() 79 | 80 | list(APPEND STM32_ALL_DEVICES 81 | F100C4 82 | F100C6 83 | F100C8 84 | F100CB 85 | F100R4 86 | F100R6 87 | F100R8 88 | F100RB 89 | F100RC 90 | F100RD 91 | F100RE 92 | F100V8 93 | F100VB 94 | F100VC 95 | F100VD 96 | F100VE 97 | F100ZC 98 | F100ZD 99 | F100ZE 100 | F101C4 101 | F101C6 102 | F101C8 103 | F101CB 104 | F101R4 105 | F101R6 106 | F101R8 107 | F101RB 108 | F101RC 109 | F101RD 110 | F101RE 111 | F101RF 112 | F101RG 113 | F101T4 114 | F101T6 115 | F101T8 116 | F101TB 117 | F101V8 118 | F101VB 119 | F101VC 120 | F101VD 121 | F101VE 122 | F101VF 123 | F101VG 124 | F101ZC 125 | F101ZD 126 | F101ZE 127 | F101ZF 128 | F101ZG 129 | F102C4 130 | F102C6 131 | F102C8 132 | F102CB 133 | F102R4 134 | F102R6 135 | F102R8 136 | F102RB 137 | F103C4 138 | F103C6 139 | F103C8 140 | F103CB 141 | F103R4 142 | F103R6 143 | F103R8 144 | F103RB 145 | F103RC 146 | F103RD 147 | F103RE 148 | F103RF 149 | F103RG 150 | F103T4 151 | F103T6 152 | F103T8 153 | F103TB 154 | F103V8 155 | F103VB 156 | F103VC 157 | F103VD 158 | F103VE 159 | F103VF 160 | F103VG 161 | F103ZC 162 | F103ZD 163 | F103ZE 164 | F103ZF 165 | F103ZG 166 | F105R8 167 | F105RB 168 | F105RC 169 | F105V8 170 | F105VB 171 | F105VC 172 | F107RB 173 | F107RC 174 | F107VB 175 | F107VC 176 | ) 177 | 178 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 179 | STM32F1 180 | ) 181 | 182 | list(APPEND STM32_FETCH_FAMILIES F1) 183 | 184 | set(CUBE_F1_VERSION v1.8.4) 185 | set(CMSIS_F1_VERSION v4.3.3) 186 | set(HAL_F1_VERSION v1.1.8) 187 | -------------------------------------------------------------------------------- /cmake/stm32/h7.cmake: -------------------------------------------------------------------------------- 1 | set(STM32_H7_TYPES 2 | H723xx H725xx H730xx H730xxQ H733xx H735xx 3 | H743xx H753xx H750xx H742xx H745xx H755xx H747xx H757xx 4 | H7A3xx H7A3xxQ H7B3xx H7B3xxQ H7B0xx H7B0xxQ 5 | ) 6 | set(STM32_H7_TYPE_MATCH 7 | "H723.." "H725.." "H730.." "H730..Q" "H733.." "H735.." 8 | "H743.." "H753.." "H750.." "H742.." "H745.." "H755.." "H747.." "H757.." 9 | "H7A3.." "H7A3..Q" "H7B3.." "H7B3..Q" "H7B0.." "H7B0..Q" 10 | ) 11 | set(STM32_H7_RAM_SIZES 12 | 128K 128K 128K 128K 128K 128K 13 | 128K 128K 128K 128K 128K 128K 128K 128K 14 | 128K 128K 128K 128K 128K 128K 15 | ) 16 | set(STM32_H7_M4_RAM_SIZES 17 | 0K 0K 0K 0K 0K 0K 18 | 0K 0K 0K 0K 288K 288K 288K 288K 19 | 0K 0K 0K 0K 0K 0K 20 | ) 21 | 22 | set(STM32_H7_CCRAM_SIZES 23 | 0K 0K 0K 0K 0K 0K 24 | 0K 0K 0K 0K 0K 0K 0K 0K 25 | 0K 0K 0K 0K 0K 0K 26 | ) 27 | 28 | set(STM32_H7_DUAL_CORE 29 | H745xx H755xx H747xx H757xx 30 | ) 31 | 32 | stm32_util_create_family_targets(H7 M7) 33 | 34 | target_compile_options(STM32::H7::M7 INTERFACE 35 | -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 36 | ) 37 | target_link_options(STM32::H7::M7 INTERFACE 38 | -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard 39 | ) 40 | target_compile_definitions(STM32::H7::M7 INTERFACE 41 | -DCORE_CM7 42 | ) 43 | 44 | stm32_util_create_family_targets(H7 M4) 45 | 46 | target_compile_options(STM32::H7::M4 INTERFACE 47 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 48 | ) 49 | target_link_options(STM32::H7::M4 INTERFACE 50 | -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 51 | ) 52 | target_compile_definitions(STM32::H7::M4 INTERFACE 53 | -DCORE_CM4 54 | ) 55 | 56 | function(stm32h7_get_memory_info DEVICE TYPE CORE RAM FLASH_ORIGIN RAM_ORIGIN TWO_FLASH_BANKS) 57 | if(${TYPE} IN_LIST STM32_H7_DUAL_CORE) 58 | set(${TWO_FLASH_BANKS} TRUE PARENT_SCOPE) 59 | else() 60 | set(${TWO_FLASH_BANKS} FALSE PARENT_SCOPE) 61 | endif() 62 | if(NOT CORE) 63 | set(CORE "M7") 64 | endif() 65 | list(FIND STM32_H7_TYPES ${TYPE} TYPE_INDEX) 66 | if(CORE STREQUAL "M7") 67 | list(GET STM32_H7_RAM_SIZES ${TYPE_INDEX} RAM_VALUE) 68 | set(${RAM} ${RAM_VALUE} PARENT_SCOPE) 69 | set(${FLASH_ORIGIN} 0x8000000 PARENT_SCOPE) 70 | set(${RAM_ORIGIN} 0x20000000 PARENT_SCOPE) 71 | elseif((${TYPE} IN_LIST STM32_H7_DUAL_CORE) AND (CORE STREQUAL "M4")) 72 | list(GET STM32_H7_M4_RAM_SIZES ${TYPE_INDEX} RAM_VALUE) 73 | set(${RAM} ${RAM_VALUE} PARENT_SCOPE) 74 | set(${FLASH_ORIGIN} 0x8100000 PARENT_SCOPE) 75 | set(${RAM_ORIGIN} 0x10000000 PARENT_SCOPE) 76 | else() 77 | message(FATAL_ERROR "Unknown core ${CORE}") 78 | endif() 79 | endfunction() 80 | 81 | function(stm32h7_get_device_cores DEVICE TYPE CORES) 82 | if(${TYPE} IN_LIST STM32_H7_DUAL_CORE) 83 | set(${CORES} M7 M4 PARENT_SCOPE) 84 | else() 85 | set(${CORES} M7 PARENT_SCOPE) 86 | endif() 87 | endfunction() 88 | 89 | list(APPEND STM32_ALL_DEVICES 90 | H723VE 91 | H723VG 92 | H723ZE 93 | H723ZG 94 | H725AE 95 | H725AG 96 | H725IE 97 | H725IG 98 | H725RE 99 | H725RG 100 | H725VE 101 | H725VG 102 | H725ZE 103 | H725ZG 104 | H730AB 105 | H730IB 106 | H730VB 107 | H730ZB 108 | H733VG 109 | H733ZG 110 | H735AG 111 | H735IG 112 | H735RG 113 | H735VG 114 | H735ZG 115 | H742AG 116 | H742AI 117 | H742BG 118 | H742BI 119 | H742IG 120 | H742II 121 | H742VG 122 | H742VI 123 | H742XG 124 | H742XI 125 | H742ZG 126 | H742ZI 127 | H743AG 128 | H743AI 129 | H743BG 130 | H743BI 131 | H743IG 132 | H743II 133 | H743VG 134 | H743VI 135 | H743XG 136 | H743XI 137 | H743ZG 138 | H743ZI 139 | H745BG 140 | H745BI 141 | H745IG 142 | H745II 143 | H745XG 144 | H745XI 145 | H745ZG 146 | H745ZI 147 | H747AG 148 | H747AI 149 | H747BG 150 | H747BI 151 | H747IG 152 | H747II 153 | H747XG 154 | H747XI 155 | H747ZI 156 | H750IB 157 | H750VB 158 | H750XB 159 | H750ZB 160 | H753AI 161 | H753BI 162 | H753II 163 | H753VI 164 | H753XI 165 | H753ZI 166 | H755BI 167 | H755II 168 | H755XI 169 | H755ZI 170 | H757AI 171 | H757BI 172 | H757II 173 | H757XI 174 | H757ZI 175 | H7A3AG 176 | H7A3AI 177 | H7A3IG 178 | H7A3II 179 | H7A3LG 180 | H7A3LI 181 | H7A3NG 182 | H7A3NI 183 | H7A3QI 184 | H7A3RG 185 | H7A3RI 186 | H7A3VG 187 | H7A3VI 188 | H7A3ZG 189 | H7A3ZI 190 | H7B0AB 191 | H7B0IB 192 | H7B0RB 193 | H7B0VB 194 | H7B0ZB 195 | H7B3AI 196 | H7B3II 197 | H7B3LI 198 | H7B3NI 199 | H7B3QI 200 | H7B3RI 201 | H7B3VI 202 | H7B3ZI 203 | ) 204 | 205 | list(APPEND STM32_SUPPORTED_FAMILIES_LONG_NAME 206 | STM32H7_M4 207 | STM32H7_M7 208 | ) 209 | 210 | list(APPEND STM32_FETCH_FAMILIES H7) 211 | 212 | set(CUBE_H7_VERSION v1.9.0) 213 | set(CMSIS_H7_VERSION v1.10.0) 214 | set(HAL_H7_VERSION v1.10.0) 215 | -------------------------------------------------------------------------------- /examples/freertos/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.1 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | 29 | #ifndef FREERTOS_CONFIG_H 30 | #define FREERTOS_CONFIG_H 31 | 32 | /*----------------------------------------------------------- 33 | * Application specific definitions. 34 | * 35 | * These definitions should be adjusted for your particular hardware and 36 | * application requirements. 37 | * 38 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE 39 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. 40 | * 41 | * See http://www.freertos.org/a00110.html 42 | *----------------------------------------------------------*/ 43 | 44 | #include 45 | extern uint32_t SystemCoreClock; 46 | 47 | #if defined STM32L5 48 | #define configENABLE_TRUSTZONE 0 49 | #if configENABLE_TRUSTZONE 50 | #define configMINIMAL_SECURE_STACK_SIZE ((uint16_t)1024) 51 | #endif 52 | #define configRUN_FREERTOS_SECURE_ONLY 0 53 | #define configENABLE_FPU 1 54 | #define configENABLE_MPU 0 55 | #endif 56 | 57 | #define configUSE_PREEMPTION 1 58 | #define configUSE_IDLE_HOOK 1 59 | #define configUSE_TICK_HOOK 1 60 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 61 | #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) 62 | #if !defined USE_CMSIS_RTOS_V2 63 | #define configMAX_PRIORITIES ( 5 ) 64 | #endif 65 | #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) 66 | #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2 * 1024 ) ) 67 | #define configMAX_TASK_NAME_LEN ( 10 ) 68 | #define configUSE_TRACE_FACILITY 1 69 | #define configUSE_16_BIT_TICKS 0 70 | #define configIDLE_SHOULD_YIELD 1 71 | #define configUSE_MUTEXES 1 72 | #define configQUEUE_REGISTRY_SIZE 8 73 | #define configCHECK_FOR_STACK_OVERFLOW 2 74 | #define configUSE_RECURSIVE_MUTEXES 1 75 | #define configUSE_MALLOC_FAILED_HOOK 1 76 | #define configUSE_APPLICATION_TASK_TAG 0 77 | #define configUSE_COUNTING_SEMAPHORES 1 78 | #define configGENERATE_RUN_TIME_STATS 0 79 | 80 | /* Co-routine definitions. */ 81 | #define configUSE_CO_ROUTINES 0 82 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 83 | 84 | /* Software timer definitions. */ 85 | #define configUSE_TIMERS 1 86 | #define configTIMER_TASK_PRIORITY ( 2 ) 87 | #define configTIMER_QUEUE_LENGTH 10 88 | #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) 89 | 90 | /* Set the following definitions to 1 to include the API function, or zero 91 | to exclude the API function. */ 92 | #define INCLUDE_vTaskPrioritySet 1 93 | #define INCLUDE_uxTaskPriorityGet 1 94 | #define INCLUDE_vTaskDelete 1 95 | #define INCLUDE_vTaskCleanUpResources 1 96 | #define INCLUDE_vTaskSuspend 1 97 | #define INCLUDE_vTaskDelayUntil 1 98 | #define INCLUDE_vTaskDelay 1 99 | 100 | #if defined USE_CMSIS_RTOS_V2 101 | 102 | #ifndef CMSIS_RTOS_V2_DEVICE_HEADER 103 | #error "CMSIS device header needs to be passed by the build system" 104 | #endif 105 | #define CMSIS_device_header CMSIS_RTOS_V2_DEVICE_HEADER 106 | 107 | /* Needed for CMSIS RTOS_V2 */ 108 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 109 | #define configMAX_PRIORITIES 56 110 | 111 | #define INCLUDE_xSemaphoreGetMutexHolder 1 112 | #define INCLUDE_xTaskGetCurrentTaskHandle 1 113 | #define INCLUDE_xTaskGetSchedulerState 1 114 | #define INCLUDE_uxTaskGetStackHighWaterMark 1 115 | #define INCLUDE_eTaskGetState 1 116 | #define INCLUDE_xTimerPendFunctionCall 1 117 | 118 | #endif 119 | 120 | /* Cortex-M specific definitions. */ 121 | #ifdef __NVIC_PRIO_BITS 122 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 123 | #define configPRIO_BITS __NVIC_PRIO_BITS 124 | #else 125 | #define configPRIO_BITS 4 /* 15 priority levels */ 126 | #endif 127 | 128 | /* The lowest interrupt priority that can be used in a call to a "set priority" 129 | function. */ 130 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf 131 | 132 | /* The highest interrupt priority that can be used by any interrupt service 133 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 134 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 135 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 136 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 137 | 138 | /* Interrupt priorities used by the kernel port layer itself. These are generic 139 | to all Cortex-M ports, and do not rely on any particular library functions. */ 140 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 141 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 142 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 143 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 144 | 145 | /* Normal assert() semantics without relying on the provision of an assert.h 146 | header file. */ 147 | #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } 148 | 149 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 150 | standard names. */ 151 | #define vPortSVCHandler SVC_Handler 152 | #define xPortPendSVHandler PendSV_Handler 153 | 154 | /* When using CMSIS RTOS V2, this define causes a multiple definition error */ 155 | #if !defined USE_CMSIS_RTOS_V2 156 | #define xPortSysTickHandler SysTick_Handler 157 | #endif 158 | 159 | #endif /* FREERTOS_CONFIG_H */ 160 | 161 | -------------------------------------------------------------------------------- /examples/freertos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(PROJ_NAME stm32-freertos) 3 | set(STM32_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..) 4 | 5 | # Please note: When using CMSIS, it is recommended to use the FreeRTOS version supplied in the 6 | # Cube repository because more recent kernels might be incompatible to the CMSIS 7 | # implementation provided by STM 8 | option(USE_CMSIS_RTOS "Use CMSIS RTOS provided by Cube repository" OFF) 9 | option(USE_CMSIS_RTOS_V2 "Use CMSIS RTOS_V2 provided by Cube repository" OFF) 10 | option(USE_CUBE_FREERTOS "Use the FreeRTOS kernel provided by the Cube repository" ON) 11 | 12 | if(USE_CUBE_FREERTOS) 13 | message(STATUS "Using FreeRTOS provided by Cube repository") 14 | else() 15 | message(STATUS "Using FreeRTOS from kernel repository") 16 | endif() 17 | 18 | if(USE_CMSIS_RTOS AND USE_CMSIS_RTOS_V2) 19 | message(FATAL_ERROR "Can not use USE_CMSIS_RTOS_V2 together with USE_CMSIS_RTOS!") 20 | endif() 21 | 22 | if(USE_CMSIS_RTOS) 23 | message(STATUS "Compiling CMSIS RTOS support") 24 | elseif(USE_CMSIS_RTOS_V2) 25 | message(STATUS "Compiling CMSIS RTOS V2 support") 26 | endif() 27 | 28 | # This must come before the project call! 29 | set(CMAKE_TOOLCHAIN_FILE ${STM32_CMAKE_PATH}/cmake/stm32_gcc.cmake) 30 | project(${PROJ_NAME} CXX C ASM) 31 | set(CMAKE_INCLUDE_CURRENT_DIR TRUE) 32 | 33 | # Can be used to print out all devices for the H7 or/and the F4 family 34 | # stm32_print_devices_by_family(FAMILY H7) 35 | # stm32_print_devices_by_family(FAMILY F4) 36 | set(SUPPORTED_BOARDS F100RB F407VG H743ZI L552ZE) 37 | option(FREERTOS_F100RB_EXAMPLE "Compile FreeRTOS example for the F100RB board" OFF) 38 | option(FREERTOS_F407VG_EXAMPLE "Compile FreeRTOS example for the F407VG board" OFF) 39 | option(FREERTOS_H743ZI_EXAMPLE "Compile FreeRTOS example for the H743ZI board" OFF) 40 | option(FREERTOS_L552ZE_EXAMPLE "Compile FreeRTOS example for the L552ZE board" OFF) 41 | 42 | if(NOT FREERTOS_F100RB_EXAMPLE AND NOT FREERTOS_F407VG_EXAMPLE AND NOT FREERTOS_H743ZI_EXAMPLE AND NOT FREERTOS_L552ZE_EXAMPLE) 43 | message(FATAL_ERROR 44 | "Please select at least one target to compile by passing FREERTOS__EXAMPLE=ON\n" 45 | "Supported boards: ${SUPPORTED_BOARDS}" 46 | ) 47 | endif() 48 | 49 | set(HAL_COMP_LIST RCC GPIO CORTEX) 50 | set(CMSIS_COMP_LIST "") 51 | set(FREERTOS_COMP_LIST "") 52 | set(FREERTOS_NAMESPACE FreeRTOS) 53 | 54 | if(USE_CMSIS_RTOS) 55 | list(APPEND CMSIS_COMP_LIST RTOS) 56 | endif() 57 | 58 | if(USE_CMSIS_RTOS_V2) 59 | list(APPEND CMSIS_COMP_LIST RTOS_V2) 60 | endif() 61 | 62 | if(FREERTOS_F100RB_EXAMPLE) 63 | list(APPEND CMSIS_COMP_LIST STM32F100RB) 64 | list(APPEND HAL_COMP_LIST STM32F100RB) 65 | list(APPEND FREERTOS_COMP_LIST ARM_CM3) 66 | 67 | if(USE_CUBE_FREERTOS) 68 | # The device family needs to be supplied as a component to use the Cube FreeRTOS sources 69 | list(APPEND FREERTOS_COMP_LIST STM32F1) 70 | set(FREERTOS_F1_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::F1) 71 | else() 72 | set(FREERTOS_F1_NAMESPACE ${FREERTOS_NAMESPACE}) 73 | endif() 74 | endif() 75 | 76 | if(FREERTOS_H743ZI_EXAMPLE) 77 | list(APPEND CMSIS_COMP_LIST STM32H743ZI_M7) 78 | list(APPEND HAL_COMP_LIST STM32H7M7) 79 | list(APPEND FREERTOS_COMP_LIST ARM_CM7) 80 | 81 | if(USE_CUBE_FREERTOS) 82 | # The device family needs to be supplied as a component to use the Cube FreeRTOS sources 83 | list(APPEND FREERTOS_COMP_LIST STM32H7) 84 | set(FREERTOS_H7_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::H7::M7) 85 | else() 86 | set(FREERTOS_H7_NAMESPACE ${FREERTOS_NAMESPACE}) 87 | endif() 88 | endif() 89 | 90 | if(FREERTOS_F407VG_EXAMPLE) 91 | list(APPEND CMSIS_COMP_LIST STM32F407VG) 92 | list(APPEND HAL_COMP_LIST STM32F407VG) 93 | list(APPEND FREERTOS_COMP_LIST ARM_CM4F) 94 | 95 | if(USE_CUBE_FREERTOS) 96 | # The device family needs to be supplied as a component to use the Cube FreeRTOS sources 97 | list(APPEND FREERTOS_COMP_LIST STM32F4) 98 | set(FREERTOS_F4_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::F4) 99 | else() 100 | set(FREERTOS_F4_NAMESPACE ${FREERTOS_NAMESPACE}) 101 | endif() 102 | endif() 103 | 104 | if(FREERTOS_L552ZE_EXAMPLE) 105 | list(APPEND CMSIS_COMP_LIST STM32L552ZE) 106 | list(APPEND HAL_COMP_LIST STM32L552ZE) 107 | list(APPEND FREERTOS_COMP_LIST ARM_CM33_NTZ) 108 | 109 | if(USE_CUBE_FREERTOS) 110 | # The device family needs to be supplied as a component to use the Cube FreeRTOS sources 111 | list(APPEND FREERTOS_COMP_LIST STM32L5) 112 | set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}::STM32::L5) 113 | else() 114 | set(FREERTOS_L5_NAMESPACE ${FREERTOS_NAMESPACE}) 115 | endif() 116 | endif() 117 | 118 | find_package(CMSIS COMPONENTS ${CMSIS_COMP_LIST} REQUIRED) 119 | find_package(HAL COMPONENTS ${HAL_COMP_LIST} REQUIRED) 120 | find_package(FreeRTOS COMPONENTS ${FREERTOS_COMP_LIST} REQUIRED) 121 | 122 | set(PROJECT_SOURCES 123 | main.cpp 124 | ) 125 | 126 | # This is required because FreeRTOSConfig.h, stm32hxx_hal_conf.h and main.h 127 | # need to be included 128 | set(INCLUDE_DIRS 129 | ${CMAKE_CURRENT_SOURCE_DIR} 130 | ) 131 | 132 | if(FREERTOS_F100RB_EXAMPLE) 133 | set(TARGET_NAME ${PROJ_NAME}-f100rb) 134 | add_executable(${TARGET_NAME}) 135 | 136 | target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) 137 | target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) 138 | target_link_libraries(${TARGET_NAME} PRIVATE 139 | ${FREERTOS_F1_NAMESPACE}::Timers 140 | ${FREERTOS_F1_NAMESPACE}::Heap::4 141 | ${FREERTOS_F1_NAMESPACE}::ARM_CM3 142 | HAL::STM32::F1::RCC 143 | HAL::STM32::F1::GPIO 144 | HAL::STM32::F1::CORTEX 145 | CMSIS::STM32::F100RB 146 | STM32::NoSys 147 | ) 148 | if(USE_CMSIS_RTOS) 149 | target_link_libraries(${TARGET_NAME} PRIVATE 150 | CMSIS::STM32::F1::RTOS 151 | ) 152 | endif() 153 | if(USE_CMSIS_RTOS_V2) 154 | target_link_libraries(${TARGET_NAME} PRIVATE 155 | CMSIS::STM32::F1::RTOS_V2 156 | ) 157 | target_compile_definitions(${TARGET_NAME} PRIVATE 158 | USE_CMSIS_RTOS_V2 159 | CMSIS_RTOS_V2_DEVICE_HEADER="stm32f1xx_hal.h" 160 | ) 161 | endif() 162 | 163 | stm32_print_size_of_target(${TARGET_NAME}) 164 | stm32_generate_binary_file(${TARGET_NAME}) 165 | stm32_generate_hex_file(${TARGET_NAME}) 166 | endif() 167 | 168 | if(FREERTOS_H743ZI_EXAMPLE) 169 | set(TARGET_NAME ${PROJ_NAME}-h743zi) 170 | add_executable(${TARGET_NAME}) 171 | 172 | target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) 173 | target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) 174 | target_link_libraries(${TARGET_NAME} PRIVATE 175 | ${FREERTOS_H7_NAMESPACE}::Timers 176 | ${FREERTOS_H7_NAMESPACE}::Heap::4 177 | ${FREERTOS_H7_NAMESPACE}::ARM_CM7 178 | HAL::STM32::H7::M7::RCC 179 | HAL::STM32::H7::M7::GPIO 180 | HAL::STM32::H7::M7::CORTEX 181 | CMSIS::STM32::H743ZI::M7 182 | STM32::NoSys 183 | ) 184 | 185 | if(USE_CMSIS_RTOS) 186 | target_link_libraries(${TARGET_NAME} PRIVATE 187 | CMSIS::STM32::H7::M7::RTOS 188 | ) 189 | endif() 190 | 191 | if(USE_CMSIS_RTOS_V2) 192 | target_link_libraries(${TARGET_NAME} PRIVATE 193 | CMSIS::STM32::H7::M7::RTOS_V2 194 | ) 195 | target_compile_definitions(${TARGET_NAME} PRIVATE 196 | USE_CMSIS_RTOS_V2 197 | CMSIS_RTOS_V2_DEVICE_HEADER="stm32h7xx_hal.h" 198 | ) 199 | endif() 200 | 201 | stm32_print_size_of_target(${TARGET_NAME}) 202 | stm32_generate_binary_file(${TARGET_NAME}) 203 | stm32_generate_hex_file(${TARGET_NAME}) 204 | endif() 205 | 206 | if(FREERTOS_F407VG_EXAMPLE) 207 | set(TARGET_NAME ${PROJ_NAME}-f407vg) 208 | add_executable(${TARGET_NAME}) 209 | 210 | target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) 211 | target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) 212 | target_link_libraries(${TARGET_NAME} PRIVATE 213 | ${FREERTOS_F4_NAMESPACE}::Timers 214 | ${FREERTOS_F4_NAMESPACE}::Heap::1 215 | ${FREERTOS_F4_NAMESPACE}::ARM_CM4F 216 | HAL::STM32::F4::RCC 217 | HAL::STM32::F4::GPIO 218 | HAL::STM32::F4::CORTEX 219 | CMSIS::STM32::F407VG 220 | STM32::NoSys 221 | ) 222 | 223 | if(USE_CMSIS_RTOS) 224 | target_link_libraries(${TARGET_NAME} PRIVATE 225 | CMSIS::STM32::F4::RTOS 226 | ) 227 | endif() 228 | 229 | if(USE_CMSIS_RTOS_V2) 230 | target_link_libraries(${TARGET_NAME} PRIVATE 231 | CMSIS::STM32::F4::RTOS_V2 232 | ) 233 | target_compile_definitions(${TARGET_NAME} PRIVATE 234 | USE_CMSIS_RTOS_V2 235 | CMSIS_RTOS_V2_DEVICE_HEADER="stm32f4xx_hal.h" 236 | ) 237 | endif() 238 | 239 | stm32_print_size_of_target(${TARGET_NAME}) 240 | stm32_generate_binary_file(${TARGET_NAME}) 241 | stm32_generate_hex_file(${TARGET_NAME}) 242 | endif() 243 | 244 | if(FREERTOS_L552ZE_EXAMPLE) 245 | set(TARGET_NAME ${PROJ_NAME}-l552ze) 246 | add_executable(${TARGET_NAME}) 247 | 248 | target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCES}) 249 | target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_DIRS}) 250 | target_link_libraries(${TARGET_NAME} PRIVATE 251 | ${FREERTOS_L5_NAMESPACE}::Timers 252 | ${FREERTOS_L5_NAMESPACE}::Heap::1 253 | ${FREERTOS_L5_NAMESPACE}::ARM_CM33_NTZ 254 | HAL::STM32::L5::RCC 255 | HAL::STM32::L5::GPIO 256 | HAL::STM32::L5::CORTEX 257 | CMSIS::STM32::L552ZE 258 | STM32::NoSys 259 | ) 260 | 261 | if(USE_CMSIS_RTOS) 262 | target_link_libraries(${TARGET_NAME} PRIVATE 263 | CMSIS::STM32::L5::RTOS 264 | ) 265 | endif() 266 | 267 | if(USE_CMSIS_RTOS_V2) 268 | target_link_libraries(${TARGET_NAME} PRIVATE 269 | CMSIS::STM32::L5::RTOS_V2 270 | ) 271 | target_compile_definitions(${TARGET_NAME} PRIVATE 272 | USE_CMSIS_RTOS_V2 273 | CMSIS_RTOS_V2_DEVICE_HEADER="stm32l5xx_hal.h" 274 | ) 275 | endif() 276 | 277 | stm32_print_size_of_target(${TARGET_NAME}) 278 | stm32_generate_binary_file(${TARGET_NAME}) 279 | stm32_generate_hex_file(${TARGET_NAME}) 280 | endif() 281 | -------------------------------------------------------------------------------- /cmake/stm32/devices.cmake: -------------------------------------------------------------------------------- 1 | function(stm32_util_create_family_targets FAMILY) 2 | set(CORES ${ARGN}) 3 | list(LENGTH CORES NUM_CORES) 4 | if(${NUM_CORES} EQUAL 0) 5 | set(CORE "") 6 | set(CORE_C "") 7 | elseif(${NUM_CORES} EQUAL 1) 8 | set(CORE "_${CORES}") 9 | set(CORE_C "::${CORES}") 10 | else() 11 | message(FATAL_ERROR "Expected at most one core for family ${FAMILY}: ${CORES}") 12 | endif() 13 | 14 | if(NOT (TARGET STM32::${FAMILY}${CORE_C})) 15 | add_library(STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED) 16 | # Set compiler flags for target 17 | # -Wall: all warnings activated 18 | # -ffunction-sections -fdata-sections: remove unused code 19 | target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE 20 | -mthumb -Wall -ffunction-sections -fdata-sections 21 | ) 22 | # Set linker flags 23 | # -mthumb: Generate thumb code 24 | # -Wl,--gc-sections: Remove unused code 25 | target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE 26 | -mthumb -Wl,--gc-sections 27 | ) 28 | target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE 29 | STM32${FAMILY} 30 | ) 31 | endif() 32 | foreach(TYPE ${STM32_${FAMILY}_TYPES}) 33 | if(NOT (TARGET STM32::${TYPE}${CORE_C})) 34 | add_library(STM32::${TYPE}${CORE_C} INTERFACE IMPORTED) 35 | target_link_libraries(STM32::${TYPE}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C}) 36 | target_compile_definitions(STM32::${TYPE}${CORE_C} INTERFACE 37 | STM32${TYPE} 38 | ) 39 | endif() 40 | endforeach() 41 | endfunction() 42 | 43 | set(STM32_ALL_DEVICES "") 44 | set(STM32_SUPPORTED_FAMILIES_LONG_NAME "") 45 | 46 | include(stm32/c0) 47 | include(stm32/f0) 48 | include(stm32/f1) 49 | include(stm32/f2) 50 | include(stm32/f3) 51 | include(stm32/f4) 52 | include(stm32/f7) 53 | include(stm32/g0) 54 | include(stm32/g4) 55 | include(stm32/h5) 56 | include(stm32/h7) 57 | include(stm32/l0) 58 | include(stm32/l1) 59 | include(stm32/l4) 60 | include(stm32/l5) 61 | include(stm32/u0) 62 | include(stm32/u5) 63 | include(stm32/wb) 64 | include(stm32/wl) 65 | include(stm32/mp1) 66 | 67 | 68 | # Store a list of devices into a given STM_DEVICES list. 69 | # You can also specify multiple device families. Examples: 70 | # Get list of all devices for H7 family: stm32_get_devices_by_family(STM_DEVICES FAMILY H7) 71 | # Get list of all devices: stm32_get_devices_by_family(STM_DEVICES) 72 | function(stm32_get_devices_by_family STM_DEVICES) 73 | # Specify keywords for argument parsing here 74 | set(ARG_OPTIONS "") 75 | set(ARG_SINGLE "") 76 | set(ARG_MULTIPLE FAMILY) 77 | 78 | # Parse arguments. Multiple families can be specified and will be stored in ARG_ 79 | cmake_parse_arguments(PARSE_ARGV 1 ARG "${ARG_OPTIONS}" "${ARG_SINGLE}" "${ARG_MULTIPLE}") 80 | stm32_dev_parser_check() 81 | 82 | # Build a list of families by filtering the whole list with the specified families 83 | if(ARG_FAMILY) 84 | set(RESULTING_DEV_LIST "") 85 | foreach(FAMILY ${ARG_FAMILY}) 86 | set(STM_DEVICE_LIST ${STM32_ALL_DEVICES}) 87 | list(FILTER STM_DEVICE_LIST INCLUDE REGEX "^${FAMILY}") 88 | list(APPEND RESULTING_DEV_LIST ${STM_DEVICE_LIST}) 89 | if(NOT STM_DEVICE_LIST) 90 | message(WARNING "No devices found for given family ${FAMILY}") 91 | endif() 92 | endforeach() 93 | else() 94 | # No family argument, so get list of all devices 95 | set(RESULTING_DEV_LIST ${STM32_ALL_DEVICES}) 96 | endif() 97 | 98 | set(${STM_DEVICES} ${RESULTING_DEV_LIST} PARENT_SCOPE) 99 | endfunction() 100 | 101 | # Print the devices for a given family. You can also specify multiple device families. 102 | # Example usage: 103 | # Print devices for H7 family: stm32_print_devices_by_family(FAMILY H7) 104 | # Print all devices: stm32_print_devices_by_family() 105 | function(stm32_print_devices_by_family) 106 | # Specify keywords for argument parsing here 107 | set(ARG_OPTIONS "") 108 | set(ARG_SINGLE "") 109 | set(ARG_MULTIPLE FAMILY) 110 | 111 | # Parse arguments. Multiple families can be specified and will be stored in ARG_ 112 | cmake_parse_arguments(PARSE_ARGV 0 ARG "${ARG_OPTIONS}" "${ARG_SINGLE}" "${ARG_MULTIPLE}") 113 | stm32_dev_parser_check() 114 | 115 | if(ARG_FAMILY) 116 | # print devices one family per line 117 | foreach(FAMILY ${ARG_FAMILY}) 118 | stm32_get_devices_by_family(STM_DEVICES FAMILY ${FAMILY}) 119 | stm32_pretty_print_dev_list(${FAMILY} "${STM_DEVICES}") 120 | endforeach() 121 | else() 122 | # print all devices 123 | stm32_get_devices_by_family(STM_DEVICES) 124 | stm32_pretty_print_dev_list("all" "${STM_DEVICES}") 125 | endif() 126 | 127 | endfunction() 128 | 129 | # The arguments checked in this macro are filled by cmake_parse_argument 130 | macro(stm32_dev_parser_check) 131 | # contains unexpected arguments (unknown keywords beofre ARG_MULTIPLE) 132 | if(ARG_UNPARSED_ARGUMENTS) 133 | message(WARNING "Unknown keyword(s) ${ARG_UNPARSED_ARGUMENTS} will be ignored") 134 | endif() 135 | # is populated if ARG_SINGLE or ARG_MULTIPLE is used without values 136 | if(ARG_KEYWORDS_MISSING_VALUES) 137 | message(FATAL_ERROR "Keyword ${ARG_KEYWORDS_MISSING_VALUES} expects values") 138 | endif() 139 | endmacro() 140 | 141 | # Pretty printer to limit amount of list entries printed per line 142 | macro(stm32_pretty_print_dev_list FAMILIES STM_DEVICES) 143 | if(${FAMILIES} STREQUAL "all") 144 | message(STATUS "Devices for all families") 145 | else() 146 | message(STATUS "Devices for ${FAMILIES} family") 147 | endif() 148 | set(TMP_LIST "") 149 | foreach(STM_DEVICE ${STM_DEVICES}) 150 | list(APPEND TMP_LIST ${STM_DEVICE}) 151 | list(LENGTH TMP_LIST CURR_LEN) 152 | if(CURR_LEN EQUAL 10) 153 | message(STATUS "${TMP_LIST}") 154 | set(TMP_LIST "") 155 | endif() 156 | endforeach() 157 | if(TMP_LIST) 158 | message(STATUS "${TMP_LIST}") 159 | endif() 160 | endmacro() 161 | 162 | 163 | 164 | include(FetchContent) 165 | 166 | FetchContent_Declare( 167 | STM32-CMSIS 168 | GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_core/ 169 | GIT_TAG v5.6.0 170 | GIT_PROGRESS TRUE 171 | ) 172 | 173 | foreach(FAMILY ${STM32_FETCH_FAMILIES}) 174 | string(TOLOWER ${FAMILY} FAMILY_L) 175 | 176 | FetchContent_Declare( 177 | STM32Cube${FAMILY} 178 | GIT_REPOSITORY https://github.com/STMicroelectronics/STM32Cube${FAMILY}/ 179 | GIT_TAG ${CUBE_${FAMILY}_VERSION} 180 | GIT_PROGRESS TRUE 181 | ) 182 | 183 | if(CMSIS_${FAMILY}_VERSION STREQUAL cube) 184 | set(STM32_USE_CMSIS_FROM_CUBE_${FAMILY} ON) 185 | else() 186 | FetchContent_Declare( 187 | STM32-CMSIS-${FAMILY} 188 | GIT_REPOSITORY https://github.com/STMicroelectronics/cmsis_device_${FAMILY_L}/ 189 | GIT_TAG ${CMSIS_${FAMILY}_VERSION} 190 | GIT_PROGRESS TRUE 191 | ) 192 | endif() 193 | 194 | if(HAL_${FAMILY}_VERSION STREQUAL cube) 195 | set(STM32_USE_HAL_FROM_CUBE_${FAMILY} ON) 196 | else() 197 | FetchContent_Declare( 198 | STM32-HAL-${FAMILY} 199 | GIT_REPOSITORY https://github.com/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/ 200 | GIT_TAG ${HAL_${FAMILY}_VERSION} 201 | GIT_PROGRESS TRUE 202 | ) 203 | endif() 204 | 205 | endforeach() 206 | 207 | function(stm32_fetch_cube) 208 | foreach(FAMILY ${ARGV}) 209 | set(CUBE_NAME STM32Cube${FAMILY}) 210 | string(TOLOWER ${CUBE_NAME} CUBE_NAME_L) 211 | 212 | if(STM32_CUBE_${FAMILY}_PATH) 213 | message(VERBOSE "STM32_CUBE_${FAMILY}_PATH specified, skipping fetch for ${CUBE_NAME}") 214 | continue() 215 | endif() 216 | 217 | FetchContent_MakeAvailable(${CUBE_NAME}) 218 | set(STM32_CUBE_${FAMILY}_PATH ${${CUBE_NAME_L}_SOURCE_DIR} PARENT_SCOPE) 219 | endforeach() 220 | endfunction() 221 | 222 | function(stm32_fetch_cmsis) 223 | if(NOT STM32_CMSIS_PATH) 224 | FetchContent_MakeAvailable(STM32-CMSIS) 225 | set(STM32_CMSIS_PATH ${stm32-cmsis_SOURCE_DIR} PARENT_SCOPE) 226 | else() 227 | message(INFO "STM32_CMSIS_PATH specified, skipping fetch for STM32-CMSIS") 228 | endif() 229 | 230 | foreach(FAMILY ${ARGV}) 231 | if(STM32_USE_CMSIS_FROM_CUBE_${FAMILY}) 232 | stm32_fetch_cube(${FAMILY}) 233 | message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") 234 | set(STM32_CMSIS_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx PARENT_SCOPE) 235 | else() 236 | set(CMSIS_NAME STM32-CMSIS-${FAMILY}) 237 | string(TOLOWER ${CMSIS_NAME} CMSIS_NAME_L) 238 | 239 | if(STM32_CMSIS_${FAMILY}_PATH) 240 | message(INFO "STM32_CMSIS_${FAMILY}_PATH specified, skipping fetch for ${CMSIS_NAME}") 241 | continue() 242 | endif() 243 | 244 | FetchContent_MakeAvailable(${CMSIS_NAME}) 245 | set(STM32_CMSIS_${FAMILY}_PATH ${${CMSIS_NAME_L}_SOURCE_DIR} PARENT_SCOPE) 246 | endif() 247 | endforeach() 248 | endfunction() 249 | 250 | function(stm32_fetch_hal) 251 | foreach(FAMILY ${ARGV}) 252 | if(STM32_USE_HAL_FROM_CUBE_${FAMILY}) 253 | stm32_fetch_cube(${FAMILY}) 254 | message(STATUS "Cube fetched for ${FAMILY} at ${STM32_CUBE_${FAMILY}_PATH}") 255 | set(STM32_HAL_${FAMILY}_PATH ${STM32_CUBE_${FAMILY}_PATH}/Drivers/STM32${FAMILY}xx_HAL_Driver PARENT_SCOPE) 256 | else() 257 | set(HAL_NAME STM32-HAL-${FAMILY}) 258 | string(TOLOWER ${HAL_NAME} HAL_NAME_L) 259 | 260 | if(STM32_HAL_${FAMILY}_PATH) 261 | message(INFO "STM32_HAL_${FAMILY}_PATH specified, skipping fetch for ${HAL_NAME}") 262 | continue() 263 | endif() 264 | 265 | FetchContent_MakeAvailable(${HAL_NAME}) 266 | set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE) 267 | endif() 268 | endforeach() 269 | endfunction() 270 | -------------------------------------------------------------------------------- /tests/bsp/stm32c0xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32c0xx_hal_conf.h 5 | * @author MCD Application Team 6 | * @brief HAL configuration template file. 7 | * This file should be copied to the application folder and renamed 8 | * to stm32c0xx_hal_conf.h. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2022 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | */ 21 | /* USER CODE END Header */ 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef STM32C0xx_HAL_CONF_H 24 | #define STM32C0xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | #define HAL_ADC_MODULE_ENABLED 39 | #define HAL_CRC_MODULE_ENABLED 40 | #define HAL_CRYP_MODULE_ENABLED 41 | #define HAL_I2C_MODULE_ENABLED 42 | #define HAL_I2S_MODULE_ENABLED 43 | #define HAL_IWDG_MODULE_ENABLED 44 | #define HAL_IRDA_MODULE_ENABLED 45 | #define HAL_PCD_MODULE_ENABLED 46 | #define HAL_RNG_MODULE_ENABLED 47 | #define HAL_RTC_MODULE_ENABLED 48 | #define HAL_SMARTCARD_MODULE_ENABLED 49 | #define HAL_SMBUS_MODULE_ENABLED 50 | #define HAL_SPI_MODULE_ENABLED 51 | #define HAL_TIM_MODULE_ENABLED 52 | #define HAL_UART_MODULE_ENABLED 53 | #define HAL_USART_MODULE_ENABLED 54 | #define HAL_WWDG_MODULE_ENABLED 55 | #define HAL_GPIO_MODULE_ENABLED 56 | #define HAL_EXTI_MODULE_ENABLED 57 | #define HAL_DMA_MODULE_ENABLED 58 | #define HAL_RCC_MODULE_ENABLED 59 | #define HAL_FLASH_MODULE_ENABLED 60 | #define HAL_PWR_MODULE_ENABLED 61 | #define HAL_CORTEX_MODULE_ENABLED 62 | 63 | /* ########################## Register Callbacks selection ############################## */ 64 | /** 65 | * @brief Set below the peripheral configuration to "1U" to add the support 66 | * of HAL callback registration/unregistration feature for the HAL 67 | * driver(s). This allows user application to provide specific callback 68 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 69 | * the default weak callback functions (see each stm32c0xx_hal_ppp.h file 70 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 71 | * for each PPP peripheral). 72 | */ 73 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ 74 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ 75 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ 76 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ 77 | #define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ 78 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ 79 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ 80 | #define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ 81 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ 82 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ 83 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ 84 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ 85 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ 86 | 87 | /* ########################## Oscillator Values adaptation ####################*/ 88 | /** 89 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 90 | * This value is used by the RCC HAL module to compute the system frequency 91 | * (when HSE is used as system clock source, directly or through the PLL). 92 | */ 93 | #if !defined (HSE_VALUE) 94 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 95 | #endif /* HSE_VALUE */ 96 | 97 | #if !defined (HSE_STARTUP_TIMEOUT) 98 | #define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ 99 | #endif /* HSE_STARTUP_TIMEOUT */ 100 | 101 | /** 102 | * @brief Internal High Speed oscillator (HSI) value. 103 | * This value is used by the RCC HAL module to compute the system frequency 104 | * (when HSI is used as system clock source, directly or through the PLL). 105 | */ 106 | #if !defined (HSI_VALUE) 107 | #define HSI_VALUE (48000000UL) /*!< Value of the Internal oscillator in Hz*/ 108 | #endif /* HSI_VALUE */ 109 | 110 | /** 111 | * @brief Internal Low Speed oscillator (LSI) value. 112 | */ 113 | #if !defined (LSI_VALUE) 114 | #define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ 115 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 116 | The real value may vary depending on the variations 117 | in voltage and temperature.*/ 118 | #if !defined (LSI_STARTUP_TIME) 119 | #define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ 120 | #endif /* LSI_STARTUP_TIME */ 121 | /** 122 | * @brief External Low Speed oscillator (LSE) value. 123 | * This value is used by the UART, RTC HAL module to compute the system frequency 124 | */ 125 | #if !defined (LSE_VALUE) 126 | #define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ 127 | #endif /* LSE_VALUE */ 128 | 129 | #if !defined (LSE_STARTUP_TIMEOUT) 130 | #define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ 131 | #endif /* LSE_STARTUP_TIMEOUT */ 132 | 133 | /** 134 | * @brief External clock source for I2S1 peripheral 135 | * This value is used by the RCC HAL module to compute the I2S1 clock source 136 | * frequency. 137 | */ 138 | #if !defined (EXTERNAL_I2S1_CLOCK_VALUE) 139 | #define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ 140 | #endif /* EXTERNAL_I2S1_CLOCK_VALUE */ 141 | 142 | /* Tip: To avoid modifying this file each time you need to use different HSE, 143 | === you can define the HSE value in your toolchain compiler preprocessor. */ 144 | 145 | /* ########################### System Configuration ######################### */ 146 | /** 147 | * @brief This is the HAL system configuration section 148 | */ 149 | #define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ 150 | #define TICK_INT_PRIORITY 3U /*!< tick interrupt priority */ 151 | #define USE_RTOS 0U 152 | #define PREFETCH_ENABLE 0U 153 | #define INSTRUCTION_CACHE_ENABLE 1U 154 | 155 | /* ########################## Assert Selection ############################## */ 156 | /** 157 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 158 | * HAL drivers code 159 | */ 160 | /* #define USE_FULL_ASSERT 1U */ 161 | 162 | /* Includes ------------------------------------------------------------------*/ 163 | /** 164 | * @brief Include modules header file 165 | */ 166 | 167 | #ifdef HAL_RCC_MODULE_ENABLED 168 | #include "stm32c0xx_hal_rcc.h" 169 | #endif /* HAL_RCC_MODULE_ENABLED */ 170 | 171 | #ifdef HAL_GPIO_MODULE_ENABLED 172 | #include "stm32c0xx_hal_gpio.h" 173 | #endif /* HAL_GPIO_MODULE_ENABLED */ 174 | 175 | #ifdef HAL_DMA_MODULE_ENABLED 176 | #include "stm32c0xx_hal_dma.h" 177 | #endif /* HAL_DMA_MODULE_ENABLED */ 178 | 179 | #ifdef HAL_CORTEX_MODULE_ENABLED 180 | #include "stm32c0xx_hal_cortex.h" 181 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 182 | 183 | #ifdef HAL_ADC_MODULE_ENABLED 184 | #include "stm32c0xx_hal_adc.h" 185 | #include "stm32c0xx_hal_adc_ex.h" 186 | #endif /* HAL_ADC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_CRC_MODULE_ENABLED 189 | #include "stm32c0xx_hal_crc.h" 190 | #endif /* HAL_CRC_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32c0xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_FLASH_MODULE_ENABLED 197 | #include "stm32c0xx_hal_flash.h" 198 | #endif /* HAL_FLASH_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_I2C_MODULE_ENABLED 201 | #include "stm32c0xx_hal_i2c.h" 202 | #endif /* HAL_I2C_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_I2S_MODULE_ENABLED 205 | #include "stm32c0xx_hal_i2s.h" 206 | #endif /* HAL_I2S_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_IRDA_MODULE_ENABLED 209 | #include "stm32c0xx_hal_irda.h" 210 | #endif /* HAL_IRDA_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_IWDG_MODULE_ENABLED 213 | #include "stm32c0xx_hal_iwdg.h" 214 | #endif /* HAL_IWDG_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_PWR_MODULE_ENABLED 217 | #include "stm32c0xx_hal_pwr.h" 218 | #endif /* HAL_PWR_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_RTC_MODULE_ENABLED 221 | #include "stm32c0xx_hal_rtc.h" 222 | #endif /* HAL_RTC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 225 | #include "stm32c0xx_hal_smartcard.h" 226 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SMBUS_MODULE_ENABLED 229 | #include "stm32c0xx_hal_smbus.h" 230 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_SPI_MODULE_ENABLED 233 | #include "stm32c0xx_hal_spi.h" 234 | #endif /* HAL_SPI_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_TIM_MODULE_ENABLED 237 | #include "stm32c0xx_hal_tim.h" 238 | #endif /* HAL_TIM_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_UART_MODULE_ENABLED 241 | #include "stm32c0xx_hal_uart.h" 242 | #endif /* HAL_UART_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_USART_MODULE_ENABLED 245 | #include "stm32c0xx_hal_usart.h" 246 | #endif /* HAL_USART_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_WWDG_MODULE_ENABLED 249 | #include "stm32c0xx_hal_wwdg.h" 250 | #endif /* HAL_WWDG_MODULE_ENABLED */ 251 | 252 | /* Exported macro ------------------------------------------------------------*/ 253 | #ifdef USE_FULL_ASSERT 254 | /** 255 | * @brief The assert_param macro is used for functions parameters check. 256 | * @param expr If expr is false, it calls assert_failed function 257 | * which reports the name of the source file and the source 258 | * line number of the call that failed. 259 | * If expr is true, it returns no value. 260 | * @retval None 261 | */ 262 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 263 | /* Exported functions ------------------------------------------------------- */ 264 | void assert_failed(uint8_t *file, uint32_t line); 265 | #else 266 | #define assert_param(expr) ((void)0U) 267 | #endif /* USE_FULL_ASSERT */ 268 | 269 | #ifdef __cplusplus 270 | } 271 | #endif 272 | 273 | #endif /* STM32C0xx_HAL_CONF_H */ 274 | 275 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 276 | -------------------------------------------------------------------------------- /tests/hal/stm32c0xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32c0xx_hal_conf.h 5 | * @author MCD Application Team 6 | * @brief HAL configuration template file. 7 | * This file should be copied to the application folder and renamed 8 | * to stm32c0xx_hal_conf.h. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2022 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | */ 21 | /* USER CODE END Header */ 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef STM32C0xx_HAL_CONF_H 24 | #define STM32C0xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | /* #define HAL_ADC_MODULE_ENABLED */ 39 | /* #define HAL_CRC_MODULE_ENABLED */ 40 | /* #define HAL_CRYP_MODULE_ENABLED */ 41 | /* #define HAL_I2C_MODULE_ENABLED */ 42 | /* #define HAL_I2S_MODULE_ENABLED */ 43 | /* #define HAL_IWDG_MODULE_ENABLED */ 44 | /* #define HAL_IRDA_MODULE_ENABLED */ 45 | /* #define HAL_PCD_MODULE_ENABLED */ 46 | /* #define HAL_RNG_MODULE_ENABLED */ 47 | /* #define HAL_RTC_MODULE_ENABLED */ 48 | /* #define HAL_SMARTCARD_MODULE_ENABLED */ 49 | /* #define HAL_SMBUS_MODULE_ENABLED */ 50 | /* #define HAL_SPI_MODULE_ENABLED */ 51 | /* #define HAL_TIM_MODULE_ENABLED */ 52 | /* #define HAL_UART_MODULE_ENABLED */ 53 | /* #define HAL_USART_MODULE_ENABLED */ 54 | /* #define HAL_WWDG_MODULE_ENABLED */ 55 | #define HAL_GPIO_MODULE_ENABLED 56 | #define HAL_EXTI_MODULE_ENABLED 57 | #define HAL_DMA_MODULE_ENABLED 58 | #define HAL_RCC_MODULE_ENABLED 59 | #define HAL_FLASH_MODULE_ENABLED 60 | #define HAL_PWR_MODULE_ENABLED 61 | #define HAL_CORTEX_MODULE_ENABLED 62 | 63 | /* ########################## Register Callbacks selection ############################## */ 64 | /** 65 | * @brief Set below the peripheral configuration to "1U" to add the support 66 | * of HAL callback registration/unregistration feature for the HAL 67 | * driver(s). This allows user application to provide specific callback 68 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 69 | * the default weak callback functions (see each stm32c0xx_hal_ppp.h file 70 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 71 | * for each PPP peripheral). 72 | */ 73 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ 74 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ 75 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ 76 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ 77 | #define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ 78 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ 79 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ 80 | #define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ 81 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ 82 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ 83 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ 84 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ 85 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ 86 | 87 | /* ########################## Oscillator Values adaptation ####################*/ 88 | /** 89 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 90 | * This value is used by the RCC HAL module to compute the system frequency 91 | * (when HSE is used as system clock source, directly or through the PLL). 92 | */ 93 | #if !defined (HSE_VALUE) 94 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 95 | #endif /* HSE_VALUE */ 96 | 97 | #if !defined (HSE_STARTUP_TIMEOUT) 98 | #define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ 99 | #endif /* HSE_STARTUP_TIMEOUT */ 100 | 101 | /** 102 | * @brief Internal High Speed oscillator (HSI) value. 103 | * This value is used by the RCC HAL module to compute the system frequency 104 | * (when HSI is used as system clock source, directly or through the PLL). 105 | */ 106 | #if !defined (HSI_VALUE) 107 | #define HSI_VALUE (48000000UL) /*!< Value of the Internal oscillator in Hz*/ 108 | #endif /* HSI_VALUE */ 109 | 110 | /** 111 | * @brief Internal Low Speed oscillator (LSI) value. 112 | */ 113 | #if !defined (LSI_VALUE) 114 | #define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ 115 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 116 | The real value may vary depending on the variations 117 | in voltage and temperature.*/ 118 | #if !defined (LSI_STARTUP_TIME) 119 | #define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ 120 | #endif /* LSI_STARTUP_TIME */ 121 | /** 122 | * @brief External Low Speed oscillator (LSE) value. 123 | * This value is used by the UART, RTC HAL module to compute the system frequency 124 | */ 125 | #if !defined (LSE_VALUE) 126 | #define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ 127 | #endif /* LSE_VALUE */ 128 | 129 | #if !defined (LSE_STARTUP_TIMEOUT) 130 | #define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ 131 | #endif /* LSE_STARTUP_TIMEOUT */ 132 | 133 | /** 134 | * @brief External clock source for I2S1 peripheral 135 | * This value is used by the RCC HAL module to compute the I2S1 clock source 136 | * frequency. 137 | */ 138 | #if !defined (EXTERNAL_I2S1_CLOCK_VALUE) 139 | #define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ 140 | #endif /* EXTERNAL_I2S1_CLOCK_VALUE */ 141 | 142 | /* Tip: To avoid modifying this file each time you need to use different HSE, 143 | === you can define the HSE value in your toolchain compiler preprocessor. */ 144 | 145 | /* ########################### System Configuration ######################### */ 146 | /** 147 | * @brief This is the HAL system configuration section 148 | */ 149 | #define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ 150 | #define TICK_INT_PRIORITY 3U /*!< tick interrupt priority */ 151 | #define USE_RTOS 0U 152 | #define PREFETCH_ENABLE 0U 153 | #define INSTRUCTION_CACHE_ENABLE 1U 154 | 155 | /* ########################## Assert Selection ############################## */ 156 | /** 157 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 158 | * HAL drivers code 159 | */ 160 | /* #define USE_FULL_ASSERT 1U */ 161 | 162 | /* Includes ------------------------------------------------------------------*/ 163 | /** 164 | * @brief Include modules header file 165 | */ 166 | 167 | #ifdef HAL_RCC_MODULE_ENABLED 168 | #include "stm32c0xx_hal_rcc.h" 169 | #endif /* HAL_RCC_MODULE_ENABLED */ 170 | 171 | #ifdef HAL_GPIO_MODULE_ENABLED 172 | #include "stm32c0xx_hal_gpio.h" 173 | #endif /* HAL_GPIO_MODULE_ENABLED */ 174 | 175 | #ifdef HAL_DMA_MODULE_ENABLED 176 | #include "stm32c0xx_hal_dma.h" 177 | #endif /* HAL_DMA_MODULE_ENABLED */ 178 | 179 | #ifdef HAL_CORTEX_MODULE_ENABLED 180 | #include "stm32c0xx_hal_cortex.h" 181 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 182 | 183 | #ifdef HAL_ADC_MODULE_ENABLED 184 | #include "stm32c0xx_hal_adc.h" 185 | #include "stm32c0xx_hal_adc_ex.h" 186 | #endif /* HAL_ADC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_CRC_MODULE_ENABLED 189 | #include "stm32c0xx_hal_crc.h" 190 | #endif /* HAL_CRC_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32c0xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_FLASH_MODULE_ENABLED 197 | #include "stm32c0xx_hal_flash.h" 198 | #endif /* HAL_FLASH_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_I2C_MODULE_ENABLED 201 | #include "stm32c0xx_hal_i2c.h" 202 | #endif /* HAL_I2C_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_I2S_MODULE_ENABLED 205 | #include "stm32c0xx_hal_i2s.h" 206 | #endif /* HAL_I2S_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_IRDA_MODULE_ENABLED 209 | #include "stm32c0xx_hal_irda.h" 210 | #endif /* HAL_IRDA_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_IWDG_MODULE_ENABLED 213 | #include "stm32c0xx_hal_iwdg.h" 214 | #endif /* HAL_IWDG_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_PWR_MODULE_ENABLED 217 | #include "stm32c0xx_hal_pwr.h" 218 | #endif /* HAL_PWR_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_RTC_MODULE_ENABLED 221 | #include "stm32c0xx_hal_rtc.h" 222 | #endif /* HAL_RTC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 225 | #include "stm32c0xx_hal_smartcard.h" 226 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SMBUS_MODULE_ENABLED 229 | #include "stm32c0xx_hal_smbus.h" 230 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_SPI_MODULE_ENABLED 233 | #include "stm32c0xx_hal_spi.h" 234 | #endif /* HAL_SPI_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_TIM_MODULE_ENABLED 237 | #include "stm32c0xx_hal_tim.h" 238 | #endif /* HAL_TIM_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_UART_MODULE_ENABLED 241 | #include "stm32c0xx_hal_uart.h" 242 | #endif /* HAL_UART_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_USART_MODULE_ENABLED 245 | #include "stm32c0xx_hal_usart.h" 246 | #endif /* HAL_USART_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_WWDG_MODULE_ENABLED 249 | #include "stm32c0xx_hal_wwdg.h" 250 | #endif /* HAL_WWDG_MODULE_ENABLED */ 251 | 252 | /* Exported macro ------------------------------------------------------------*/ 253 | #ifdef USE_FULL_ASSERT 254 | /** 255 | * @brief The assert_param macro is used for functions parameters check. 256 | * @param expr If expr is false, it calls assert_failed function 257 | * which reports the name of the source file and the source 258 | * line number of the call that failed. 259 | * If expr is true, it returns no value. 260 | * @retval None 261 | */ 262 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 263 | /* Exported functions ------------------------------------------------------- */ 264 | void assert_failed(uint8_t *file, uint32_t line); 265 | #else 266 | #define assert_param(expr) ((void)0U) 267 | #endif /* USE_FULL_ASSERT */ 268 | 269 | #ifdef __cplusplus 270 | } 271 | #endif 272 | 273 | #endif /* STM32C0xx_HAL_CONF_H */ 274 | 275 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 276 | -------------------------------------------------------------------------------- /tests/fetch/stm32c0xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32c0xx_hal_conf.h 5 | * @author MCD Application Team 6 | * @brief HAL configuration template file. 7 | * This file should be copied to the application folder and renamed 8 | * to stm32c0xx_hal_conf.h. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2022 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | */ 21 | /* USER CODE END Header */ 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef STM32C0xx_HAL_CONF_H 24 | #define STM32C0xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | /* #define HAL_ADC_MODULE_ENABLED */ 39 | /* #define HAL_CRC_MODULE_ENABLED */ 40 | /* #define HAL_CRYP_MODULE_ENABLED */ 41 | /* #define HAL_I2C_MODULE_ENABLED */ 42 | /* #define HAL_I2S_MODULE_ENABLED */ 43 | /* #define HAL_IWDG_MODULE_ENABLED */ 44 | /* #define HAL_IRDA_MODULE_ENABLED */ 45 | /* #define HAL_PCD_MODULE_ENABLED */ 46 | /* #define HAL_RNG_MODULE_ENABLED */ 47 | /* #define HAL_RTC_MODULE_ENABLED */ 48 | /* #define HAL_SMARTCARD_MODULE_ENABLED */ 49 | /* #define HAL_SMBUS_MODULE_ENABLED */ 50 | /* #define HAL_SPI_MODULE_ENABLED */ 51 | /* #define HAL_TIM_MODULE_ENABLED */ 52 | /* #define HAL_UART_MODULE_ENABLED */ 53 | /* #define HAL_USART_MODULE_ENABLED */ 54 | /* #define HAL_WWDG_MODULE_ENABLED */ 55 | #define HAL_GPIO_MODULE_ENABLED 56 | #define HAL_EXTI_MODULE_ENABLED 57 | #define HAL_DMA_MODULE_ENABLED 58 | #define HAL_RCC_MODULE_ENABLED 59 | #define HAL_FLASH_MODULE_ENABLED 60 | #define HAL_PWR_MODULE_ENABLED 61 | #define HAL_CORTEX_MODULE_ENABLED 62 | 63 | /* ########################## Register Callbacks selection ############################## */ 64 | /** 65 | * @brief Set below the peripheral configuration to "1U" to add the support 66 | * of HAL callback registration/unregistration feature for the HAL 67 | * driver(s). This allows user application to provide specific callback 68 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 69 | * the default weak callback functions (see each stm32c0xx_hal_ppp.h file 70 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 71 | * for each PPP peripheral). 72 | */ 73 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ 74 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ 75 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ 76 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ 77 | #define USE_HAL_IWDG_REGISTER_CALLBACKS 0U /* IWDG register callback disabled */ 78 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ 79 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ 80 | #define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ 81 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ 82 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ 83 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ 84 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ 85 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ 86 | 87 | /* ########################## Oscillator Values adaptation ####################*/ 88 | /** 89 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 90 | * This value is used by the RCC HAL module to compute the system frequency 91 | * (when HSE is used as system clock source, directly or through the PLL). 92 | */ 93 | #if !defined (HSE_VALUE) 94 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 95 | #endif /* HSE_VALUE */ 96 | 97 | #if !defined (HSE_STARTUP_TIMEOUT) 98 | #define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */ 99 | #endif /* HSE_STARTUP_TIMEOUT */ 100 | 101 | /** 102 | * @brief Internal High Speed oscillator (HSI) value. 103 | * This value is used by the RCC HAL module to compute the system frequency 104 | * (when HSI is used as system clock source, directly or through the PLL). 105 | */ 106 | #if !defined (HSI_VALUE) 107 | #define HSI_VALUE (48000000UL) /*!< Value of the Internal oscillator in Hz*/ 108 | #endif /* HSI_VALUE */ 109 | 110 | /** 111 | * @brief Internal Low Speed oscillator (LSI) value. 112 | */ 113 | #if !defined (LSI_VALUE) 114 | #define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/ 115 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 116 | The real value may vary depending on the variations 117 | in voltage and temperature.*/ 118 | #if !defined (LSI_STARTUP_TIME) 119 | #define LSI_STARTUP_TIME 130UL /*!< Time out for LSI start up, in ms */ 120 | #endif /* LSI_STARTUP_TIME */ 121 | /** 122 | * @brief External Low Speed oscillator (LSE) value. 123 | * This value is used by the UART, RTC HAL module to compute the system frequency 124 | */ 125 | #if !defined (LSE_VALUE) 126 | #define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/ 127 | #endif /* LSE_VALUE */ 128 | 129 | #if !defined (LSE_STARTUP_TIMEOUT) 130 | #define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */ 131 | #endif /* LSE_STARTUP_TIMEOUT */ 132 | 133 | /** 134 | * @brief External clock source for I2S1 peripheral 135 | * This value is used by the RCC HAL module to compute the I2S1 clock source 136 | * frequency. 137 | */ 138 | #if !defined (EXTERNAL_I2S1_CLOCK_VALUE) 139 | #define EXTERNAL_I2S1_CLOCK_VALUE (12288000UL) /*!< Value of the I2S1 External clock source in Hz*/ 140 | #endif /* EXTERNAL_I2S1_CLOCK_VALUE */ 141 | 142 | /* Tip: To avoid modifying this file each time you need to use different HSE, 143 | === you can define the HSE value in your toolchain compiler preprocessor. */ 144 | 145 | /* ########################### System Configuration ######################### */ 146 | /** 147 | * @brief This is the HAL system configuration section 148 | */ 149 | #define VDD_VALUE (3300UL) /*!< Value of VDD in mv */ 150 | #define TICK_INT_PRIORITY 3U /*!< tick interrupt priority */ 151 | #define USE_RTOS 0U 152 | #define PREFETCH_ENABLE 0U 153 | #define INSTRUCTION_CACHE_ENABLE 1U 154 | 155 | /* ########################## Assert Selection ############################## */ 156 | /** 157 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 158 | * HAL drivers code 159 | */ 160 | /* #define USE_FULL_ASSERT 1U */ 161 | 162 | /* Includes ------------------------------------------------------------------*/ 163 | /** 164 | * @brief Include modules header file 165 | */ 166 | 167 | #ifdef HAL_RCC_MODULE_ENABLED 168 | #include "stm32c0xx_hal_rcc.h" 169 | #endif /* HAL_RCC_MODULE_ENABLED */ 170 | 171 | #ifdef HAL_GPIO_MODULE_ENABLED 172 | #include "stm32c0xx_hal_gpio.h" 173 | #endif /* HAL_GPIO_MODULE_ENABLED */ 174 | 175 | #ifdef HAL_DMA_MODULE_ENABLED 176 | #include "stm32c0xx_hal_dma.h" 177 | #endif /* HAL_DMA_MODULE_ENABLED */ 178 | 179 | #ifdef HAL_CORTEX_MODULE_ENABLED 180 | #include "stm32c0xx_hal_cortex.h" 181 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 182 | 183 | #ifdef HAL_ADC_MODULE_ENABLED 184 | #include "stm32c0xx_hal_adc.h" 185 | #include "stm32c0xx_hal_adc_ex.h" 186 | #endif /* HAL_ADC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_CRC_MODULE_ENABLED 189 | #include "stm32c0xx_hal_crc.h" 190 | #endif /* HAL_CRC_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32c0xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_FLASH_MODULE_ENABLED 197 | #include "stm32c0xx_hal_flash.h" 198 | #endif /* HAL_FLASH_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_I2C_MODULE_ENABLED 201 | #include "stm32c0xx_hal_i2c.h" 202 | #endif /* HAL_I2C_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_I2S_MODULE_ENABLED 205 | #include "stm32c0xx_hal_i2s.h" 206 | #endif /* HAL_I2S_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_IRDA_MODULE_ENABLED 209 | #include "stm32c0xx_hal_irda.h" 210 | #endif /* HAL_IRDA_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_IWDG_MODULE_ENABLED 213 | #include "stm32c0xx_hal_iwdg.h" 214 | #endif /* HAL_IWDG_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_PWR_MODULE_ENABLED 217 | #include "stm32c0xx_hal_pwr.h" 218 | #endif /* HAL_PWR_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_RTC_MODULE_ENABLED 221 | #include "stm32c0xx_hal_rtc.h" 222 | #endif /* HAL_RTC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 225 | #include "stm32c0xx_hal_smartcard.h" 226 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SMBUS_MODULE_ENABLED 229 | #include "stm32c0xx_hal_smbus.h" 230 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_SPI_MODULE_ENABLED 233 | #include "stm32c0xx_hal_spi.h" 234 | #endif /* HAL_SPI_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_TIM_MODULE_ENABLED 237 | #include "stm32c0xx_hal_tim.h" 238 | #endif /* HAL_TIM_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_UART_MODULE_ENABLED 241 | #include "stm32c0xx_hal_uart.h" 242 | #endif /* HAL_UART_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_USART_MODULE_ENABLED 245 | #include "stm32c0xx_hal_usart.h" 246 | #endif /* HAL_USART_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_WWDG_MODULE_ENABLED 249 | #include "stm32c0xx_hal_wwdg.h" 250 | #endif /* HAL_WWDG_MODULE_ENABLED */ 251 | 252 | /* Exported macro ------------------------------------------------------------*/ 253 | #ifdef USE_FULL_ASSERT 254 | /** 255 | * @brief The assert_param macro is used for functions parameters check. 256 | * @param expr If expr is false, it calls assert_failed function 257 | * which reports the name of the source file and the source 258 | * line number of the call that failed. 259 | * If expr is true, it returns no value. 260 | * @retval None 261 | */ 262 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 263 | /* Exported functions ------------------------------------------------------- */ 264 | void assert_failed(uint8_t *file, uint32_t line); 265 | #else 266 | #define assert_param(expr) ((void)0U) 267 | #endif /* USE_FULL_ASSERT */ 268 | 269 | #ifdef __cplusplus 270 | } 271 | #endif 272 | 273 | #endif /* STM32C0xx_HAL_CONF_H */ 274 | 275 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 276 | -------------------------------------------------------------------------------- /tests/bsp/stm32l1xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l1xx_hal_conf.h 4 | * @author MCD Application Team 5 | * @brief HAL configuration template file. 6 | * This file should be copied to the application folder and renamed 7 | * to stm32l1xx_hal_conf.h. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

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

13 | * 14 | * This software component is licensed by ST under BSD 3-Clause license, 15 | * the "License"; You may not use this file except in compliance with the 16 | * License. You may obtain a copy of the License at: 17 | * opensource.org/licenses/BSD-3-Clause 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32L1xx_HAL_CONF_H 24 | #define __STM32L1xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | #define HAL_ADC_MODULE_ENABLED 39 | #define HAL_COMP_MODULE_ENABLED 40 | #define HAL_CORTEX_MODULE_ENABLED 41 | #define HAL_CRC_MODULE_ENABLED 42 | #define HAL_CRYP_MODULE_ENABLED 43 | #define HAL_DAC_MODULE_ENABLED 44 | #define HAL_DMA_MODULE_ENABLED 45 | #define HAL_FLASH_MODULE_ENABLED 46 | #define HAL_GPIO_MODULE_ENABLED 47 | #define HAL_EXTI_MODULE_ENABLED 48 | #define HAL_I2C_MODULE_ENABLED 49 | #define HAL_I2S_MODULE_ENABLED 50 | #define HAL_IRDA_MODULE_ENABLED 51 | #define HAL_IWDG_MODULE_ENABLED 52 | #define HAL_LCD_MODULE_ENABLED 53 | #define HAL_NOR_MODULE_ENABLED 54 | #define HAL_OPAMP_MODULE_ENABLED 55 | #define HAL_PCD_MODULE_ENABLED 56 | #define HAL_PWR_MODULE_ENABLED 57 | #define HAL_RCC_MODULE_ENABLED 58 | #define HAL_RTC_MODULE_ENABLED 59 | #define HAL_SD_MODULE_ENABLED 60 | #define HAL_SMARTCARD_MODULE_ENABLED 61 | #define HAL_SPI_MODULE_ENABLED 62 | #define HAL_SRAM_MODULE_ENABLED 63 | #define HAL_TIM_MODULE_ENABLED 64 | #define HAL_UART_MODULE_ENABLED 65 | #define HAL_USART_MODULE_ENABLED 66 | #define HAL_WWDG_MODULE_ENABLED 67 | 68 | /* ########################## Oscillator Values adaptation ####################*/ 69 | /** 70 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 71 | * This value is used by the RCC HAL module to compute the system frequency 72 | * (when HSE is used as system clock source, directly or through the PLL). 73 | */ 74 | #if !defined (HSE_VALUE) 75 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 76 | #endif /* HSE_VALUE */ 77 | 78 | #if !defined (HSE_STARTUP_TIMEOUT) 79 | #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */ 80 | #endif /* HSE_STARTUP_TIMEOUT */ 81 | 82 | /** 83 | * @brief Internal Multiple Speed oscillator (MSI) default value. 84 | * This value is the default MSI range value after Reset. 85 | */ 86 | #if !defined (MSI_VALUE) 87 | #define MSI_VALUE (2097000U) /*!< Value of the Internal oscillator in Hz*/ 88 | #endif /* MSI_VALUE */ 89 | /** 90 | * @brief Internal High Speed oscillator (HSI) value. 91 | * This value is used by the RCC HAL module to compute the system frequency 92 | * (when HSI is used as system clock source, directly or through the PLL). 93 | */ 94 | #if !defined (HSI_VALUE) 95 | #define HSI_VALUE (16000000U) /*!< Value of the Internal oscillator in Hz*/ 96 | #endif /* HSI_VALUE */ 97 | 98 | /** 99 | * @brief Internal Low Speed oscillator (LSI) value. 100 | */ 101 | #if !defined (LSI_VALUE) 102 | #define LSI_VALUE (37000U) /*!< LSI Typical Value in Hz*/ 103 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 104 | The real value may vary depending on the variations 105 | in voltage and temperature.*/ 106 | 107 | /** 108 | * @brief External Low Speed oscillator (LSE) value. 109 | */ 110 | #if !defined (LSE_VALUE) 111 | #define LSE_VALUE (32768U) /*!< Value of the External Low Speed oscillator in Hz*/ 112 | #endif /* LSE_VALUE */ 113 | 114 | /** 115 | * @brief Time out for LSE start up value in ms. 116 | */ 117 | #if !defined (LSE_STARTUP_TIMEOUT) 118 | #define LSE_STARTUP_TIMEOUT (5000U) /*!< Time out for LSE start up, in ms */ 119 | #endif /* LSE_STARTUP_TIMEOUT */ 120 | 121 | 122 | /* Tip: To avoid modifying this file each time you need to use different HSE, 123 | === you can define the HSE value in your toolchain compiler preprocessor. */ 124 | 125 | /* ########################### System Configuration ######################### */ 126 | /** 127 | * @brief This is the HAL system configuration section 128 | */ 129 | #define VDD_VALUE (3300U) /*!< Value of VDD in mv */ 130 | #define TICK_INT_PRIORITY (0x000FU) /*!< tick interrupt priority */ 131 | #define USE_RTOS 0U 132 | #define PREFETCH_ENABLE 1U 133 | #define INSTRUCTION_CACHE_ENABLE 0U 134 | #define DATA_CACHE_ENABLE 0U 135 | 136 | /* ########################## Assert Selection ############################## */ 137 | /** 138 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 139 | * HAL drivers code 140 | */ 141 | /*#define USE_FULL_ASSERT 1U*/ 142 | 143 | /* ################## Register callback feature configuration ############### */ 144 | /** 145 | * @brief Set below the peripheral configuration to "1U" to add the support 146 | * of HAL callback registration/deregistration feature for the HAL 147 | * driver(s). This allows user application to provide specific callback 148 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 149 | * the default weak callback functions (see each stm32l0xx_hal_ppp.h file 150 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 151 | * for each PPP peripheral). 152 | */ 153 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U 154 | #define USE_HAL_COMP_REGISTER_CALLBACKS 0U 155 | #define USE_HAL_DAC_REGISTER_CALLBACKS 0U 156 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U 157 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U 158 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U 159 | #define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U 160 | #define USE_HAL_PCD_REGISTER_CALLBACKS 0U 161 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U 162 | #define USE_HAL_SDMMC_REGISTER_CALLBACKS 0U 163 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U 164 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U 165 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U 166 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U 167 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U 168 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U 169 | 170 | /* ################## SPI peripheral configuration ########################## */ 171 | 172 | /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver 173 | * Activated: CRC code is present inside driver 174 | * Deactivated: CRC code cleaned from driver 175 | */ 176 | 177 | #define USE_SPI_CRC 1U 178 | 179 | /* Includes ------------------------------------------------------------------*/ 180 | /** 181 | * @brief Include module's header file 182 | */ 183 | 184 | #ifdef HAL_RCC_MODULE_ENABLED 185 | #include "stm32l1xx_hal_rcc.h" 186 | #endif /* HAL_RCC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_GPIO_MODULE_ENABLED 189 | #include "stm32l1xx_hal_gpio.h" 190 | #endif /* HAL_GPIO_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32l1xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_DMA_MODULE_ENABLED 197 | #include "stm32l1xx_hal_dma.h" 198 | #endif /* HAL_DMA_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_CORTEX_MODULE_ENABLED 201 | #include "stm32l1xx_hal_cortex.h" 202 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_ADC_MODULE_ENABLED 205 | #include "stm32l1xx_hal_adc.h" 206 | #endif /* HAL_ADC_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_COMP_MODULE_ENABLED 209 | #include "stm32l1xx_hal_comp.h" 210 | #endif /* HAL_COMP_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_CRC_MODULE_ENABLED 213 | #include "stm32l1xx_hal_crc.h" 214 | #endif /* HAL_CRC_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_CRYP_MODULE_ENABLED 217 | #include "stm32l1xx_hal_cryp.h" 218 | #endif /* HAL_CRYP_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_DAC_MODULE_ENABLED 221 | #include "stm32l1xx_hal_dac.h" 222 | #endif /* HAL_DAC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_FLASH_MODULE_ENABLED 225 | #include "stm32l1xx_hal_flash.h" 226 | #endif /* HAL_FLASH_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SRAM_MODULE_ENABLED 229 | #include "stm32l1xx_hal_sram.h" 230 | #endif /* HAL_SRAM_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_NOR_MODULE_ENABLED 233 | #include "stm32l1xx_hal_nor.h" 234 | #endif /* HAL_NOR_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_I2C_MODULE_ENABLED 237 | #include "stm32l1xx_hal_i2c.h" 238 | #endif /* HAL_I2C_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_I2S_MODULE_ENABLED 241 | #include "stm32l1xx_hal_i2s.h" 242 | #endif /* HAL_I2S_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_IWDG_MODULE_ENABLED 245 | #include "stm32l1xx_hal_iwdg.h" 246 | #endif /* HAL_IWDG_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_LCD_MODULE_ENABLED 249 | #include "stm32l1xx_hal_lcd.h" 250 | #endif /* HAL_LCD_MODULE_ENABLED */ 251 | 252 | #ifdef HAL_OPAMP_MODULE_ENABLED 253 | #include "stm32l1xx_hal_opamp.h" 254 | #endif /* HAL_OPAMP_MODULE_ENABLED */ 255 | 256 | #ifdef HAL_PWR_MODULE_ENABLED 257 | #include "stm32l1xx_hal_pwr.h" 258 | #endif /* HAL_PWR_MODULE_ENABLED */ 259 | 260 | #ifdef HAL_RTC_MODULE_ENABLED 261 | #include "stm32l1xx_hal_rtc.h" 262 | #endif /* HAL_RTC_MODULE_ENABLED */ 263 | 264 | #ifdef HAL_SD_MODULE_ENABLED 265 | #include "stm32l1xx_hal_sd.h" 266 | #endif /* HAL_SD_MODULE_ENABLED */ 267 | 268 | #ifdef HAL_SPI_MODULE_ENABLED 269 | #include "stm32l1xx_hal_spi.h" 270 | #endif /* HAL_SPI_MODULE_ENABLED */ 271 | 272 | #ifdef HAL_TIM_MODULE_ENABLED 273 | #include "stm32l1xx_hal_tim.h" 274 | #endif /* HAL_TIM_MODULE_ENABLED */ 275 | 276 | #ifdef HAL_UART_MODULE_ENABLED 277 | #include "stm32l1xx_hal_uart.h" 278 | #endif /* HAL_UART_MODULE_ENABLED */ 279 | 280 | #ifdef HAL_USART_MODULE_ENABLED 281 | #include "stm32l1xx_hal_usart.h" 282 | #endif /* HAL_USART_MODULE_ENABLED */ 283 | 284 | #ifdef HAL_IRDA_MODULE_ENABLED 285 | #include "stm32l1xx_hal_irda.h" 286 | #endif /* HAL_IRDA_MODULE_ENABLED */ 287 | 288 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 289 | #include "stm32l1xx_hal_smartcard.h" 290 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 291 | 292 | #ifdef HAL_WWDG_MODULE_ENABLED 293 | #include "stm32l1xx_hal_wwdg.h" 294 | #endif /* HAL_WWDG_MODULE_ENABLED */ 295 | 296 | #ifdef HAL_PCD_MODULE_ENABLED 297 | #include "stm32l1xx_hal_pcd.h" 298 | #endif /* HAL_PCD_MODULE_ENABLED */ 299 | 300 | /* Exported macro ------------------------------------------------------------*/ 301 | #ifdef USE_FULL_ASSERT 302 | /** 303 | * @brief The assert_param macro is used for function's parameters check. 304 | * @param expr If expr is false, it calls assert_failed function 305 | * which reports the name of the source file and the source 306 | * line number of the call that failed. 307 | * If expr is true, it returns no value. 308 | * @retval None 309 | */ 310 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 311 | /* Exported functions ------------------------------------------------------- */ 312 | void assert_failed(uint8_t* file, uint32_t line); 313 | #else 314 | #define assert_param(expr) ((void)0U) 315 | #endif /* USE_FULL_ASSERT */ 316 | 317 | #ifdef __cplusplus 318 | } 319 | #endif 320 | 321 | #endif /* __STM32L1xx_HAL_CONF_H */ 322 | 323 | 324 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 325 | -------------------------------------------------------------------------------- /tests/hal/stm32l1xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l1xx_hal_conf.h 4 | * @author MCD Application Team 5 | * @brief HAL configuration template file. 6 | * This file should be copied to the application folder and renamed 7 | * to stm32l1xx_hal_conf.h. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

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

13 | * 14 | * This software component is licensed by ST under BSD 3-Clause license, 15 | * the "License"; You may not use this file except in compliance with the 16 | * License. You may obtain a copy of the License at: 17 | * opensource.org/licenses/BSD-3-Clause 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32L1xx_HAL_CONF_H 24 | #define __STM32L1xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | #define HAL_ADC_MODULE_ENABLED 39 | #define HAL_COMP_MODULE_ENABLED 40 | #define HAL_CORTEX_MODULE_ENABLED 41 | #define HAL_CRC_MODULE_ENABLED 42 | #define HAL_CRYP_MODULE_ENABLED 43 | #define HAL_DAC_MODULE_ENABLED 44 | #define HAL_DMA_MODULE_ENABLED 45 | #define HAL_FLASH_MODULE_ENABLED 46 | #define HAL_GPIO_MODULE_ENABLED 47 | #define HAL_EXTI_MODULE_ENABLED 48 | #define HAL_I2C_MODULE_ENABLED 49 | #define HAL_I2S_MODULE_ENABLED 50 | #define HAL_IRDA_MODULE_ENABLED 51 | #define HAL_IWDG_MODULE_ENABLED 52 | #define HAL_LCD_MODULE_ENABLED 53 | #define HAL_NOR_MODULE_ENABLED 54 | #define HAL_OPAMP_MODULE_ENABLED 55 | #define HAL_PCD_MODULE_ENABLED 56 | #define HAL_PWR_MODULE_ENABLED 57 | #define HAL_RCC_MODULE_ENABLED 58 | #define HAL_RTC_MODULE_ENABLED 59 | #define HAL_SD_MODULE_ENABLED 60 | #define HAL_SMARTCARD_MODULE_ENABLED 61 | #define HAL_SPI_MODULE_ENABLED 62 | #define HAL_SRAM_MODULE_ENABLED 63 | #define HAL_TIM_MODULE_ENABLED 64 | #define HAL_UART_MODULE_ENABLED 65 | #define HAL_USART_MODULE_ENABLED 66 | #define HAL_WWDG_MODULE_ENABLED 67 | 68 | /* ########################## Oscillator Values adaptation ####################*/ 69 | /** 70 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 71 | * This value is used by the RCC HAL module to compute the system frequency 72 | * (when HSE is used as system clock source, directly or through the PLL). 73 | */ 74 | #if !defined (HSE_VALUE) 75 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 76 | #endif /* HSE_VALUE */ 77 | 78 | #if !defined (HSE_STARTUP_TIMEOUT) 79 | #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */ 80 | #endif /* HSE_STARTUP_TIMEOUT */ 81 | 82 | /** 83 | * @brief Internal Multiple Speed oscillator (MSI) default value. 84 | * This value is the default MSI range value after Reset. 85 | */ 86 | #if !defined (MSI_VALUE) 87 | #define MSI_VALUE (2097000U) /*!< Value of the Internal oscillator in Hz*/ 88 | #endif /* MSI_VALUE */ 89 | /** 90 | * @brief Internal High Speed oscillator (HSI) value. 91 | * This value is used by the RCC HAL module to compute the system frequency 92 | * (when HSI is used as system clock source, directly or through the PLL). 93 | */ 94 | #if !defined (HSI_VALUE) 95 | #define HSI_VALUE (16000000U) /*!< Value of the Internal oscillator in Hz*/ 96 | #endif /* HSI_VALUE */ 97 | 98 | /** 99 | * @brief Internal Low Speed oscillator (LSI) value. 100 | */ 101 | #if !defined (LSI_VALUE) 102 | #define LSI_VALUE (37000U) /*!< LSI Typical Value in Hz*/ 103 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 104 | The real value may vary depending on the variations 105 | in voltage and temperature.*/ 106 | 107 | /** 108 | * @brief External Low Speed oscillator (LSE) value. 109 | */ 110 | #if !defined (LSE_VALUE) 111 | #define LSE_VALUE (32768U) /*!< Value of the External Low Speed oscillator in Hz*/ 112 | #endif /* LSE_VALUE */ 113 | 114 | /** 115 | * @brief Time out for LSE start up value in ms. 116 | */ 117 | #if !defined (LSE_STARTUP_TIMEOUT) 118 | #define LSE_STARTUP_TIMEOUT (5000U) /*!< Time out for LSE start up, in ms */ 119 | #endif /* LSE_STARTUP_TIMEOUT */ 120 | 121 | 122 | /* Tip: To avoid modifying this file each time you need to use different HSE, 123 | === you can define the HSE value in your toolchain compiler preprocessor. */ 124 | 125 | /* ########################### System Configuration ######################### */ 126 | /** 127 | * @brief This is the HAL system configuration section 128 | */ 129 | #define VDD_VALUE (3300U) /*!< Value of VDD in mv */ 130 | #define TICK_INT_PRIORITY (0x000FU) /*!< tick interrupt priority */ 131 | #define USE_RTOS 0U 132 | #define PREFETCH_ENABLE 1U 133 | #define INSTRUCTION_CACHE_ENABLE 0U 134 | #define DATA_CACHE_ENABLE 0U 135 | 136 | /* ########################## Assert Selection ############################## */ 137 | /** 138 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 139 | * HAL drivers code 140 | */ 141 | /*#define USE_FULL_ASSERT 1U*/ 142 | 143 | /* ################## Register callback feature configuration ############### */ 144 | /** 145 | * @brief Set below the peripheral configuration to "1U" to add the support 146 | * of HAL callback registration/deregistration feature for the HAL 147 | * driver(s). This allows user application to provide specific callback 148 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 149 | * the default weak callback functions (see each stm32l0xx_hal_ppp.h file 150 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 151 | * for each PPP peripheral). 152 | */ 153 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U 154 | #define USE_HAL_COMP_REGISTER_CALLBACKS 0U 155 | #define USE_HAL_DAC_REGISTER_CALLBACKS 0U 156 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U 157 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U 158 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U 159 | #define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U 160 | #define USE_HAL_PCD_REGISTER_CALLBACKS 0U 161 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U 162 | #define USE_HAL_SDMMC_REGISTER_CALLBACKS 0U 163 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U 164 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U 165 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U 166 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U 167 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U 168 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U 169 | 170 | /* ################## SPI peripheral configuration ########################## */ 171 | 172 | /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver 173 | * Activated: CRC code is present inside driver 174 | * Deactivated: CRC code cleaned from driver 175 | */ 176 | 177 | #define USE_SPI_CRC 1U 178 | 179 | /* Includes ------------------------------------------------------------------*/ 180 | /** 181 | * @brief Include module's header file 182 | */ 183 | 184 | #ifdef HAL_RCC_MODULE_ENABLED 185 | #include "stm32l1xx_hal_rcc.h" 186 | #endif /* HAL_RCC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_GPIO_MODULE_ENABLED 189 | #include "stm32l1xx_hal_gpio.h" 190 | #endif /* HAL_GPIO_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32l1xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_DMA_MODULE_ENABLED 197 | #include "stm32l1xx_hal_dma.h" 198 | #endif /* HAL_DMA_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_CORTEX_MODULE_ENABLED 201 | #include "stm32l1xx_hal_cortex.h" 202 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_ADC_MODULE_ENABLED 205 | #include "stm32l1xx_hal_adc.h" 206 | #endif /* HAL_ADC_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_COMP_MODULE_ENABLED 209 | #include "stm32l1xx_hal_comp.h" 210 | #endif /* HAL_COMP_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_CRC_MODULE_ENABLED 213 | #include "stm32l1xx_hal_crc.h" 214 | #endif /* HAL_CRC_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_CRYP_MODULE_ENABLED 217 | #include "stm32l1xx_hal_cryp.h" 218 | #endif /* HAL_CRYP_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_DAC_MODULE_ENABLED 221 | #include "stm32l1xx_hal_dac.h" 222 | #endif /* HAL_DAC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_FLASH_MODULE_ENABLED 225 | #include "stm32l1xx_hal_flash.h" 226 | #endif /* HAL_FLASH_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SRAM_MODULE_ENABLED 229 | #include "stm32l1xx_hal_sram.h" 230 | #endif /* HAL_SRAM_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_NOR_MODULE_ENABLED 233 | #include "stm32l1xx_hal_nor.h" 234 | #endif /* HAL_NOR_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_I2C_MODULE_ENABLED 237 | #include "stm32l1xx_hal_i2c.h" 238 | #endif /* HAL_I2C_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_I2S_MODULE_ENABLED 241 | #include "stm32l1xx_hal_i2s.h" 242 | #endif /* HAL_I2S_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_IWDG_MODULE_ENABLED 245 | #include "stm32l1xx_hal_iwdg.h" 246 | #endif /* HAL_IWDG_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_LCD_MODULE_ENABLED 249 | #include "stm32l1xx_hal_lcd.h" 250 | #endif /* HAL_LCD_MODULE_ENABLED */ 251 | 252 | #ifdef HAL_OPAMP_MODULE_ENABLED 253 | #include "stm32l1xx_hal_opamp.h" 254 | #endif /* HAL_OPAMP_MODULE_ENABLED */ 255 | 256 | #ifdef HAL_PWR_MODULE_ENABLED 257 | #include "stm32l1xx_hal_pwr.h" 258 | #endif /* HAL_PWR_MODULE_ENABLED */ 259 | 260 | #ifdef HAL_RTC_MODULE_ENABLED 261 | #include "stm32l1xx_hal_rtc.h" 262 | #endif /* HAL_RTC_MODULE_ENABLED */ 263 | 264 | #ifdef HAL_SD_MODULE_ENABLED 265 | #include "stm32l1xx_hal_sd.h" 266 | #endif /* HAL_SD_MODULE_ENABLED */ 267 | 268 | #ifdef HAL_SPI_MODULE_ENABLED 269 | #include "stm32l1xx_hal_spi.h" 270 | #endif /* HAL_SPI_MODULE_ENABLED */ 271 | 272 | #ifdef HAL_TIM_MODULE_ENABLED 273 | #include "stm32l1xx_hal_tim.h" 274 | #endif /* HAL_TIM_MODULE_ENABLED */ 275 | 276 | #ifdef HAL_UART_MODULE_ENABLED 277 | #include "stm32l1xx_hal_uart.h" 278 | #endif /* HAL_UART_MODULE_ENABLED */ 279 | 280 | #ifdef HAL_USART_MODULE_ENABLED 281 | #include "stm32l1xx_hal_usart.h" 282 | #endif /* HAL_USART_MODULE_ENABLED */ 283 | 284 | #ifdef HAL_IRDA_MODULE_ENABLED 285 | #include "stm32l1xx_hal_irda.h" 286 | #endif /* HAL_IRDA_MODULE_ENABLED */ 287 | 288 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 289 | #include "stm32l1xx_hal_smartcard.h" 290 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 291 | 292 | #ifdef HAL_WWDG_MODULE_ENABLED 293 | #include "stm32l1xx_hal_wwdg.h" 294 | #endif /* HAL_WWDG_MODULE_ENABLED */ 295 | 296 | #ifdef HAL_PCD_MODULE_ENABLED 297 | #include "stm32l1xx_hal_pcd.h" 298 | #endif /* HAL_PCD_MODULE_ENABLED */ 299 | 300 | /* Exported macro ------------------------------------------------------------*/ 301 | #ifdef USE_FULL_ASSERT 302 | /** 303 | * @brief The assert_param macro is used for function's parameters check. 304 | * @param expr If expr is false, it calls assert_failed function 305 | * which reports the name of the source file and the source 306 | * line number of the call that failed. 307 | * If expr is true, it returns no value. 308 | * @retval None 309 | */ 310 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 311 | /* Exported functions ------------------------------------------------------- */ 312 | void assert_failed(uint8_t* file, uint32_t line); 313 | #else 314 | #define assert_param(expr) ((void)0U) 315 | #endif /* USE_FULL_ASSERT */ 316 | 317 | #ifdef __cplusplus 318 | } 319 | #endif 320 | 321 | #endif /* __STM32L1xx_HAL_CONF_H */ 322 | 323 | 324 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 325 | -------------------------------------------------------------------------------- /tests/fetch/stm32l1xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l1xx_hal_conf.h 4 | * @author MCD Application Team 5 | * @brief HAL configuration template file. 6 | * This file should be copied to the application folder and renamed 7 | * to stm32l1xx_hal_conf.h. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

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

13 | * 14 | * This software component is licensed by ST under BSD 3-Clause license, 15 | * the "License"; You may not use this file except in compliance with the 16 | * License. You may obtain a copy of the License at: 17 | * opensource.org/licenses/BSD-3-Clause 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32L1xx_HAL_CONF_H 24 | #define __STM32L1xx_HAL_CONF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | 33 | /* ########################## Module Selection ############################## */ 34 | /** 35 | * @brief This is the list of modules to be used in the HAL driver 36 | */ 37 | #define HAL_MODULE_ENABLED 38 | #define HAL_ADC_MODULE_ENABLED 39 | #define HAL_COMP_MODULE_ENABLED 40 | #define HAL_CORTEX_MODULE_ENABLED 41 | #define HAL_CRC_MODULE_ENABLED 42 | #define HAL_CRYP_MODULE_ENABLED 43 | #define HAL_DAC_MODULE_ENABLED 44 | #define HAL_DMA_MODULE_ENABLED 45 | #define HAL_FLASH_MODULE_ENABLED 46 | #define HAL_GPIO_MODULE_ENABLED 47 | #define HAL_EXTI_MODULE_ENABLED 48 | #define HAL_I2C_MODULE_ENABLED 49 | #define HAL_I2S_MODULE_ENABLED 50 | #define HAL_IRDA_MODULE_ENABLED 51 | #define HAL_IWDG_MODULE_ENABLED 52 | #define HAL_LCD_MODULE_ENABLED 53 | #define HAL_NOR_MODULE_ENABLED 54 | #define HAL_OPAMP_MODULE_ENABLED 55 | #define HAL_PCD_MODULE_ENABLED 56 | #define HAL_PWR_MODULE_ENABLED 57 | #define HAL_RCC_MODULE_ENABLED 58 | #define HAL_RTC_MODULE_ENABLED 59 | #define HAL_SD_MODULE_ENABLED 60 | #define HAL_SMARTCARD_MODULE_ENABLED 61 | #define HAL_SPI_MODULE_ENABLED 62 | #define HAL_SRAM_MODULE_ENABLED 63 | #define HAL_TIM_MODULE_ENABLED 64 | #define HAL_UART_MODULE_ENABLED 65 | #define HAL_USART_MODULE_ENABLED 66 | #define HAL_WWDG_MODULE_ENABLED 67 | 68 | /* ########################## Oscillator Values adaptation ####################*/ 69 | /** 70 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. 71 | * This value is used by the RCC HAL module to compute the system frequency 72 | * (when HSE is used as system clock source, directly or through the PLL). 73 | */ 74 | #if !defined (HSE_VALUE) 75 | #define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */ 76 | #endif /* HSE_VALUE */ 77 | 78 | #if !defined (HSE_STARTUP_TIMEOUT) 79 | #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */ 80 | #endif /* HSE_STARTUP_TIMEOUT */ 81 | 82 | /** 83 | * @brief Internal Multiple Speed oscillator (MSI) default value. 84 | * This value is the default MSI range value after Reset. 85 | */ 86 | #if !defined (MSI_VALUE) 87 | #define MSI_VALUE (2097000U) /*!< Value of the Internal oscillator in Hz*/ 88 | #endif /* MSI_VALUE */ 89 | /** 90 | * @brief Internal High Speed oscillator (HSI) value. 91 | * This value is used by the RCC HAL module to compute the system frequency 92 | * (when HSI is used as system clock source, directly or through the PLL). 93 | */ 94 | #if !defined (HSI_VALUE) 95 | #define HSI_VALUE (16000000U) /*!< Value of the Internal oscillator in Hz*/ 96 | #endif /* HSI_VALUE */ 97 | 98 | /** 99 | * @brief Internal Low Speed oscillator (LSI) value. 100 | */ 101 | #if !defined (LSI_VALUE) 102 | #define LSI_VALUE (37000U) /*!< LSI Typical Value in Hz*/ 103 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz 104 | The real value may vary depending on the variations 105 | in voltage and temperature.*/ 106 | 107 | /** 108 | * @brief External Low Speed oscillator (LSE) value. 109 | */ 110 | #if !defined (LSE_VALUE) 111 | #define LSE_VALUE (32768U) /*!< Value of the External Low Speed oscillator in Hz*/ 112 | #endif /* LSE_VALUE */ 113 | 114 | /** 115 | * @brief Time out for LSE start up value in ms. 116 | */ 117 | #if !defined (LSE_STARTUP_TIMEOUT) 118 | #define LSE_STARTUP_TIMEOUT (5000U) /*!< Time out for LSE start up, in ms */ 119 | #endif /* LSE_STARTUP_TIMEOUT */ 120 | 121 | 122 | /* Tip: To avoid modifying this file each time you need to use different HSE, 123 | === you can define the HSE value in your toolchain compiler preprocessor. */ 124 | 125 | /* ########################### System Configuration ######################### */ 126 | /** 127 | * @brief This is the HAL system configuration section 128 | */ 129 | #define VDD_VALUE (3300U) /*!< Value of VDD in mv */ 130 | #define TICK_INT_PRIORITY (0x000FU) /*!< tick interrupt priority */ 131 | #define USE_RTOS 0U 132 | #define PREFETCH_ENABLE 1U 133 | #define INSTRUCTION_CACHE_ENABLE 0U 134 | #define DATA_CACHE_ENABLE 0U 135 | 136 | /* ########################## Assert Selection ############################## */ 137 | /** 138 | * @brief Uncomment the line below to expanse the "assert_param" macro in the 139 | * HAL drivers code 140 | */ 141 | /*#define USE_FULL_ASSERT 1U*/ 142 | 143 | /* ################## Register callback feature configuration ############### */ 144 | /** 145 | * @brief Set below the peripheral configuration to "1U" to add the support 146 | * of HAL callback registration/deregistration feature for the HAL 147 | * driver(s). This allows user application to provide specific callback 148 | * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting 149 | * the default weak callback functions (see each stm32l0xx_hal_ppp.h file 150 | * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef 151 | * for each PPP peripheral). 152 | */ 153 | #define USE_HAL_ADC_REGISTER_CALLBACKS 0U 154 | #define USE_HAL_COMP_REGISTER_CALLBACKS 0U 155 | #define USE_HAL_DAC_REGISTER_CALLBACKS 0U 156 | #define USE_HAL_I2C_REGISTER_CALLBACKS 0U 157 | #define USE_HAL_I2S_REGISTER_CALLBACKS 0U 158 | #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U 159 | #define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U 160 | #define USE_HAL_PCD_REGISTER_CALLBACKS 0U 161 | #define USE_HAL_RTC_REGISTER_CALLBACKS 0U 162 | #define USE_HAL_SDMMC_REGISTER_CALLBACKS 0U 163 | #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U 164 | #define USE_HAL_SPI_REGISTER_CALLBACKS 0U 165 | #define USE_HAL_TIM_REGISTER_CALLBACKS 0U 166 | #define USE_HAL_UART_REGISTER_CALLBACKS 0U 167 | #define USE_HAL_USART_REGISTER_CALLBACKS 0U 168 | #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U 169 | 170 | /* ################## SPI peripheral configuration ########################## */ 171 | 172 | /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver 173 | * Activated: CRC code is present inside driver 174 | * Deactivated: CRC code cleaned from driver 175 | */ 176 | 177 | #define USE_SPI_CRC 1U 178 | 179 | /* Includes ------------------------------------------------------------------*/ 180 | /** 181 | * @brief Include module's header file 182 | */ 183 | 184 | #ifdef HAL_RCC_MODULE_ENABLED 185 | #include "stm32l1xx_hal_rcc.h" 186 | #endif /* HAL_RCC_MODULE_ENABLED */ 187 | 188 | #ifdef HAL_GPIO_MODULE_ENABLED 189 | #include "stm32l1xx_hal_gpio.h" 190 | #endif /* HAL_GPIO_MODULE_ENABLED */ 191 | 192 | #ifdef HAL_EXTI_MODULE_ENABLED 193 | #include "stm32l1xx_hal_exti.h" 194 | #endif /* HAL_EXTI_MODULE_ENABLED */ 195 | 196 | #ifdef HAL_DMA_MODULE_ENABLED 197 | #include "stm32l1xx_hal_dma.h" 198 | #endif /* HAL_DMA_MODULE_ENABLED */ 199 | 200 | #ifdef HAL_CORTEX_MODULE_ENABLED 201 | #include "stm32l1xx_hal_cortex.h" 202 | #endif /* HAL_CORTEX_MODULE_ENABLED */ 203 | 204 | #ifdef HAL_ADC_MODULE_ENABLED 205 | #include "stm32l1xx_hal_adc.h" 206 | #endif /* HAL_ADC_MODULE_ENABLED */ 207 | 208 | #ifdef HAL_COMP_MODULE_ENABLED 209 | #include "stm32l1xx_hal_comp.h" 210 | #endif /* HAL_COMP_MODULE_ENABLED */ 211 | 212 | #ifdef HAL_CRC_MODULE_ENABLED 213 | #include "stm32l1xx_hal_crc.h" 214 | #endif /* HAL_CRC_MODULE_ENABLED */ 215 | 216 | #ifdef HAL_CRYP_MODULE_ENABLED 217 | #include "stm32l1xx_hal_cryp.h" 218 | #endif /* HAL_CRYP_MODULE_ENABLED */ 219 | 220 | #ifdef HAL_DAC_MODULE_ENABLED 221 | #include "stm32l1xx_hal_dac.h" 222 | #endif /* HAL_DAC_MODULE_ENABLED */ 223 | 224 | #ifdef HAL_FLASH_MODULE_ENABLED 225 | #include "stm32l1xx_hal_flash.h" 226 | #endif /* HAL_FLASH_MODULE_ENABLED */ 227 | 228 | #ifdef HAL_SRAM_MODULE_ENABLED 229 | #include "stm32l1xx_hal_sram.h" 230 | #endif /* HAL_SRAM_MODULE_ENABLED */ 231 | 232 | #ifdef HAL_NOR_MODULE_ENABLED 233 | #include "stm32l1xx_hal_nor.h" 234 | #endif /* HAL_NOR_MODULE_ENABLED */ 235 | 236 | #ifdef HAL_I2C_MODULE_ENABLED 237 | #include "stm32l1xx_hal_i2c.h" 238 | #endif /* HAL_I2C_MODULE_ENABLED */ 239 | 240 | #ifdef HAL_I2S_MODULE_ENABLED 241 | #include "stm32l1xx_hal_i2s.h" 242 | #endif /* HAL_I2S_MODULE_ENABLED */ 243 | 244 | #ifdef HAL_IWDG_MODULE_ENABLED 245 | #include "stm32l1xx_hal_iwdg.h" 246 | #endif /* HAL_IWDG_MODULE_ENABLED */ 247 | 248 | #ifdef HAL_LCD_MODULE_ENABLED 249 | #include "stm32l1xx_hal_lcd.h" 250 | #endif /* HAL_LCD_MODULE_ENABLED */ 251 | 252 | #ifdef HAL_OPAMP_MODULE_ENABLED 253 | #include "stm32l1xx_hal_opamp.h" 254 | #endif /* HAL_OPAMP_MODULE_ENABLED */ 255 | 256 | #ifdef HAL_PWR_MODULE_ENABLED 257 | #include "stm32l1xx_hal_pwr.h" 258 | #endif /* HAL_PWR_MODULE_ENABLED */ 259 | 260 | #ifdef HAL_RTC_MODULE_ENABLED 261 | #include "stm32l1xx_hal_rtc.h" 262 | #endif /* HAL_RTC_MODULE_ENABLED */ 263 | 264 | #ifdef HAL_SD_MODULE_ENABLED 265 | #include "stm32l1xx_hal_sd.h" 266 | #endif /* HAL_SD_MODULE_ENABLED */ 267 | 268 | #ifdef HAL_SPI_MODULE_ENABLED 269 | #include "stm32l1xx_hal_spi.h" 270 | #endif /* HAL_SPI_MODULE_ENABLED */ 271 | 272 | #ifdef HAL_TIM_MODULE_ENABLED 273 | #include "stm32l1xx_hal_tim.h" 274 | #endif /* HAL_TIM_MODULE_ENABLED */ 275 | 276 | #ifdef HAL_UART_MODULE_ENABLED 277 | #include "stm32l1xx_hal_uart.h" 278 | #endif /* HAL_UART_MODULE_ENABLED */ 279 | 280 | #ifdef HAL_USART_MODULE_ENABLED 281 | #include "stm32l1xx_hal_usart.h" 282 | #endif /* HAL_USART_MODULE_ENABLED */ 283 | 284 | #ifdef HAL_IRDA_MODULE_ENABLED 285 | #include "stm32l1xx_hal_irda.h" 286 | #endif /* HAL_IRDA_MODULE_ENABLED */ 287 | 288 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 289 | #include "stm32l1xx_hal_smartcard.h" 290 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 291 | 292 | #ifdef HAL_WWDG_MODULE_ENABLED 293 | #include "stm32l1xx_hal_wwdg.h" 294 | #endif /* HAL_WWDG_MODULE_ENABLED */ 295 | 296 | #ifdef HAL_PCD_MODULE_ENABLED 297 | #include "stm32l1xx_hal_pcd.h" 298 | #endif /* HAL_PCD_MODULE_ENABLED */ 299 | 300 | /* Exported macro ------------------------------------------------------------*/ 301 | #ifdef USE_FULL_ASSERT 302 | /** 303 | * @brief The assert_param macro is used for function's parameters check. 304 | * @param expr If expr is false, it calls assert_failed function 305 | * which reports the name of the source file and the source 306 | * line number of the call that failed. 307 | * If expr is true, it returns no value. 308 | * @retval None 309 | */ 310 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 311 | /* Exported functions ------------------------------------------------------- */ 312 | void assert_failed(uint8_t* file, uint32_t line); 313 | #else 314 | #define assert_param(expr) ((void)0U) 315 | #endif /* USE_FULL_ASSERT */ 316 | 317 | #ifdef __cplusplus 318 | } 319 | #endif 320 | 321 | #endif /* __STM32L1xx_HAL_CONF_H */ 322 | 323 | 324 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 325 | -------------------------------------------------------------------------------- /cmake/FindFreeRTOS.cmake: -------------------------------------------------------------------------------- 1 | # For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html 2 | 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) 3 | set(FreeRTOS_armv8_PORTS ARM_CM23_NTZ ARM_CM33_NTZ ARM_CM23 ARM_CM33) 4 | set(FreeRTOS_armv8_trustZone_PORTS ARM_CM23 ARM_CM33) 5 | 6 | if(NOT FreeRTOS_FIND_COMPONENTS) 7 | set(FreeRTOS_FIND_COMPONENTS ${FreeRTOS_PORTS}) 8 | endif() 9 | list(REMOVE_DUPLICATES FreeRTOS_FIND_COMPONENTS) 10 | 11 | if((NOT FREERTOS_PATH) AND (DEFINED ENV{FREERTOS_PATH})) 12 | set(FREERTOS_PATH $ENV{FREERTOS_PATH} CACHE PATH "Path to FreeRTOS") 13 | message(STATUS "ENV FREERTOS_PATH specified, using FREERTOS_PATH: ${FREERTOS_PATH}") 14 | endif() 15 | 16 | if(NOT FREERTOS_PATH) 17 | set(DEFAULT_FREERTOS_PATH "/opt/FreeRTOS") 18 | if(EXISTS ${DEFAULT_FREERTOS_PATH}) 19 | set(FREERTOS_PATH ${DEFAULT_FREERTOS_PATH} CACHE PATH "Path to FreeRTOS") 20 | message(STATUS "No FREERTOS_PATH specified using default: ${DEFAULT_FREERTOS_PATH}") 21 | else() 22 | message(STATUS 23 | "No FreeRTOS folder found at default location ${DEFAULT_FREERTOS_PATH}. " 24 | "Leaving empty.." 25 | ) 26 | endif() 27 | endif() 28 | 29 | if(STM32H7 IN_LIST FreeRTOS_FIND_COMPONENTS) 30 | list(REMOVE_ITEM FreeRTOS_FIND_COMPONENTS STM32H7) 31 | list(APPEND FreeRTOS_FIND_COMPONENTS STM32H7_M7 STM32H7_M4) 32 | endif() 33 | 34 | if(STM32WB IN_LIST BSP_FIND_COMPONENTS) 35 | list(REMOVE_ITEM FreeRTOS_FIND_COMPONENTS STM32WB) 36 | list(APPEND FreeRTOS_FIND_COMPONENTS STM32WB_M4) 37 | endif() 38 | 39 | if(STM32WL IN_LIST BSP_FIND_COMPONENTS) 40 | list(REMOVE_ITEM FreeRTOS_FIND_COMPONENTS STM32WL) 41 | list(APPEND FreeRTOS_FIND_COMPONENTS STM32WL_M4 STM32WL_M0PLUS) 42 | endif() 43 | 44 | # This section fills the family and ports components list 45 | foreach(COMP ${FreeRTOS_FIND_COMPONENTS}) 46 | string(TOUPPER ${COMP} COMP) 47 | string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" FAMILY_COMP ${COMP}) 48 | # Valid family component, so add it (e.g. STM32H7) 49 | if(CMAKE_MATCH_1) 50 | list(APPEND FreeRTOS_FIND_COMPONENTS_FAMILIES ${FAMILY_COMP}) 51 | continue() 52 | endif() 53 | # Was not a family component, so add it to the port list 54 | list(APPEND FreeRTOS_FIND_COMPONENTS_PORTS ${COMP}) 55 | endforeach() 56 | 57 | if(NOT FreeRTOS_FIND_COMPONENTS_PORTS) 58 | set(FreeRTOS_FIND_COMPONENTS_PORTS ${FreeRTOS_PORTS}) 59 | endif() 60 | 61 | list(REMOVE_DUPLICATES FreeRTOS_FIND_COMPONENTS) 62 | list(REMOVE_DUPLICATES FreeRTOS_FIND_COMPONENTS_PORTS) 63 | list(REMOVE_DUPLICATES FreeRTOS_FIND_COMPONENTS_FAMILIES) 64 | 65 | set(FreeRTOS_HEAPS 1 2 3 4 5) 66 | 67 | macro(stm32_find_freertos FreeRTOS_NAMESPACE FREERTOS_PATH) 68 | find_path(FreeRTOS_COMMON_INCLUDE 69 | NAMES FreeRTOS.h 70 | PATHS "${FREERTOS_PATH}" "${FREERTOS_PATH}/FreeRTOS" 71 | PATH_SUFFIXES "Source/include" "include" 72 | NO_DEFAULT_PATH 73 | ) 74 | 75 | if(NOT FreeRTOS_COMMON_INCLUDE) 76 | message(WARNING "FreeRTOS common include path not found, build might fail") 77 | endif() 78 | 79 | list(APPEND FreeRTOS_INCLUDE_DIRS "${FreeRTOS_COMMON_INCLUDE}") 80 | 81 | find_path(FreeRTOS_SOURCE_DIR 82 | NAMES tasks.c 83 | PATHS "${FREERTOS_PATH}" "${FREERTOS_PATH}/FreeRTOS" 84 | PATH_SUFFIXES "Source" 85 | NO_DEFAULT_PATH 86 | ) 87 | if(NOT (TARGET FreeRTOS)) 88 | add_library(FreeRTOS INTERFACE IMPORTED) 89 | target_sources(FreeRTOS INTERFACE 90 | "${FreeRTOS_SOURCE_DIR}/tasks.c" 91 | "${FreeRTOS_SOURCE_DIR}/list.c" 92 | "${FreeRTOS_SOURCE_DIR}/queue.c" 93 | ) 94 | target_include_directories(FreeRTOS INTERFACE "${FreeRTOS_COMMON_INCLUDE}") 95 | endif() 96 | 97 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::Coroutine)) 98 | add_library(${FreeRTOS_NAMESPACE}::Coroutine INTERFACE IMPORTED) 99 | target_sources(${FreeRTOS_NAMESPACE}::Coroutine INTERFACE "${FreeRTOS_SOURCE_DIR}/croutine.c") 100 | target_link_libraries(${FreeRTOS_NAMESPACE}::Coroutine INTERFACE FreeRTOS) 101 | endif() 102 | 103 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::EventGroups)) 104 | add_library(${FreeRTOS_NAMESPACE}::EventGroups INTERFACE IMPORTED) 105 | target_sources(${FreeRTOS_NAMESPACE}::EventGroups INTERFACE "${FreeRTOS_SOURCE_DIR}/event_groups.c") 106 | target_link_libraries(${FreeRTOS_NAMESPACE}::EventGroups INTERFACE FreeRTOS) 107 | endif() 108 | 109 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::StreamBuffer)) 110 | add_library(${FreeRTOS_NAMESPACE}::StreamBuffer INTERFACE IMPORTED) 111 | target_sources(${FreeRTOS_NAMESPACE}::StreamBuffer INTERFACE "${FreeRTOS_SOURCE_DIR}/stream_buffer.c") 112 | target_link_libraries(${FreeRTOS_NAMESPACE}::StreamBuffer INTERFACE FreeRTOS) 113 | endif() 114 | 115 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::Timers)) 116 | add_library(${FreeRTOS_NAMESPACE}::Timers INTERFACE IMPORTED) 117 | target_sources(${FreeRTOS_NAMESPACE}::Timers INTERFACE "${FreeRTOS_SOURCE_DIR}/timers.c") 118 | target_link_libraries(${FreeRTOS_NAMESPACE}::Timers INTERFACE FreeRTOS) 119 | endif() 120 | 121 | foreach(HEAP ${FreeRTOS_HEAPS}) 122 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::Heap::${HEAP})) 123 | add_library(${FreeRTOS_NAMESPACE}::Heap::${HEAP} INTERFACE IMPORTED) 124 | target_sources(${FreeRTOS_NAMESPACE}::Heap::${HEAP} INTERFACE "${FreeRTOS_SOURCE_DIR}/portable/MemMang/heap_${HEAP}.c") 125 | target_link_libraries(${FreeRTOS_NAMESPACE}::Heap::${HEAP} INTERFACE FreeRTOS) 126 | endif() 127 | endforeach() 128 | 129 | foreach(PORT ${FreeRTOS_FIND_COMPONENTS_PORTS}) 130 | if(${PORT} IN_LIST FreeRTOS_armv8_trustZone_PORTS) 131 | set(ARMv8_NON_SECURE "::NON_SECURE") 132 | endif() 133 | 134 | find_path(FreeRTOS_${PORT}_PATH 135 | NAMES portmacro.h 136 | PATHS "${FREERTOS_PATH}" "${FREERTOS_PATH}/FreeRTOS" 137 | PATH_SUFFIXES 138 | "portable/GCC/${PORT}" 139 | "portable/GCC/${PORT}/r0p1" 140 | "portable/GCC/${PORT}/non_secure" 141 | "Source/portable/GCC/${PORT}" 142 | "Source/portable/GCC/${PORT}/r0p1" 143 | "Source/portable/GCC/${PORT}/non_secure" 144 | NO_DEFAULT_PATH 145 | ) 146 | 147 | if(NOT FreeRTOS_${PORT}_PATH) 148 | message(WARNING "FreeRTOS port path not found, build might fail") 149 | endif() 150 | 151 | list(APPEND FreeRTOS_INCLUDE_DIRS "${FreeRTOS_${PORT}_PATH}") 152 | 153 | find_file(FreeRTOS_${PORT}_SOURCE 154 | NAMES port.c 155 | PATHS "${FreeRTOS_${PORT}_PATH}" 156 | NO_DEFAULT_PATH 157 | ) 158 | if(NOT (TARGET ${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE})) 159 | add_library(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE IMPORTED) 160 | target_link_libraries(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE FreeRTOS) 161 | target_sources(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_SOURCE}") 162 | target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}") 163 | message(trace "FindFreeRTOS: creating target ${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE}") 164 | 165 | # armv8-m needs additional file even if using "No Trust Zone" port 166 | if(${PORT} IN_LIST FreeRTOS_armv8_PORTS) 167 | target_sources(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}/portasm.c") 168 | endif() 169 | 170 | if(${PORT} IN_LIST FreeRTOS_armv8_trustZone_PORTS) 171 | # create the secure target 172 | add_library(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE IMPORTED) 173 | # ::SECURE doesn't link FreeRTOS like ::NON_SECURE does 174 | target_sources(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE "${FreeRTOS_${PORT}_PATH}/../secure/secure_context.c" 175 | "${FreeRTOS_${PORT}_PATH}/../secure/secure_context_port.c" 176 | "${FreeRTOS_${PORT}_PATH}/../secure/secure_heap.c" 177 | "${FreeRTOS_${PORT}_PATH}/../secure/secure_init.c") 178 | message(trace "FindFreeRTOS: creating target ${FreeRTOS_NAMESPACE}::${PORT}::SECURE") 179 | 180 | # non-secure part needs declaratation from secure includes 181 | target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}${ARMv8_NON_SECURE} INTERFACE "${FreeRTOS_${PORT}_PATH}/../secure") 182 | # secure part needs declaratation from non-secure includes and common freeRTOS includes 183 | target_include_directories(${FreeRTOS_NAMESPACE}::${PORT}::SECURE INTERFACE "${FreeRTOS_${PORT}_PATH}" 184 | "${FreeRTOS_COMMON_INCLUDE}") 185 | endif() 186 | endif() 187 | 188 | if(FreeRTOS_${PORT}_PATH AND 189 | FreeRTOS_${PORT}_SOURCE AND 190 | FreeRTOS_COMMON_INCLUDE AND 191 | FreeRTOS_SOURCE_DIR) 192 | set(FreeRTOS_${PORT}_FOUND TRUE) 193 | else() 194 | set(FreeRTOS_${PORT}_FOUND FALSE) 195 | endif() 196 | endforeach() 197 | endmacro() 198 | 199 | message(STATUS "Search for FreeRTOS ports: ${FreeRTOS_FIND_COMPONENTS_PORTS}") 200 | 201 | if(NOT FreeRTOS_FIND_COMPONENTS_FAMILIES) 202 | stm32_find_freertos(FreeRTOS ${FREERTOS_PATH}) 203 | else() 204 | message(STATUS "Search for FreeRTOS families: ${FreeRTOS_FIND_COMPONENTS_FAMILIES}") 205 | 206 | foreach(COMP ${FreeRTOS_FIND_COMPONENTS_FAMILIES}) 207 | string(TOLOWER ${COMP} COMP_L) 208 | string(TOUPPER ${COMP} COMP) 209 | 210 | string(REGEX MATCH "^STM32([CFGHLMUW]P?[0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M0PLUS|M4|M7)?.*$" COMP ${COMP}) 211 | 212 | if((NOT CMAKE_MATCH_1) AND (NOT CMAKE_MATCH_2)) 213 | message(FATAL_ERROR "Unknown FreeRTOS component: ${COMP}") 214 | endif() 215 | 216 | if(CMAKE_MATCH_2) 217 | set(FAMILY ${CMAKE_MATCH_1}) 218 | set(STM_DEVICES "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") 219 | else() 220 | set(FAMILY ${CMAKE_MATCH_1}) 221 | stm32_get_devices_by_family(STM_DEVICES FAMILY ${FAMILY}) 222 | endif() 223 | 224 | if(CMAKE_MATCH_3) 225 | set(CORE ${CMAKE_MATCH_3}) 226 | set(CORE_C "::${CORE}") 227 | set(CORE_U "_${CORE}") 228 | else() 229 | unset(CORE) 230 | unset(CORE_C) 231 | unset(CORE_U) 232 | endif() 233 | 234 | string(TOLOWER ${FAMILY} FAMILY_L) 235 | if(NOT STM32_CUBE_${FAMILY}_PATH) 236 | set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") 237 | message(STATUS "Did not specify STM32_CMSIS_${FAMILY}_PATH, using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") 238 | endif() 239 | 240 | stm32_find_freertos(FreeRTOS::STM32::${FAMILY}${CORE_C} ${STM32_CUBE_${FAMILY}_PATH}/Middlewares/Third_Party/FreeRTOS) 241 | foreach(PORT_COMP ${FreeRTOS_FIND_COMPONENTS_PORTS}) 242 | if(FreeRTOS_${PORT_COMP}_PATH AND 243 | FreeRTOS_${PORT_COMP}_SOURCE AND 244 | FreeRTOS_COMMON_INCLUDE AND 245 | FreeRTOS_SOURCE_DIR) 246 | set(FreeRTOS_${COMP}_FOUND TRUE) 247 | else() 248 | set(FreeRTOS_${COMP}_FOUND FALSE) 249 | endif() 250 | endforeach() 251 | endforeach() 252 | endif() 253 | 254 | include(FindPackageHandleStandardArgs) 255 | find_package_handle_standard_args(FreeRTOS 256 | REQUIRED_VARS FreeRTOS_INCLUDE_DIRS 257 | FOUND_VAR FreeRTOS_FOUND 258 | HANDLE_COMPONENTS 259 | ) 260 | --------------------------------------------------------------------------------