├── .gitignore ├── README.md ├── build.sh ├── config ├── Dockerfile ├── Vagrantfile ├── cross_linux.txt ├── cross_windows.txt └── platform │ ├── .mxproject │ ├── BSP │ ├── stm32h7xx_nucleo_144.c │ └── stm32h7xx_nucleo_144.h │ ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32H7xx │ │ │ │ └── Include │ │ │ │ ├── stm32h743xx.h │ │ │ │ ├── stm32h7xx.h │ │ │ │ └── system_stm32h7xx.h │ │ └── Include │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armclang.h │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_iccarm.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_armv8mbl.h │ │ │ ├── core_armv8mml.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm1.h │ │ │ ├── core_cm23.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm33.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_sc000.h │ │ │ ├── core_sc300.h │ │ │ ├── mpu_armv7.h │ │ │ ├── mpu_armv8.h │ │ │ └── tz_context.h │ └── STM32H7xx_HAL_Driver │ │ ├── Inc │ │ ├── Legacy │ │ │ └── stm32_hal_legacy.h │ │ ├── stm32h7xx_hal.h │ │ ├── stm32h7xx_hal_cortex.h │ │ ├── stm32h7xx_hal_def.h │ │ ├── stm32h7xx_hal_dma.h │ │ ├── stm32h7xx_hal_dma_ex.h │ │ ├── stm32h7xx_hal_eth.h │ │ ├── stm32h7xx_hal_eth_ex.h │ │ ├── stm32h7xx_hal_exti.h │ │ ├── stm32h7xx_hal_flash.h │ │ ├── stm32h7xx_hal_flash_ex.h │ │ ├── stm32h7xx_hal_gpio.h │ │ ├── stm32h7xx_hal_gpio_ex.h │ │ ├── stm32h7xx_hal_hsem.h │ │ ├── stm32h7xx_hal_i2c.h │ │ ├── stm32h7xx_hal_i2c_ex.h │ │ ├── stm32h7xx_hal_mdma.h │ │ ├── stm32h7xx_hal_pcd.h │ │ ├── stm32h7xx_hal_pcd_ex.h │ │ ├── stm32h7xx_hal_pwr.h │ │ ├── stm32h7xx_hal_pwr_ex.h │ │ ├── stm32h7xx_hal_rcc.h │ │ ├── stm32h7xx_hal_rcc_ex.h │ │ ├── stm32h7xx_hal_tim.h │ │ ├── stm32h7xx_hal_tim_ex.h │ │ ├── stm32h7xx_hal_uart.h │ │ ├── stm32h7xx_hal_uart_ex.h │ │ └── stm32h7xx_ll_usb.h │ │ └── Src │ │ ├── stm32h7xx_hal.c │ │ ├── stm32h7xx_hal_cortex.c │ │ ├── stm32h7xx_hal_dma.c │ │ ├── stm32h7xx_hal_dma_ex.c │ │ ├── stm32h7xx_hal_eth.c │ │ ├── stm32h7xx_hal_eth_ex.c │ │ ├── stm32h7xx_hal_exti.c │ │ ├── stm32h7xx_hal_flash.c │ │ ├── stm32h7xx_hal_flash_ex.c │ │ ├── stm32h7xx_hal_gpio.c │ │ ├── stm32h7xx_hal_hsem.c │ │ ├── stm32h7xx_hal_i2c.c │ │ ├── stm32h7xx_hal_i2c_ex.c │ │ ├── stm32h7xx_hal_mdma.c │ │ ├── stm32h7xx_hal_pcd.c │ │ ├── stm32h7xx_hal_pcd_ex.c │ │ ├── stm32h7xx_hal_pwr.c │ │ ├── stm32h7xx_hal_pwr_ex.c │ │ ├── stm32h7xx_hal_rcc.c │ │ ├── stm32h7xx_hal_rcc_ex.c │ │ ├── stm32h7xx_hal_tim.c │ │ ├── stm32h7xx_hal_tim_ex.c │ │ ├── stm32h7xx_hal_uart.c │ │ ├── stm32h7xx_hal_uart_ex.c │ │ └── stm32h7xx_ll_usb.c │ ├── Inc │ ├── FreeRTOSConfig.h │ ├── main.h │ ├── stm32h7xx_hal_conf.h │ └── stm32h7xx_it.h │ ├── Makefile │ ├── Middlewares │ └── Third_Party │ │ └── FreeRTOS │ │ └── Source │ │ ├── CMSIS_RTOS_V2 │ │ ├── cmsis_os.h │ │ ├── cmsis_os2.c │ │ └── cmsis_os2.h │ │ ├── croutine.c │ │ ├── event_groups.c │ │ ├── include │ │ ├── FreeRTOS.h │ │ ├── StackMacros.h │ │ ├── croutine.h │ │ ├── deprecated_definitions.h │ │ ├── event_groups.h │ │ ├── list.h │ │ ├── message_buffer.h │ │ ├── mpu_prototypes.h │ │ ├── mpu_wrappers.h │ │ ├── portable.h │ │ ├── projdefs.h │ │ ├── queue.h │ │ ├── semphr.h │ │ ├── stack_macros.h │ │ ├── stream_buffer.h │ │ ├── task.h │ │ └── timers.h │ │ ├── list.c │ │ ├── portable │ │ ├── GCC │ │ │ └── ARM_CM4F │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ └── MemMang │ │ │ └── heap_4.c │ │ ├── queue.c │ │ ├── stream_buffer.c │ │ ├── tasks.c │ │ └── timers.c │ ├── STM32H743ZITx_FLASH.ld │ ├── Src │ ├── freertos.c │ ├── main.c │ ├── stm32h7xx_hal_msp.c │ ├── stm32h7xx_hal_timebase_tim.c │ ├── stm32h7xx_it.c │ └── system_stm32h7xx.c │ ├── platform.ioc │ └── startup_stm32h743xx.s ├── docs ├── Doxyfile.in └── meson.build ├── env.sh ├── meson.build ├── meson_options.txt ├── src ├── BSP │ ├── meson.build │ ├── stm32h7xx_nucleo_144.c │ └── stm32h7xx_nucleo_144.h ├── STM32H743ZITx_FLASH.ld ├── application │ ├── FreeRTOSConfig.h │ ├── freertos.c │ ├── main.c │ ├── main.h │ ├── meson.build │ ├── stm32h7xx_hal_conf.h │ ├── stm32h7xx_hal_msp.c │ ├── stm32h7xx_hal_timebase_tim.c │ ├── stm32h7xx_it.c │ ├── stm32h7xx_it.h │ └── system_stm32h7xx.c ├── drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32H7xx │ │ │ │ └── Include │ │ │ │ ├── stm32h743xx.h │ │ │ │ ├── stm32h7xx.h │ │ │ │ └── system_stm32h7xx.h │ │ └── Include │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armclang.h │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_iccarm.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_armv8mbl.h │ │ │ ├── core_armv8mml.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm1.h │ │ │ ├── core_cm23.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm33.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_sc000.h │ │ │ ├── core_sc300.h │ │ │ ├── mpu_armv7.h │ │ │ ├── mpu_armv8.h │ │ │ └── tz_context.h │ ├── STM32H7xx_HAL_Driver │ │ ├── Inc │ │ │ ├── Legacy │ │ │ │ └── stm32_hal_legacy.h │ │ │ ├── stm32h7xx_hal.h │ │ │ ├── stm32h7xx_hal_cortex.h │ │ │ ├── stm32h7xx_hal_def.h │ │ │ ├── stm32h7xx_hal_dma.h │ │ │ ├── stm32h7xx_hal_dma_ex.h │ │ │ ├── stm32h7xx_hal_eth.h │ │ │ ├── stm32h7xx_hal_eth_ex.h │ │ │ ├── stm32h7xx_hal_exti.h │ │ │ ├── stm32h7xx_hal_flash.h │ │ │ ├── stm32h7xx_hal_flash_ex.h │ │ │ ├── stm32h7xx_hal_gpio.h │ │ │ ├── stm32h7xx_hal_gpio_ex.h │ │ │ ├── stm32h7xx_hal_hsem.h │ │ │ ├── stm32h7xx_hal_i2c.h │ │ │ ├── stm32h7xx_hal_i2c_ex.h │ │ │ ├── stm32h7xx_hal_mdma.h │ │ │ ├── stm32h7xx_hal_pcd.h │ │ │ ├── stm32h7xx_hal_pcd_ex.h │ │ │ ├── stm32h7xx_hal_pwr.h │ │ │ ├── stm32h7xx_hal_pwr_ex.h │ │ │ ├── stm32h7xx_hal_rcc.h │ │ │ ├── stm32h7xx_hal_rcc_ex.h │ │ │ ├── stm32h7xx_hal_tim.h │ │ │ ├── stm32h7xx_hal_tim_ex.h │ │ │ ├── stm32h7xx_hal_uart.h │ │ │ ├── stm32h7xx_hal_uart_ex.h │ │ │ └── stm32h7xx_ll_usb.h │ │ └── Src │ │ │ ├── meson.build │ │ │ ├── stm32h7xx_hal.c │ │ │ ├── stm32h7xx_hal_cortex.c │ │ │ ├── stm32h7xx_hal_dma.c │ │ │ ├── stm32h7xx_hal_dma_ex.c │ │ │ ├── stm32h7xx_hal_eth.c │ │ │ ├── stm32h7xx_hal_eth_ex.c │ │ │ ├── stm32h7xx_hal_exti.c │ │ │ ├── stm32h7xx_hal_flash.c │ │ │ ├── stm32h7xx_hal_flash_ex.c │ │ │ ├── stm32h7xx_hal_gpio.c │ │ │ ├── stm32h7xx_hal_hsem.c │ │ │ ├── stm32h7xx_hal_i2c.c │ │ │ ├── stm32h7xx_hal_i2c_ex.c │ │ │ ├── stm32h7xx_hal_mdma.c │ │ │ ├── stm32h7xx_hal_pcd.c │ │ │ ├── stm32h7xx_hal_pcd_ex.c │ │ │ ├── stm32h7xx_hal_pwr.c │ │ │ ├── stm32h7xx_hal_pwr_ex.c │ │ │ ├── stm32h7xx_hal_rcc.c │ │ │ ├── stm32h7xx_hal_rcc_ex.c │ │ │ ├── stm32h7xx_hal_tim.c │ │ │ ├── stm32h7xx_hal_tim_ex.c │ │ │ ├── stm32h7xx_hal_uart.c │ │ │ ├── stm32h7xx_hal_uart_ex.c │ │ │ └── stm32h7xx_ll_usb.c │ └── meson.build ├── meson.build ├── middlewares │ ├── FreeRTOS │ │ └── Source │ │ │ ├── CMSIS_RTOS_V2 │ │ │ ├── cmsis_os.h │ │ │ ├── cmsis_os2.c │ │ │ └── cmsis_os2.h │ │ │ ├── croutine.c │ │ │ ├── event_groups.c │ │ │ ├── include │ │ │ ├── FreeRTOS.h │ │ │ ├── StackMacros.h │ │ │ ├── croutine.h │ │ │ ├── deprecated_definitions.h │ │ │ ├── event_groups.h │ │ │ ├── list.h │ │ │ ├── message_buffer.h │ │ │ ├── mpu_prototypes.h │ │ │ ├── mpu_wrappers.h │ │ │ ├── portable.h │ │ │ ├── projdefs.h │ │ │ ├── queue.h │ │ │ ├── semphr.h │ │ │ ├── stack_macros.h │ │ │ ├── stream_buffer.h │ │ │ ├── task.h │ │ │ └── timers.h │ │ │ ├── list.c │ │ │ ├── meson.build │ │ │ ├── portable │ │ │ ├── GCC │ │ │ │ └── ARM_CM4F │ │ │ │ │ ├── port.c │ │ │ │ │ └── portmacro.h │ │ │ └── MemMang │ │ │ │ └── heap_4.c │ │ │ ├── queue.c │ │ │ ├── stream_buffer.c │ │ │ ├── tasks.c │ │ │ └── timers.c │ └── meson.build └── startup_stm32h743xx.s └── test ├── cpputest_main.cpp ├── meson.build └── sometest.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | config/platform/build/ 3 | config/*.log 4 | 5 | .vagrant 6 | 7 | subprojects/* 8 | !subprojects/*.wrap 9 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | srcdir=. 4 | buildir=build/debug 5 | 6 | if [ -d "$buildir" ]; then 7 | echo "removing directory: $buildir" 8 | rm -r $buildir 9 | fi 10 | 11 | meson $srcdir $buildir --cross-file config/cross_linux.txt --buildtype=debugoptimized && cd $buildir 12 | -------------------------------------------------------------------------------- /config/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | # install required dependencies 4 | RUN apt-get update 5 | RUN apt-get -y install \ 6 | build-essential \ 7 | pkg-config \ 8 | curl \ 9 | git \ 10 | python3 \ 11 | python3-pip \ 12 | binutils-arm-none-eabi \ 13 | gcc-arm-none-eabi \ 14 | libnewlib-arm-none-eabi \ 15 | clang \ 16 | clang-tools \ 17 | libcpputest-dev \ 18 | doxygen \ 19 | graphviz 20 | 21 | # install (latest version of) Meson and Ninja 22 | RUN pip3 install ninja meson 23 | -------------------------------------------------------------------------------- /config/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://vagrantcloud.com/search. 15 | config.vm.box = "ubuntu/bionic64" 16 | 17 | # Disable automatic box update checking. If you disable this, then 18 | # boxes will only be checked for updates when the user runs 19 | # `vagrant box outdated`. This is not recommended. 20 | # config.vm.box_check_update = false 21 | 22 | # Create a forwarded port mapping which allows access to a specific port 23 | # within the machine from a port on the host machine. In the example below, 24 | # accessing "localhost:8080" will access port 80 on the guest machine. 25 | # NOTE: This will enable public access to the opened port 26 | # config.vm.network "forwarded_port", guest: 80, host: 8080 27 | 28 | # Create a forwarded port mapping which allows access to a specific port 29 | # within the machine from a port on the host machine and only allow access 30 | # via 127.0.0.1 to disable public access 31 | config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" 32 | 33 | # Create a private network, which allows host-only access to the machine 34 | # using a specific IP. 35 | # config.vm.network "private_network", ip: "192.168.33.10" 36 | 37 | # Create a public network, which generally matched to bridged network. 38 | # Bridged networks make the machine appear as another physical device on 39 | # your network. 40 | # config.vm.network "public_network" 41 | 42 | # Share an additional folder to the guest VM. The first argument is 43 | # the path on the host to the actual folder. The second argument is 44 | # the path on the guest to mount the folder. And the optional third 45 | # argument is a set of non-required options. 46 | config.vm.synced_folder "../", "/project" 47 | 48 | # Provider-specific configuration so you can fine-tune various 49 | # backing providers for Vagrant. These expose provider-specific options. 50 | # Example for VirtualBox: 51 | # 52 | #config.vm.provider "virtualbox" do |vb| 53 | # # Display the VirtualBox GUI when booting the machine 54 | # #vb.gui = true 55 | 56 | # # Enable USB controller in Virtualbox 57 | # vb.customize ["modifyvm", :id, "--usb", "on"] 58 | # vb.customize ["modifyvm", :id, "--usbehci", "on"] 59 | 60 | # # Usb filter 61 | # vb.customize ["usbfilter", "add", "0", 62 | # "--target", :id, 63 | # "--name", "STLINK", 64 | # "--manufacturer", "STMicroelectronics"] 65 | # 66 | # # Customize the amount of memory on the VM: 67 | # vb.memory = "1024" 68 | #end 69 | # 70 | # View the documentation for the provider you are using for more 71 | # information on available options. 72 | 73 | # Enable provisioning with a shell script. Additional provisioners such as 74 | # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 75 | # documentation for more information about their specific syntax and use. 76 | config.vm.provision "shell", inline: <<-SHELL 77 | apt-get update 78 | apt-get -y install \ 79 | git \ 80 | dos2unix \ 81 | docker.io 82 | 83 | sudo systemctl enable docker 84 | sudo usermod -aG docker vagrant 85 | SHELL 86 | end 87 | -------------------------------------------------------------------------------- /config/cross_linux.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'arm-none-eabi-gcc' 3 | cpp = 'arm-none-eabi-g++' 4 | ld = 'arm-none-eabi-ld' 5 | ar = 'arm-none-eabi-ar' 6 | as = 'arm-none-eabi-as' 7 | strip = 'arm-none-eabi-strip' 8 | 9 | [properties] 10 | c_args = [ 11 | '-mcpu=cortex-m7', 12 | '-mthumb', 13 | '-mfpu=fpv5-d16', 14 | '-mfloat-abi=hard', 15 | '-Wall', 16 | '-ffunction-sections', 17 | '-fdata-sections', 18 | ] 19 | 20 | c_link_args = [ 21 | '-mcpu=cortex-m7', 22 | '-mthumb', 23 | '-mfpu=fpv5-d16', 24 | '-mfloat-abi=hard', 25 | '-specs=nano.specs', 26 | '-lc', 27 | '-lm', 28 | '-lnosys', 29 | ] 30 | 31 | [host_machine] 32 | system = 'bare-metel' 33 | cpu_family = 'arm' 34 | cpu = 'cortex-m7' 35 | endian = 'little' 36 | -------------------------------------------------------------------------------- /config/cross_windows.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'arm-none-eabi-gcc' 3 | cpp = 'arm-none-eabi-g++' 4 | ld = 'arm-none-eabi-ld' 5 | ar = 'arm-none-eabi-ar' 6 | as = 'arm-none-eabi-as' 7 | strip = 'arm-none-eabi-strip' 8 | 9 | [properties] 10 | c_args = [ 11 | '-mcpu=cortex-m7', 12 | '-mthumb', 13 | '-mfpu=fpv5-d16', 14 | '-mfloat-abi=hard', 15 | '-Wall', 16 | '-ffunction-sections', 17 | '-fdata-sections', 18 | ] 19 | 20 | c_link_args = [ 21 | '-mcpu=cortex-m7', 22 | '-mthumb', 23 | '-mfpu=fpv5-d16', 24 | '-mfloat-abi=hard', 25 | '-specs=nano.specs', 26 | '-lc', 27 | '-lm', 28 | '-lnosys', 29 | ] 30 | 31 | [host_machine] 32 | system = 'bare-metel' 33 | cpu_family = 'arm' 34 | cpu = 'cortex-m7' 35 | endian = 'little' -------------------------------------------------------------------------------- /config/platform/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlyingBBQ/meson_embedded/a173c87675f2326e888e702944e24070a242b29d/config/platform/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h -------------------------------------------------------------------------------- /config/platform/Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32h7xx.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-Mx Device System Source File for STM32H7xx devices. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 | /** @addtogroup CMSIS 21 | * @{ 22 | */ 23 | 24 | /** @addtogroup stm32h7xx_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef SYSTEM_STM32H7XX_H 32 | #define SYSTEM_STM32H7XX_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32H7xx_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32H7xx_System_Exported_types 48 | * @{ 49 | */ 50 | /* This variable is updated in three ways: 51 | 1) by calling CMSIS function SystemCoreClockUpdate() 52 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq() 53 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency 54 | Note: If you use this function to configure the system clock; then there 55 | is no need to call the 2 first functions listed above, since SystemCoreClock 56 | variable is updated automatically. 57 | */ 58 | extern uint32_t SystemCoreClock; /*!< System Domain1 Clock Frequency */ 59 | extern uint32_t SystemD2Clock; /*!< System Domain2 Clock Frequency */ 60 | extern const uint8_t D1CorePrescTable[16] ; /*!< D1CorePrescTable prescalers table values */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32H7xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32H7xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32H7xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* SYSTEM_STM32H7XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /config/platform/Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /config/platform/Drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /config/platform/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef STM32H7xx_HAL_DEF 23 | #define STM32H7xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32h7xx.h" 31 | #include "Legacy/stm32_hal_legacy.h" 32 | #include 33 | #include 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | 37 | /** 38 | * @brief HAL Status structures definition 39 | */ 40 | typedef enum 41 | { 42 | HAL_OK = 0x00, 43 | HAL_ERROR = 0x01, 44 | HAL_BUSY = 0x02, 45 | HAL_TIMEOUT = 0x03 46 | } HAL_StatusTypeDef; 47 | 48 | /** 49 | * @brief HAL Lock structures definition 50 | */ 51 | typedef enum 52 | { 53 | HAL_UNLOCKED = 0x00, 54 | HAL_LOCKED = 0x01 55 | } HAL_LockTypeDef; 56 | 57 | /* Exported macro ------------------------------------------------------------*/ 58 | 59 | #define HAL_MAX_DELAY 0xFFFFFFFFU 60 | 61 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) 62 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 63 | 64 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 65 | do{ \ 66 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 67 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 68 | } while(0) 69 | 70 | #define UNUSED(x) ((void)(x)) 71 | 72 | /** @brief Reset the Handle's State field. 73 | * @param __HANDLE__: specifies the Peripheral Handle. 74 | * @note This macro can be used for the following purpose: 75 | * - When the Handle is declared as local variable; before passing it as parameter 76 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 77 | * to set to 0 the Handle's "State" field. 78 | * Otherwise, "State" field may have any random value and the first time the function 79 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 80 | * (i.e. HAL_PPP_MspInit() will not be executed). 81 | * - When there is a need to reconfigure the low level hardware: instead of calling 82 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 83 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 84 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 85 | * @retval None 86 | */ 87 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) 88 | 89 | #if (USE_RTOS == 1) 90 | #error " USE_RTOS should be 0 in the current HAL release " 91 | #else 92 | #define __HAL_LOCK(__HANDLE__) \ 93 | do{ \ 94 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 95 | { \ 96 | return HAL_BUSY; \ 97 | } \ 98 | else \ 99 | { \ 100 | (__HANDLE__)->Lock = HAL_LOCKED; \ 101 | } \ 102 | }while (0) 103 | 104 | #define __HAL_UNLOCK(__HANDLE__) \ 105 | do{ \ 106 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 107 | }while (0) 108 | #endif /* USE_RTOS */ 109 | 110 | #if defined ( __GNUC__ ) 111 | #ifndef __weak 112 | #define __weak __attribute__((weak)) 113 | #endif /* __weak */ 114 | #ifndef __packed 115 | #define __packed __attribute__((__packed__)) 116 | #endif /* __packed */ 117 | #endif /* __GNUC__ */ 118 | 119 | 120 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 121 | #if defined (__GNUC__) /* GNU Compiler */ 122 | #ifndef __ALIGN_END 123 | #define __ALIGN_END __attribute__ ((aligned (4))) 124 | #endif /* __ALIGN_END */ 125 | #ifndef __ALIGN_BEGIN 126 | #define __ALIGN_BEGIN 127 | #endif /* __ALIGN_BEGIN */ 128 | #else 129 | #ifndef __ALIGN_END 130 | #define __ALIGN_END 131 | #endif /* __ALIGN_END */ 132 | #ifndef __ALIGN_BEGIN 133 | #if defined (__CC_ARM) /* ARM Compiler */ 134 | #define __ALIGN_BEGIN __align(4) 135 | #elif defined (__ICCARM__) /* IAR Compiler */ 136 | #define __ALIGN_BEGIN 137 | #endif /* __CC_ARM */ 138 | #endif /* __ALIGN_BEGIN */ 139 | #endif /* __GNUC__ */ 140 | 141 | /* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */ 142 | #if defined (__GNUC__) /* GNU Compiler */ 143 | #define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32))) 144 | #elif defined (__ICCARM__) /* IAR Compiler */ 145 | #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf 146 | #elif defined (__CC_ARM) /* ARM Compiler */ 147 | #define ALIGN_32BYTES(buf) __align(32) buf 148 | #endif 149 | 150 | /** 151 | * @brief __RAM_FUNC definition 152 | */ 153 | #if defined ( __CC_ARM ) 154 | /* ARM Compiler 155 | ------------ 156 | RAM functions are defined using the toolchain options. 157 | Functions that are executed in RAM should reside in a separate source module. 158 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 159 | area of a module to a memory space in physical RAM. 160 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 161 | dialog. 162 | */ 163 | #define __RAM_FUNC 164 | 165 | #elif defined ( __ICCARM__ ) 166 | /* ICCARM Compiler 167 | --------------- 168 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 169 | */ 170 | #define __RAM_FUNC __ramfunc 171 | 172 | #elif defined ( __GNUC__ ) 173 | /* GNU Compiler 174 | ------------ 175 | RAM functions are defined using a specific toolchain attribute 176 | "__attribute__((section(".RamFunc")))". 177 | */ 178 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 179 | 180 | #endif 181 | 182 | #ifdef __cplusplus 183 | } 184 | #endif 185 | 186 | #endif /* STM32H7xx_HAL_DEF */ 187 | 188 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 189 | -------------------------------------------------------------------------------- /config/platform/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_hsem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_hsem.h 4 | * @author MCD Application Team 5 | * @brief Header file of HSEM HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 STM32H7xx_HAL_HSEM_H 22 | #define STM32H7xx_HAL_HSEM_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32h7xx_hal_def.h" 30 | 31 | /** @addtogroup STM32H7xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup HSEM 36 | * @{ 37 | */ 38 | 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /** @defgroup HSEM_Exported_Macros HSEM Exported Macros 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief SemID to mask helper Macro. 46 | * @param __SEMID__: semaphore ID from 0 to 31 47 | * @retval Semaphore Mask. 48 | */ 49 | #define __HAL_HSEM_SEMID_TO_MASK(__SEMID__) (1 << (__SEMID__)) 50 | 51 | /** 52 | * @brief Enables the specified HSEM interrupts. 53 | * @param __SEM_MASK__: semaphores Mask 54 | * @retval None. 55 | */ 56 | #if defined(DUAL_CORE) 57 | #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 58 | (HSEM->C1IER |= (__SEM_MASK__)) : \ 59 | (HSEM->C2IER |= (__SEM_MASK__))) 60 | #else 61 | #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) (HSEM->IER |= (__SEM_MASK__)) 62 | #endif /* DUAL_CORE */ 63 | /** 64 | * @brief Disables the specified HSEM interrupts. 65 | * @param __SEM_MASK__: semaphores Mask 66 | * @retval None. 67 | */ 68 | #if defined(DUAL_CORE) 69 | #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 70 | (HSEM->C1IER &= ~(__SEM_MASK__)) : \ 71 | (HSEM->C2IER &= ~(__SEM_MASK__))) 72 | #else 73 | #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) (HSEM->IER &= ~(__SEM_MASK__)) 74 | #endif /* DUAL_CORE */ 75 | 76 | /** 77 | * @brief Checks whether interrupt has occurred or not for semaphores specified by a mask. 78 | * @param __SEM_MASK__: semaphores Mask 79 | * @retval semaphores Mask : Semaphores where an interrupt occurred. 80 | */ 81 | #if defined(DUAL_CORE) 82 | #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 83 | ((__SEM_MASK__) & HSEM->C1MISR) : \ 84 | ((__SEM_MASK__) & HSEM->C2MISR1)) 85 | #else 86 | #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((__SEM_MASK__) & HSEM->MISR) 87 | #endif /* DUAL_CORE */ 88 | 89 | /** 90 | * @brief Get the semaphores release status flags. 91 | * @param __SEM_MASK__: semaphores Mask 92 | * @retval semaphores Mask : Semaphores where Release flags rise. 93 | */ 94 | #if defined(DUAL_CORE) 95 | #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 96 | (__SEM_MASK__) & HSEM->C1ISR : \ 97 | (__SEM_MASK__) & HSEM->C2ISR) 98 | #else 99 | #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((__SEM_MASK__) & HSEM->ISR) 100 | #endif /* DUAL_CORE */ 101 | 102 | /** 103 | * @brief Clears the HSEM Interrupt flags. 104 | * @param __SEM_MASK__: semaphores Mask 105 | * @retval None. 106 | */ 107 | #if defined(DUAL_CORE) 108 | #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 109 | (HSEM->C1ICR |= (__SEM_MASK__)) : \ 110 | (HSEM->C2ICR |= (__SEM_MASK__))) 111 | #else 112 | #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) (HSEM->ICR |= (__SEM_MASK__)) 113 | #endif /* DUAL_CORE */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /* Exported functions --------------------------------------------------------*/ 120 | /** @defgroup HSEM_Exported_Functions HSEM Exported Functions 121 | * @{ 122 | */ 123 | 124 | /** @addtogroup HSEM_Exported_Functions_Group1 Take and Release functions 125 | * @brief HSEM Take and Release functions 126 | * @{ 127 | */ 128 | 129 | /* HSEM semaphore take (lock) using 2-Step method ****************************/ 130 | HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID); 131 | /* HSEM semaphore fast take (lock) using 1-Step method ***********************/ 132 | HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID); 133 | /* HSEM Check semaphore state Taken or not **********************************/ 134 | uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID); 135 | /* HSEM Release **************************************************************/ 136 | void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID); 137 | /* HSEM Release All************************************************************/ 138 | void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID); 139 | 140 | /** 141 | * @} 142 | */ 143 | 144 | /** @addtogroup HSEM_Exported_Functions_Group2 HSEM Set and Get Key functions 145 | * @brief HSEM Set and Get Key functions. 146 | * @{ 147 | */ 148 | /* HSEM Set Clear Key *********************************************************/ 149 | void HAL_HSEM_SetClearKey(uint32_t Key); 150 | /* HSEM Get Clear Key *********************************************************/ 151 | uint32_t HAL_HSEM_GetClearKey(void); 152 | /** 153 | * @} 154 | */ 155 | 156 | /** @addtogroup HSEM_Exported_Functions_Group3 157 | * @brief HSEM Notification functions 158 | * @{ 159 | */ 160 | /* HSEM Activate HSEM Notification (When a semaphore is released) ) *****************/ 161 | void HAL_HSEM_ActivateNotification(uint32_t SemMask); 162 | /* HSEM Deactivate HSEM Notification (When a semaphore is released) ****************/ 163 | void HAL_HSEM_DeactivateNotification(uint32_t SemMask); 164 | /* HSEM Free Callback (When a semaphore is released) *******************************/ 165 | void HAL_HSEM_FreeCallback(uint32_t SemMask); 166 | /* HSEM IRQ Handler **********************************************************/ 167 | void HAL_HSEM_IRQHandler(void); 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /** 174 | * @} 175 | */ 176 | 177 | /* Private macros ------------------------------------------------------------*/ 178 | /** @defgroup HSEM_Private_Macros HSEM Private Macros 179 | * @{ 180 | */ 181 | 182 | #define IS_HSEM_SEMID(__SEMID__) ((__SEMID__) <= HSEM_SEMID_MAX ) 183 | 184 | #define IS_HSEM_PROCESSID(__PROCESSID__) ((__PROCESSID__) <= HSEM_PROCESSID_MAX ) 185 | 186 | #define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX ) 187 | 188 | #if defined(DUAL_CORE) 189 | #define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \ 190 | ((__COREID__) == HSEM_CPU2_COREID)) 191 | #else 192 | #define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID) 193 | #endif 194 | 195 | 196 | /** 197 | * @} 198 | */ 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | #ifdef __cplusplus 209 | } 210 | #endif 211 | 212 | #endif /* STM32H7xx_HAL_HSEM_H */ 213 | 214 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 215 | -------------------------------------------------------------------------------- /config/platform/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of PCD HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 STM32H7xx_HAL_PCD_EX_H 22 | #define STM32H7xx_HAL_PCD_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32h7xx_hal_def.h" 30 | 31 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS) 32 | /** @addtogroup STM32H7xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup PCDEx 37 | * @{ 38 | */ 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macros -----------------------------------------------------------*/ 42 | /* Exported functions --------------------------------------------------------*/ 43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 44 | * @{ 45 | */ 46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 47 | * @{ 48 | */ 49 | 50 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS) 51 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 52 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 53 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ 54 | 55 | 56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 58 | 59 | 60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 63 | 64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | 89 | #endif /* STM32H7xx_HAL_PCD_EX_H */ 90 | 91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 92 | -------------------------------------------------------------------------------- /config/platform/Inc/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /* 3 | * FreeRTOS Kernel V10.0.1 4 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | * this software and associated documentation files (the "Software"), to deal in 8 | * the Software without restriction, including without limitation the rights to 9 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | * the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * http://www.FreeRTOS.org 24 | * http://aws.amazon.com/freertos 25 | * 26 | * 1 tab == 4 spaces! 27 | */ 28 | /* USER CODE END Header */ 29 | 30 | #ifndef FREERTOS_CONFIG_H 31 | #define FREERTOS_CONFIG_H 32 | 33 | /*----------------------------------------------------------- 34 | * Application specific definitions. 35 | * 36 | * These definitions should be adjusted for your particular hardware and 37 | * application requirements. 38 | * 39 | * These parameters and more are described within the 'configuration' section of the 40 | * FreeRTOS API documentation available on the FreeRTOS.org web site. 41 | * 42 | * See http://www.freertos.org/a00110.html 43 | *----------------------------------------------------------*/ 44 | 45 | /* USER CODE BEGIN Includes */ 46 | /* Section where include file can be added */ 47 | /* USER CODE END Includes */ 48 | 49 | /* Ensure definitions are only used by the compiler, and not by the assembler. */ 50 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 51 | #include 52 | extern uint32_t SystemCoreClock; 53 | #endif 54 | #define configUSE_PREEMPTION 1 55 | #define configSUPPORT_STATIC_ALLOCATION 1 56 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 57 | #define configUSE_IDLE_HOOK 0 58 | #define configUSE_TICK_HOOK 0 59 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 60 | #define configTICK_RATE_HZ ((TickType_t)1000) 61 | #define configMAX_PRIORITIES ( 56 ) 62 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 63 | #define configTOTAL_HEAP_SIZE ((size_t)15360) 64 | #define configMAX_TASK_NAME_LEN ( 16 ) 65 | #define configUSE_TRACE_FACILITY 1 66 | #define configUSE_16_BIT_TICKS 0 67 | #define configUSE_MUTEXES 1 68 | #define configQUEUE_REGISTRY_SIZE 8 69 | #define configUSE_RECURSIVE_MUTEXES 1 70 | #define configUSE_COUNTING_SEMAPHORES 1 71 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 72 | 73 | /* Co-routine definitions. */ 74 | #define configUSE_CO_ROUTINES 0 75 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 76 | 77 | /* Software timer definitions. */ 78 | #define configUSE_TIMERS 1 79 | #define configTIMER_TASK_PRIORITY ( 2 ) 80 | #define configTIMER_QUEUE_LENGTH 10 81 | #define configTIMER_TASK_STACK_DEPTH 256 82 | 83 | /* Set the following definitions to 1 to include the API function, or zero 84 | to exclude the API function. */ 85 | #define INCLUDE_vTaskPrioritySet 1 86 | #define INCLUDE_uxTaskPriorityGet 1 87 | #define INCLUDE_vTaskDelete 1 88 | #define INCLUDE_vTaskCleanUpResources 0 89 | #define INCLUDE_vTaskSuspend 1 90 | #define INCLUDE_vTaskDelayUntil 1 91 | #define INCLUDE_vTaskDelay 1 92 | #define INCLUDE_xTaskGetSchedulerState 1 93 | #define INCLUDE_xTimerPendFunctionCall 1 94 | #define INCLUDE_xQueueGetMutexHolder 1 95 | #define INCLUDE_uxTaskGetStackHighWaterMark 1 96 | #define INCLUDE_eTaskGetState 1 97 | 98 | /* 99 | * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used 100 | * by the application thus the correct define need to be enabled below 101 | */ 102 | #define USE_FreeRTOS_HEAP_4 103 | 104 | /* Cortex-M specific definitions. */ 105 | #ifdef __NVIC_PRIO_BITS 106 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 107 | #define configPRIO_BITS __NVIC_PRIO_BITS 108 | #else 109 | #define configPRIO_BITS 4 110 | #endif 111 | 112 | /* The lowest interrupt priority that can be used in a call to a "set priority" 113 | function. */ 114 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 115 | 116 | /* The highest interrupt priority that can be used by any interrupt service 117 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 118 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 119 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 120 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 121 | 122 | /* Interrupt priorities used by the kernel port layer itself. These are generic 123 | to all Cortex-M ports, and do not rely on any particular library functions. */ 124 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 125 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 126 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 127 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 128 | 129 | /* Normal assert() semantics without relying on the provision of an assert.h 130 | header file. */ 131 | /* USER CODE BEGIN 1 */ 132 | #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} 133 | /* USER CODE END 1 */ 134 | 135 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 136 | standard names. */ 137 | #define vPortSVCHandler SVC_Handler 138 | #define xPortPendSVHandler PendSV_Handler 139 | 140 | /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, 141 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 142 | #define xPortSysTickHandler SysTick_Handler 143 | 144 | /* USER CODE BEGIN Defines */ 145 | /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ 146 | /* USER CODE END Defines */ 147 | 148 | #endif /* FREERTOS_CONFIG_H */ 149 | -------------------------------------------------------------------------------- /config/platform/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MAIN_H 24 | #define __MAIN_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32h7xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | 36 | /* USER CODE END Includes */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN ET */ 40 | 41 | /* USER CODE END ET */ 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* USER CODE BEGIN EC */ 45 | 46 | /* USER CODE END EC */ 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN EM */ 50 | 51 | /* USER CODE END EM */ 52 | 53 | /* Exported functions prototypes ---------------------------------------------*/ 54 | void Error_Handler(void); 55 | 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | /* Private defines -----------------------------------------------------------*/ 61 | #define B1_Pin GPIO_PIN_13 62 | #define B1_GPIO_Port GPIOC 63 | #define LD1_Pin GPIO_PIN_0 64 | #define LD1_GPIO_Port GPIOB 65 | #define LD3_Pin GPIO_PIN_14 66 | #define LD3_GPIO_Port GPIOB 67 | #define STLINK_RX_Pin GPIO_PIN_8 68 | #define STLINK_RX_GPIO_Port GPIOD 69 | #define STLINK_TX_Pin GPIO_PIN_9 70 | #define STLINK_TX_GPIO_Port GPIOD 71 | #define USB_OTG_FS_PWR_EN_Pin GPIO_PIN_10 72 | #define USB_OTG_FS_PWR_EN_GPIO_Port GPIOD 73 | #define USB_OTG_FS_OVCR_Pin GPIO_PIN_7 74 | #define USB_OTG_FS_OVCR_GPIO_Port GPIOG 75 | #define LD2_Pin GPIO_PIN_1 76 | #define LD2_GPIO_Port GPIOE 77 | /* USER CODE BEGIN Private defines */ 78 | 79 | /* USER CODE END Private defines */ 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* __MAIN_H */ 86 | 87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 88 | -------------------------------------------------------------------------------- /config/platform/Inc/stm32h7xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32H7xx_IT_H 23 | #define __STM32H7xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void DebugMon_Handler(void); 56 | void TIM1_UP_IRQHandler(void); 57 | /* USER CODE BEGIN EFP */ 58 | 59 | /* USER CODE END EFP */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* __STM32H7xx_IT_H */ 66 | 67 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 68 | -------------------------------------------------------------------------------- /config/platform/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################################################################## 2 | # File automatically-generated by tool: [projectgenerator] version: [3.4.0] date: [Sun Aug 04 13:58:46 CEST 2019] 3 | ########################################################################################################################## 4 | 5 | # ------------------------------------------------ 6 | # Generic Makefile (based on gcc) 7 | # 8 | # ChangeLog : 9 | # 2017-02-10 - Several enhancements + project update mode 10 | # 2015-07-22 - first version 11 | # ------------------------------------------------ 12 | 13 | ###################################### 14 | # target 15 | ###################################### 16 | TARGET = platform 17 | 18 | 19 | ###################################### 20 | # building variables 21 | ###################################### 22 | # debug build? 23 | DEBUG = 1 24 | # optimization 25 | OPT = -Og 26 | 27 | 28 | ####################################### 29 | # paths 30 | ####################################### 31 | # Build path 32 | BUILD_DIR = build 33 | 34 | ###################################### 35 | # source 36 | ###################################### 37 | # C sources 38 | C_SOURCES = \ 39 | Src/main.c \ 40 | Src/freertos.c \ 41 | Src/stm32h7xx_it.c \ 42 | Src/stm32h7xx_hal_msp.c \ 43 | Src/stm32h7xx_hal_timebase_tim.c \ 44 | BSP/stm32h7xx_nucleo_144.c \ 45 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c \ 46 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_eth.c \ 47 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_eth_ex.c \ 48 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c \ 49 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c \ 50 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c \ 51 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c \ 52 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd.c \ 53 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd_ex.c \ 54 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_usb.c \ 55 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c \ 56 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c \ 57 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c \ 58 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c \ 59 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c \ 60 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c \ 61 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c \ 62 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c \ 63 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c \ 64 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c \ 65 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c \ 66 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c \ 67 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c \ 68 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c \ 69 | Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c \ 70 | Src/system_stm32h7xx.c \ 71 | Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ 72 | Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ 73 | Middlewares/Third_Party/FreeRTOS/Source/list.c \ 74 | Middlewares/Third_Party/FreeRTOS/Source/queue.c \ 75 | Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \ 76 | Middlewares/Third_Party/FreeRTOS/Source/tasks.c \ 77 | Middlewares/Third_Party/FreeRTOS/Source/timers.c \ 78 | Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c \ 79 | Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \ 80 | Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c 81 | 82 | # ASM sources 83 | ASM_SOURCES = \ 84 | startup_stm32h743xx.s 85 | 86 | 87 | ####################################### 88 | # binaries 89 | ####################################### 90 | PREFIX = arm-none-eabi- 91 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 92 | # either it can be added to the PATH environment variable. 93 | ifdef GCC_PATH 94 | CC = $(GCC_PATH)/$(PREFIX)gcc 95 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 96 | CP = $(GCC_PATH)/$(PREFIX)objcopy 97 | SZ = $(GCC_PATH)/$(PREFIX)size 98 | else 99 | CC = $(PREFIX)gcc 100 | AS = $(PREFIX)gcc -x assembler-with-cpp 101 | CP = $(PREFIX)objcopy 102 | SZ = $(PREFIX)size 103 | endif 104 | HEX = $(CP) -O ihex 105 | BIN = $(CP) -O binary -S 106 | 107 | ####################################### 108 | # CFLAGS 109 | ####################################### 110 | # cpu 111 | CPU = -mcpu=cortex-m7 112 | 113 | # fpu 114 | FPU = -mfpu=fpv5-d16 115 | 116 | # float-abi 117 | FLOAT-ABI = -mfloat-abi=hard 118 | 119 | # mcu 120 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 121 | 122 | # macros for gcc 123 | # AS defines 124 | AS_DEFS = 125 | 126 | # C defines 127 | C_DEFS = \ 128 | -DUSE_HAL_DRIVER \ 129 | -DSTM32H743xx \ 130 | -DUSE_HAL_DRIVER \ 131 | -DSTM32H743xx 132 | 133 | 134 | # AS includes 135 | AS_INCLUDES = \ 136 | -I/Inc 137 | 138 | # C includes 139 | C_INCLUDES = \ 140 | -IInc \ 141 | -IBSP \ 142 | -IDrivers/STM32H7xx_HAL_Driver/Inc \ 143 | -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy \ 144 | -IMiddlewares/Third_Party/FreeRTOS/Source/include \ 145 | -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \ 146 | -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \ 147 | -IDrivers/CMSIS/Device/ST/STM32H7xx/Include \ 148 | -IDrivers/CMSIS/Include \ 149 | -IDrivers/CMSIS/Include 150 | 151 | 152 | # compile gcc flags 153 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 154 | 155 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 156 | 157 | ifeq ($(DEBUG), 1) 158 | CFLAGS += -g -gdwarf-2 159 | endif 160 | 161 | 162 | # Generate dependency information 163 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 164 | 165 | 166 | ####################################### 167 | # LDFLAGS 168 | ####################################### 169 | # link script 170 | LDSCRIPT = STM32H743ZITx_FLASH.ld 171 | 172 | # libraries 173 | LIBS = -lc -lm -lnosys 174 | LIBDIR = 175 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 176 | 177 | # default action: build all 178 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin 179 | 180 | 181 | ####################################### 182 | # build the application 183 | ####################################### 184 | # list of objects 185 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 186 | vpath %.c $(sort $(dir $(C_SOURCES))) 187 | # list of ASM program objects 188 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 189 | vpath %.s $(sort $(dir $(ASM_SOURCES))) 190 | 191 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 192 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 193 | 194 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 195 | $(AS) -c $(CFLAGS) $< -o $@ 196 | 197 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile 198 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ 199 | $(SZ) $@ 200 | 201 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 202 | $(HEX) $< $@ 203 | 204 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 205 | $(BIN) $< $@ 206 | 207 | $(BUILD_DIR): 208 | mkdir $@ 209 | 210 | ####################################### 211 | # clean up 212 | ####################################### 213 | clean: 214 | -rm -fR $(BUILD_DIR) 215 | 216 | ####################################### 217 | # dependencies 218 | ####################################### 219 | -include $(wildcard $(BUILD_DIR)/*.d) 220 | 221 | # *** EOF *** 222 | -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlyingBBQ/meson_embedded/a173c87675f2326e888e702944e24070a242b29d/config/platform/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released. 33 | #endif 34 | 35 | /* 36 | * Call the stack overflow hook function if the stack of the task being swapped 37 | * out is currently overflowed, or looks like it might have overflowed in the 38 | * past. 39 | * 40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 41 | * the current stack state only - comparing the current top of stack value to 42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 43 | * will also cause the last few stack bytes to be checked to ensure the value 44 | * to which the bytes were set when the task was created have not been 45 | * overwritten. Note this second test does not guarantee that an overflowed 46 | * stack will always be recognised. 47 | */ 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 52 | 53 | /* Only the current stack state is to be checked. */ 54 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 55 | { \ 56 | /* Is the currently saved stack pointer within the stack limit? */ \ 57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 58 | { \ 59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 60 | } \ 61 | } 62 | 63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 64 | /*-----------------------------------------------------------*/ 65 | 66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 67 | 68 | /* Only the current stack state is to be checked. */ 69 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 70 | { \ 71 | \ 72 | /* Is the currently saved stack pointer within the stack limit? */ \ 73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 74 | { \ 75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 76 | } \ 77 | } 78 | 79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 80 | /*-----------------------------------------------------------*/ 81 | 82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 83 | 84 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 85 | { \ 86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 88 | \ 89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 90 | ( pulStack[ 1 ] != ulCheckValue ) || \ 91 | ( pulStack[ 2 ] != ulCheckValue ) || \ 92 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 93 | { \ 94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 95 | } \ 96 | } 97 | 98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 99 | /*-----------------------------------------------------------*/ 100 | 101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 102 | 103 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 104 | { \ 105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 111 | \ 112 | \ 113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 114 | \ 115 | /* Has the extremity of the task stack ever been written over? */ \ 116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 117 | { \ 118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 119 | } \ 120 | } 121 | 122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 123 | /*-----------------------------------------------------------*/ 124 | 125 | /* Remove stack overflow macro if not being used. */ 126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 127 | #define taskCHECK_FOR_STACK_OVERFLOW() 128 | #endif 129 | 130 | 131 | 132 | #endif /* STACK_MACROS_H */ 133 | 134 | -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef DEPRECATED_DEFINITIONS_H 29 | #define DEPRECATED_DEFINITIONS_H 30 | 31 | 32 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 33 | pre-processor definition was used to ensure the pre-processor found the correct 34 | portmacro.h file for the port being used. That scheme was deprecated in favour 35 | of setting the compiler's include path such that it found the correct 36 | portmacro.h file - removing the need for the constant and allowing the 37 | portmacro.h file to be located anywhere in relation to the port being used. The 38 | definitions below remain in the code for backward compatibility only. New 39 | projects should not use them. */ 40 | 41 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT 42 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" 43 | typedef void ( __interrupt __far *pxISR )(); 44 | #endif 45 | 46 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT 47 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h" 48 | typedef void ( __interrupt __far *pxISR )(); 49 | #endif 50 | 51 | #ifdef GCC_MEGA_AVR 52 | #include "../portable/GCC/ATMega323/portmacro.h" 53 | #endif 54 | 55 | #ifdef IAR_MEGA_AVR 56 | #include "../portable/IAR/ATMega323/portmacro.h" 57 | #endif 58 | 59 | #ifdef MPLAB_PIC24_PORT 60 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 61 | #endif 62 | 63 | #ifdef MPLAB_DSPIC_PORT 64 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 65 | #endif 66 | 67 | #ifdef MPLAB_PIC18F_PORT 68 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h" 69 | #endif 70 | 71 | #ifdef MPLAB_PIC32MX_PORT 72 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h" 73 | #endif 74 | 75 | #ifdef _FEDPICC 76 | #include "libFreeRTOS/Include/portmacro.h" 77 | #endif 78 | 79 | #ifdef SDCC_CYGNAL 80 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h" 81 | #endif 82 | 83 | #ifdef GCC_ARM7 84 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h" 85 | #endif 86 | 87 | #ifdef GCC_ARM7_ECLIPSE 88 | #include "portmacro.h" 89 | #endif 90 | 91 | #ifdef ROWLEY_LPC23xx 92 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h" 93 | #endif 94 | 95 | #ifdef IAR_MSP430 96 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h" 97 | #endif 98 | 99 | #ifdef GCC_MSP430 100 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h" 101 | #endif 102 | 103 | #ifdef ROWLEY_MSP430 104 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h" 105 | #endif 106 | 107 | #ifdef ARM7_LPC21xx_KEIL_RVDS 108 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h" 109 | #endif 110 | 111 | #ifdef SAM7_GCC 112 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h" 113 | #endif 114 | 115 | #ifdef SAM7_IAR 116 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h" 117 | #endif 118 | 119 | #ifdef SAM9XE_IAR 120 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h" 121 | #endif 122 | 123 | #ifdef LPC2000_IAR 124 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h" 125 | #endif 126 | 127 | #ifdef STR71X_IAR 128 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h" 129 | #endif 130 | 131 | #ifdef STR75X_IAR 132 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h" 133 | #endif 134 | 135 | #ifdef STR75X_GCC 136 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h" 137 | #endif 138 | 139 | #ifdef STR91X_IAR 140 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h" 141 | #endif 142 | 143 | #ifdef GCC_H8S 144 | #include "../../Source/portable/GCC/H8S2329/portmacro.h" 145 | #endif 146 | 147 | #ifdef GCC_AT91FR40008 148 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h" 149 | #endif 150 | 151 | #ifdef RVDS_ARMCM3_LM3S102 152 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h" 153 | #endif 154 | 155 | #ifdef GCC_ARMCM3_LM3S102 156 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 157 | #endif 158 | 159 | #ifdef GCC_ARMCM3 160 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 161 | #endif 162 | 163 | #ifdef IAR_ARM_CM3 164 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 165 | #endif 166 | 167 | #ifdef IAR_ARMCM3_LM 168 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 169 | #endif 170 | 171 | #ifdef HCS12_CODE_WARRIOR 172 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h" 173 | #endif 174 | 175 | #ifdef MICROBLAZE_GCC 176 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h" 177 | #endif 178 | 179 | #ifdef TERN_EE 180 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h" 181 | #endif 182 | 183 | #ifdef GCC_HCS12 184 | #include "../../Source/portable/GCC/HCS12/portmacro.h" 185 | #endif 186 | 187 | #ifdef GCC_MCF5235 188 | #include "../../Source/portable/GCC/MCF5235/portmacro.h" 189 | #endif 190 | 191 | #ifdef COLDFIRE_V2_GCC 192 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h" 193 | #endif 194 | 195 | #ifdef COLDFIRE_V2_CODEWARRIOR 196 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h" 197 | #endif 198 | 199 | #ifdef GCC_PPC405 200 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h" 201 | #endif 202 | 203 | #ifdef GCC_PPC440 204 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h" 205 | #endif 206 | 207 | #ifdef _16FX_SOFTUNE 208 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h" 209 | #endif 210 | 211 | #ifdef BCC_INDUSTRIAL_PC_PORT 212 | /* A short file name has to be used in place of the normal 213 | FreeRTOSConfig.h when using the Borland compiler. */ 214 | #include "frconfig.h" 215 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h" 216 | typedef void ( __interrupt __far *pxISR )(); 217 | #endif 218 | 219 | #ifdef BCC_FLASH_LITE_186_PORT 220 | /* A short file name has to be used in place of the normal 221 | FreeRTOSConfig.h when using the Borland compiler. */ 222 | #include "frconfig.h" 223 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h" 224 | typedef void ( __interrupt __far *pxISR )(); 225 | #endif 226 | 227 | #ifdef __GNUC__ 228 | #ifdef __AVR32_AVR32A__ 229 | #include "portmacro.h" 230 | #endif 231 | #endif 232 | 233 | #ifdef __ICCAVR32__ 234 | #ifdef __CORE__ 235 | #if __CORE__ == __AVR32A__ 236 | #include "portmacro.h" 237 | #endif 238 | #endif 239 | #endif 240 | 241 | #ifdef __91467D 242 | #include "portmacro.h" 243 | #endif 244 | 245 | #ifdef __96340 246 | #include "portmacro.h" 247 | #endif 248 | 249 | 250 | #ifdef __IAR_V850ES_Fx3__ 251 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 252 | #endif 253 | 254 | #ifdef __IAR_V850ES_Jx3__ 255 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 256 | #endif 257 | 258 | #ifdef __IAR_V850ES_Jx3_L__ 259 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 260 | #endif 261 | 262 | #ifdef __IAR_V850ES_Jx2__ 263 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 264 | #endif 265 | 266 | #ifdef __IAR_V850ES_Hx2__ 267 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 268 | #endif 269 | 270 | #ifdef __IAR_78K0R_Kx3__ 271 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 272 | #endif 273 | 274 | #ifdef __IAR_78K0R_Kx3L__ 275 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 276 | #endif 277 | 278 | #endif /* DEPRECATED_DEFINITIONS_H */ 279 | 280 | -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/include/portable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | * Portable layer API. Each function must be defined for each port. 30 | *----------------------------------------------------------*/ 31 | 32 | #ifndef PORTABLE_H 33 | #define PORTABLE_H 34 | 35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 36 | pre-processor definition was used to ensure the pre-processor found the correct 37 | portmacro.h file for the port being used. That scheme was deprecated in favour 38 | of setting the compiler's include path such that it found the correct 39 | portmacro.h file - removing the need for the constant and allowing the 40 | portmacro.h file to be located anywhere in relation to the port being used. 41 | Purely for reasons of backward compatibility the old method is still valid, but 42 | to make it clear that new projects should not use it, support for the port 43 | specific constants has been moved into the deprecated_definitions.h header 44 | file. */ 45 | #include "deprecated_definitions.h" 46 | 47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h 48 | did not result in a portmacro.h header file being included - and it should be 49 | included here. In this case the path to the correct portmacro.h header file 50 | must be set in the compiler's include path. */ 51 | #ifndef portENTER_CRITICAL 52 | #include "portmacro.h" 53 | #endif 54 | 55 | #if portBYTE_ALIGNMENT == 32 56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f ) 57 | #endif 58 | 59 | #if portBYTE_ALIGNMENT == 16 60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f ) 61 | #endif 62 | 63 | #if portBYTE_ALIGNMENT == 8 64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) 65 | #endif 66 | 67 | #if portBYTE_ALIGNMENT == 4 68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 ) 69 | #endif 70 | 71 | #if portBYTE_ALIGNMENT == 2 72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 ) 73 | #endif 74 | 75 | #if portBYTE_ALIGNMENT == 1 76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 ) 77 | #endif 78 | 79 | #ifndef portBYTE_ALIGNMENT_MASK 80 | #error "Invalid portBYTE_ALIGNMENT definition" 81 | #endif 82 | 83 | #ifndef portNUM_CONFIGURABLE_REGIONS 84 | #define portNUM_CONFIGURABLE_REGIONS 1 85 | #endif 86 | 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | #include "mpu_wrappers.h" 92 | 93 | /* 94 | * Setup the stack of a new task so it is ready to be placed under the 95 | * scheduler control. The registers have to be placed on the stack in 96 | * the order that the port expects to find them. 97 | * 98 | */ 99 | #if( portUSING_MPU_WRAPPERS == 1 ) 100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; 101 | #else 102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; 103 | #endif 104 | 105 | /* Used by heap_5.c. */ 106 | typedef struct HeapRegion 107 | { 108 | uint8_t *pucStartAddress; 109 | size_t xSizeInBytes; 110 | } HeapRegion_t; 111 | 112 | /* 113 | * Used to define multiple heap regions for use by heap_5.c. This function 114 | * must be called before any calls to pvPortMalloc() - not creating a task, 115 | * queue, semaphore, mutex, software timer, event group, etc. will result in 116 | * pvPortMalloc being called. 117 | * 118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which 119 | * defines a region of memory that can be used as the heap. The array is 120 | * terminated by a HeapRegions_t structure that has a size of 0. The region 121 | * with the lowest start address must appear first in the array. 122 | */ 123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION; 124 | 125 | 126 | /* 127 | * Map to the memory management routines required for the port. 128 | */ 129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; 130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION; 131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; 132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; 133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; 134 | 135 | /* 136 | * Setup the hardware ready for the scheduler to take control. This generally 137 | * sets up a tick interrupt and sets timers for the correct tick frequency. 138 | */ 139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; 140 | 141 | /* 142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so 143 | * the hardware is left in its original condition after the scheduler stops 144 | * executing. 145 | */ 146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; 147 | 148 | /* 149 | * The structures and methods of manipulating the MPU are contained within the 150 | * port layer. 151 | * 152 | * Fills the xMPUSettings structure with the memory region information 153 | * contained in xRegions. 154 | */ 155 | #if( portUSING_MPU_WRAPPERS == 1 ) 156 | struct xMEMORY_REGION; 157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; 158 | #endif 159 | 160 | #ifdef __cplusplus 161 | } 162 | #endif 163 | 164 | #endif /* PORTABLE_H */ 165 | 166 | -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef PROJDEFS_H 29 | #define PROJDEFS_H 30 | 31 | /* 32 | * Defines the prototype to which task functions must conform. Defined in this 33 | * file to ensure the type is known before portable.h is included. 34 | */ 35 | typedef void (*TaskFunction_t)( void * ); 36 | 37 | /* Converts a time in milliseconds to a time in ticks. This macro can be 38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 39 | definition here is not suitable for your application. */ 40 | #ifndef pdMS_TO_TICKS 41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) ) 42 | #endif 43 | 44 | #define pdFALSE ( ( BaseType_t ) 0 ) 45 | #define pdTRUE ( ( BaseType_t ) 1 ) 46 | 47 | #define pdPASS ( pdTRUE ) 48 | #define pdFAIL ( pdFALSE ) 49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 51 | 52 | /* FreeRTOS error definitions. */ 53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 54 | #define errQUEUE_BLOCKED ( -4 ) 55 | #define errQUEUE_YIELD ( -5 ) 56 | 57 | /* Macros used for basic data corruption checks. */ 58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 60 | #endif 61 | 62 | #if( configUSE_16_BIT_TICKS == 1 ) 63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 64 | #else 65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 66 | #endif 67 | 68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 69 | itself. */ 70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 110 | 111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 112 | itself. */ 113 | #define pdFREERTOS_LITTLE_ENDIAN 0 114 | #define pdFREERTOS_BIG_ENDIAN 1 115 | 116 | /* Re-defining endian values for generic naming. */ 117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN 118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN 119 | 120 | 121 | #endif /* PROJDEFS_H */ 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /config/platform/Middlewares/Third_Party/FreeRTOS/Source/include/stack_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | /* 32 | * Call the stack overflow hook function if the stack of the task being swapped 33 | * out is currently overflowed, or looks like it might have overflowed in the 34 | * past. 35 | * 36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 37 | * the current stack state only - comparing the current top of stack value to 38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 39 | * will also cause the last few stack bytes to be checked to ensure the value 40 | * to which the bytes were set when the task was created have not been 41 | * overwritten. Note this second test does not guarantee that an overflowed 42 | * stack will always be recognised. 43 | */ 44 | 45 | /*-----------------------------------------------------------*/ 46 | 47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 48 | 49 | /* Only the current stack state is to be checked. */ 50 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 51 | { \ 52 | /* Is the currently saved stack pointer within the stack limit? */ \ 53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 54 | { \ 55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 56 | } \ 57 | } 58 | 59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 60 | /*-----------------------------------------------------------*/ 61 | 62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 63 | 64 | /* Only the current stack state is to be checked. */ 65 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 66 | { \ 67 | \ 68 | /* Is the currently saved stack pointer within the stack limit? */ \ 69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 70 | { \ 71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 72 | } \ 73 | } 74 | 75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 76 | /*-----------------------------------------------------------*/ 77 | 78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 79 | 80 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 81 | { \ 82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 84 | \ 85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 86 | ( pulStack[ 1 ] != ulCheckValue ) || \ 87 | ( pulStack[ 2 ] != ulCheckValue ) || \ 88 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 89 | { \ 90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 91 | } \ 92 | } 93 | 94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 95 | /*-----------------------------------------------------------*/ 96 | 97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 98 | 99 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 100 | { \ 101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 107 | \ 108 | \ 109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 110 | \ 111 | /* Has the extremity of the task stack ever been written over? */ \ 112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 113 | { \ 114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 115 | } \ 116 | } 117 | 118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 119 | /*-----------------------------------------------------------*/ 120 | 121 | /* Remove stack overflow macro if not being used. */ 122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 123 | #define taskCHECK_FOR_STACK_OVERFLOW() 124 | #endif 125 | 126 | 127 | 128 | #endif /* STACK_MACROS_H */ 129 | 130 | -------------------------------------------------------------------------------- /config/platform/STM32H743ZITx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Author : Auto-generated by Ac6 System Workbench 8 | ** 9 | ** Abstract : Linker script for STM32H743ZITx series 10 | ** 2048Kbytes FLASH and 1056Kbytes RAM 11 | ** 12 | ** Set heap size, stack size and stack location according 13 | ** to application requirements. 14 | ** 15 | ** Set memory bank area and size if external memory is used. 16 | ** 17 | ** Target : STMicroelectronics STM32 18 | ** 19 | ** Distribution: The file is distributed “as is,” without any warranty 20 | ** of any kind. 21 | ** 22 | ***************************************************************************** 23 | ** @attention 24 | ** 25 | **

© COPYRIGHT(c) 2014 Ac6

26 | ** 27 | ** Redistribution and use in source and binary forms, with or without modification, 28 | ** are permitted provided that the following conditions are met: 29 | ** 1. Redistributions of source code must retain the above copyright notice, 30 | ** this list of conditions and the following disclaimer. 31 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 32 | ** this list of conditions and the following disclaimer in the documentation 33 | ** and/or other materials provided with the distribution. 34 | ** 3. Neither the name of Ac6 nor the names of its contributors 35 | ** may be used to endorse or promote products derived from this software 36 | ** without specific prior written permission. 37 | ** 38 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 44 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 45 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | ** 49 | ***************************************************************************** 50 | */ 51 | 52 | /* Entry Point */ 53 | ENTRY(Reset_Handler) 54 | 55 | /* Highest address of the user mode stack */ 56 | _estack = 0x20020000; /* end of RAM */ 57 | /* Generate a link error if heap and stack don't fit into RAM */ 58 | _Min_Heap_Size = 0x200; /* required amount of heap */ 59 | _Min_Stack_Size = 0x400; /* required amount of stack */ 60 | 61 | /* Specify the memory areas */ 62 | MEMORY 63 | { 64 | DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 65 | RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K 66 | RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K 67 | RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K 68 | ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K 69 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K 70 | } 71 | 72 | /* Define output sections */ 73 | SECTIONS 74 | { 75 | /* The startup code goes first into FLASH */ 76 | .isr_vector : 77 | { 78 | . = ALIGN(4); 79 | KEEP(*(.isr_vector)) /* Startup code */ 80 | . = ALIGN(4); 81 | } >FLASH 82 | 83 | /* The program code and other data goes into FLASH */ 84 | .text : 85 | { 86 | . = ALIGN(4); 87 | *(.text) /* .text sections (code) */ 88 | *(.text*) /* .text* sections (code) */ 89 | *(.glue_7) /* glue arm to thumb code */ 90 | *(.glue_7t) /* glue thumb to arm code */ 91 | *(.eh_frame) 92 | 93 | KEEP (*(.init)) 94 | KEEP (*(.fini)) 95 | 96 | . = ALIGN(4); 97 | _etext = .; /* define a global symbols at end of code */ 98 | } >FLASH 99 | 100 | /* Constant data goes into FLASH */ 101 | .rodata : 102 | { 103 | . = ALIGN(4); 104 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 105 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 106 | . = ALIGN(4); 107 | } >FLASH 108 | 109 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 110 | .ARM : { 111 | __exidx_start = .; 112 | *(.ARM.exidx*) 113 | __exidx_end = .; 114 | } >FLASH 115 | 116 | .preinit_array : 117 | { 118 | PROVIDE_HIDDEN (__preinit_array_start = .); 119 | KEEP (*(.preinit_array*)) 120 | PROVIDE_HIDDEN (__preinit_array_end = .); 121 | } >FLASH 122 | .init_array : 123 | { 124 | PROVIDE_HIDDEN (__init_array_start = .); 125 | KEEP (*(SORT(.init_array.*))) 126 | KEEP (*(.init_array*)) 127 | PROVIDE_HIDDEN (__init_array_end = .); 128 | } >FLASH 129 | .fini_array : 130 | { 131 | PROVIDE_HIDDEN (__fini_array_start = .); 132 | KEEP (*(SORT(.fini_array.*))) 133 | KEEP (*(.fini_array*)) 134 | PROVIDE_HIDDEN (__fini_array_end = .); 135 | } >FLASH 136 | 137 | /* used by the startup to initialize data */ 138 | _sidata = LOADADDR(.data); 139 | 140 | /* Initialized data sections goes into RAM, load LMA copy after code */ 141 | .data : 142 | { 143 | . = ALIGN(4); 144 | _sdata = .; /* create a global symbol at data start */ 145 | *(.data) /* .data sections */ 146 | *(.data*) /* .data* sections */ 147 | 148 | . = ALIGN(4); 149 | _edata = .; /* define a global symbol at data end */ 150 | } >DTCMRAM AT> FLASH 151 | 152 | 153 | /* Uninitialized data section */ 154 | . = ALIGN(4); 155 | .bss : 156 | { 157 | /* This is used by the startup in order to initialize the .bss secion */ 158 | _sbss = .; /* define a global symbol at bss start */ 159 | __bss_start__ = _sbss; 160 | *(.bss) 161 | *(.bss*) 162 | *(COMMON) 163 | 164 | . = ALIGN(4); 165 | _ebss = .; /* define a global symbol at bss end */ 166 | __bss_end__ = _ebss; 167 | } >DTCMRAM 168 | 169 | /* User_heap_stack section, used to check that there is enough RAM left */ 170 | ._user_heap_stack : 171 | { 172 | . = ALIGN(8); 173 | PROVIDE ( end = . ); 174 | PROVIDE ( _end = . ); 175 | . = . + _Min_Heap_Size; 176 | . = . + _Min_Stack_Size; 177 | . = ALIGN(8); 178 | } >DTCMRAM 179 | 180 | 181 | 182 | /* Remove information from the standard libraries */ 183 | /DISCARD/ : 184 | { 185 | libc.a ( * ) 186 | libm.a ( * ) 187 | libgcc.a ( * ) 188 | } 189 | 190 | .ARM.attributes 0 : { *(.ARM.attributes) } 191 | } 192 | 193 | 194 | -------------------------------------------------------------------------------- /config/platform/Src/freertos.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : freertos.c 5 | * Description : Code for freertos applications 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "FreeRTOS.h" 23 | #include "task.h" 24 | #include "main.h" 25 | 26 | /* Private includes ----------------------------------------------------------*/ 27 | /* USER CODE BEGIN Includes */ 28 | 29 | /* USER CODE END Includes */ 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* USER CODE BEGIN PTD */ 33 | 34 | /* USER CODE END PTD */ 35 | 36 | /* Private define ------------------------------------------------------------*/ 37 | /* USER CODE BEGIN PD */ 38 | 39 | /* USER CODE END PD */ 40 | 41 | /* Private macro -------------------------------------------------------------*/ 42 | /* USER CODE BEGIN PM */ 43 | 44 | /* USER CODE END PM */ 45 | 46 | /* Private variables ---------------------------------------------------------*/ 47 | /* USER CODE BEGIN Variables */ 48 | 49 | /* USER CODE END Variables */ 50 | 51 | /* Private function prototypes -----------------------------------------------*/ 52 | /* USER CODE BEGIN FunctionPrototypes */ 53 | 54 | /* USER CODE END FunctionPrototypes */ 55 | 56 | /* Private application code --------------------------------------------------*/ 57 | /* USER CODE BEGIN Application */ 58 | 59 | /* USER CODE END Application */ 60 | 61 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 62 | -------------------------------------------------------------------------------- /config/platform/Src/stm32h7xx_hal_timebase_tim.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_hal_timebase_TIM.c 5 | * @brief HAL time base based on the hardware TIM. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32h7xx_hal.h" 23 | #include "stm32h7xx_hal_tim.h" 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | /* Private macro -------------------------------------------------------------*/ 28 | /* Private variables ---------------------------------------------------------*/ 29 | TIM_HandleTypeDef htim1; 30 | /* Private function prototypes -----------------------------------------------*/ 31 | /* Private functions ---------------------------------------------------------*/ 32 | 33 | /** 34 | * @brief This function configures the TIM1 as a time base source. 35 | * The time source is configured to have 1ms time base with a dedicated 36 | * Tick interrupt priority. 37 | * @note This function is called automatically at the beginning of program after 38 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 39 | * @param TickPriority: Tick interrupt priority. 40 | * @retval HAL status 41 | */ 42 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 43 | { 44 | RCC_ClkInitTypeDef clkconfig; 45 | uint32_t uwTimclock = 0; 46 | uint32_t uwPrescalerValue = 0; 47 | uint32_t pFLatency; 48 | 49 | /*Configure the TIM1 IRQ priority */ 50 | HAL_NVIC_SetPriority(TIM1_UP_IRQn, TickPriority ,0); 51 | 52 | /* Enable the TIM1 global Interrupt */ 53 | HAL_NVIC_EnableIRQ(TIM1_UP_IRQn); 54 | 55 | /* Enable TIM1 clock */ 56 | __HAL_RCC_TIM1_CLK_ENABLE(); 57 | 58 | /* Get clock configuration */ 59 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 60 | 61 | /* Compute TIM1 clock */ 62 | uwTimclock = HAL_RCC_GetPCLK2Freq(); 63 | 64 | /* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */ 65 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1); 66 | 67 | /* Initialize TIM1 */ 68 | htim1.Instance = TIM1; 69 | 70 | /* Initialize TIMx peripheral as follow: 71 | + Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base. 72 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 73 | + ClockDivision = 0 74 | + Counter direction = Up 75 | */ 76 | htim1.Init.Period = (1000000 / 1000) - 1; 77 | htim1.Init.Prescaler = uwPrescalerValue; 78 | htim1.Init.ClockDivision = 0; 79 | htim1.Init.CounterMode = TIM_COUNTERMODE_UP; 80 | if(HAL_TIM_Base_Init(&htim1) == HAL_OK) 81 | { 82 | /* Start the TIM time Base generation in interrupt mode */ 83 | return HAL_TIM_Base_Start_IT(&htim1); 84 | } 85 | 86 | /* Return function status */ 87 | return HAL_ERROR; 88 | } 89 | 90 | /** 91 | * @brief Suspend Tick increment. 92 | * @note Disable the tick increment by disabling TIM1 update interrupt. 93 | * @param None 94 | * @retval None 95 | */ 96 | void HAL_SuspendTick(void) 97 | { 98 | /* Disable TIM1 update Interrupt */ 99 | __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE); 100 | } 101 | 102 | /** 103 | * @brief Resume Tick increment. 104 | * @note Enable the tick increment by Enabling TIM1 update interrupt. 105 | * @param None 106 | * @retval None 107 | */ 108 | void HAL_ResumeTick(void) 109 | { 110 | /* Enable TIM1 Update interrupt */ 111 | __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE); 112 | } 113 | 114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /config/platform/Src/stm32h7xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32h7xx_it.h" 24 | #include "FreeRTOS.h" 25 | #include "task.h" 26 | /* Private includes ----------------------------------------------------------*/ 27 | /* USER CODE BEGIN Includes */ 28 | /* USER CODE END Includes */ 29 | 30 | /* Private typedef -----------------------------------------------------------*/ 31 | /* USER CODE BEGIN TD */ 32 | 33 | /* USER CODE END TD */ 34 | 35 | /* Private define ------------------------------------------------------------*/ 36 | /* USER CODE BEGIN PD */ 37 | 38 | /* USER CODE END PD */ 39 | 40 | /* Private macro -------------------------------------------------------------*/ 41 | /* USER CODE BEGIN PM */ 42 | 43 | /* USER CODE END PM */ 44 | 45 | /* Private variables ---------------------------------------------------------*/ 46 | /* USER CODE BEGIN PV */ 47 | 48 | /* USER CODE END PV */ 49 | 50 | /* Private function prototypes -----------------------------------------------*/ 51 | /* USER CODE BEGIN PFP */ 52 | 53 | /* USER CODE END PFP */ 54 | 55 | /* Private user code ---------------------------------------------------------*/ 56 | /* USER CODE BEGIN 0 */ 57 | 58 | /* USER CODE END 0 */ 59 | 60 | /* External variables --------------------------------------------------------*/ 61 | extern TIM_HandleTypeDef htim1; 62 | 63 | /* USER CODE BEGIN EV */ 64 | 65 | /* USER CODE END EV */ 66 | 67 | /******************************************************************************/ 68 | /* Cortex Processor Interruption and Exception Handlers */ 69 | /******************************************************************************/ 70 | /** 71 | * @brief This function handles Non maskable interrupt. 72 | */ 73 | void NMI_Handler(void) 74 | { 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 76 | 77 | /* USER CODE END NonMaskableInt_IRQn 0 */ 78 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 79 | 80 | /* USER CODE END NonMaskableInt_IRQn 1 */ 81 | } 82 | 83 | /** 84 | * @brief This function handles Hard fault interrupt. 85 | */ 86 | void HardFault_Handler(void) 87 | { 88 | /* USER CODE BEGIN HardFault_IRQn 0 */ 89 | 90 | /* USER CODE END HardFault_IRQn 0 */ 91 | while (1) 92 | { 93 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 94 | /* USER CODE END W1_HardFault_IRQn 0 */ 95 | } 96 | } 97 | 98 | /** 99 | * @brief This function handles Memory management fault. 100 | */ 101 | void MemManage_Handler(void) 102 | { 103 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 104 | 105 | /* USER CODE END MemoryManagement_IRQn 0 */ 106 | while (1) 107 | { 108 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 109 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 110 | } 111 | } 112 | 113 | /** 114 | * @brief This function handles Pre-fetch fault, memory access fault. 115 | */ 116 | void BusFault_Handler(void) 117 | { 118 | /* USER CODE BEGIN BusFault_IRQn 0 */ 119 | 120 | /* USER CODE END BusFault_IRQn 0 */ 121 | while (1) 122 | { 123 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 124 | /* USER CODE END W1_BusFault_IRQn 0 */ 125 | } 126 | } 127 | 128 | /** 129 | * @brief This function handles Undefined instruction or illegal state. 130 | */ 131 | void UsageFault_Handler(void) 132 | { 133 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 134 | 135 | /* USER CODE END UsageFault_IRQn 0 */ 136 | while (1) 137 | { 138 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 139 | /* USER CODE END W1_UsageFault_IRQn 0 */ 140 | } 141 | } 142 | 143 | /** 144 | * @brief This function handles Debug monitor. 145 | */ 146 | void DebugMon_Handler(void) 147 | { 148 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 149 | 150 | /* USER CODE END DebugMonitor_IRQn 0 */ 151 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 152 | 153 | /* USER CODE END DebugMonitor_IRQn 1 */ 154 | } 155 | 156 | /******************************************************************************/ 157 | /* STM32H7xx Peripheral Interrupt Handlers */ 158 | /* Add here the Interrupt Handlers for the used peripherals. */ 159 | /* For the available peripheral interrupt handler names, */ 160 | /* please refer to the startup file (startup_stm32h7xx.s). */ 161 | /******************************************************************************/ 162 | 163 | /** 164 | * @brief This function handles TIM1 update interrupt. 165 | */ 166 | void TIM1_UP_IRQHandler(void) 167 | { 168 | /* USER CODE BEGIN TIM1_UP_IRQn 0 */ 169 | 170 | /* USER CODE END TIM1_UP_IRQn 0 */ 171 | HAL_TIM_IRQHandler(&htim1); 172 | /* USER CODE BEGIN TIM1_UP_IRQn 1 */ 173 | 174 | /* USER CODE END TIM1_UP_IRQn 1 */ 175 | } 176 | 177 | /* USER CODE BEGIN 1 */ 178 | 179 | /* USER CODE END 1 */ 180 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 181 | -------------------------------------------------------------------------------- /docs/meson.build: -------------------------------------------------------------------------------- 1 | # new configuration data object 2 | cdata = configuration_data() 3 | 4 | # set parameters for cdata object 5 | cdata.set('PROJECT_NAME', meson.project_name()) 6 | cdata.set('VERSION', meson.project_version()) 7 | cdata.set('SOURCE_DIR', join_paths(meson.source_root(),'src')) 8 | cdata.set('OUTPUT_DIR', join_paths(meson.build_root(),'docs')) 9 | cdata.set('README_PATH', join_paths(meson.source_root(),'README.md')) 10 | 11 | dot = find_program(['dot', 12 | 'C:\Program Files (x86)\Graphviz2.38\\bin\dot.exe'], 13 | required : get_option('enable_graphs')) 14 | 15 | if dot.found() 16 | message('Configuring Doxygen with Dot') 17 | cdata.set('HAVE_DOT', 'YES') 18 | cdata.set('DOT_PATH', dot.path()) 19 | else 20 | warning('Dot not found, doxygen wont generate graphs') 21 | cdata.set('HAVE_DOT', 'NO') 22 | endif 23 | 24 | doxyfile = configure_file( 25 | input: 'Doxyfile.in', 26 | output: 'Doxyfile', 27 | configuration: cdata, 28 | install: false 29 | ) 30 | 31 | doxygen = find_program('doxygen') 32 | 33 | doc_target = run_target('docs', command: [doxygen, doxyfile]) 34 | -------------------------------------------------------------------------------- /env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONTAINER="meson_env" 4 | 5 | docker build config/ -t $CONTAINER 6 | docker run -it -v $(pwd):/project -h build $CONTAINER bash 7 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | # general project settings 2 | project('stmh7', 'c', 'cpp', 3 | version : '1.0', 4 | default_options : [ 5 | 'b_lto=false', 6 | #'b_asneeded=false', 7 | #'b_lundef=false', 8 | 'b_pch=false', 9 | 'b_staticpic=false', 10 | 'c_std=c99', 11 | 'cpp_std=c++11' 12 | ], 13 | meson_version : '>=0.51.0') 14 | 15 | # global variables tracking sources and includes 16 | c_args = [] 17 | c_link_args = [] 18 | project_src = [] 19 | project_inc = [] 20 | test_src = [] 21 | test_inc = [] 22 | link_deps = [] 23 | 24 | # find external programs from path (OS independant) 25 | size = find_program('arm-none-eabi-size') 26 | objcopy = find_program('arm-none-eabi-objcopy') 27 | stmprog = find_program(['STM32_Programmer_CLI', 28 | 'C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\\bin\STM32_Programmer_CLI.exe'], 29 | required : false) 30 | 31 | # retrieve properties from cross compile file 32 | if meson.is_cross_build() 33 | #c_args = meson.get_cross_property('c_cross_args') 34 | #c_link_args = meson.get_cross_property('c_cross_link_args') 35 | endif 36 | 37 | # microcontroller specific settings 38 | defines = [ 39 | '-DUSE_HAL_DRIVER', 40 | '-DSTM32H743xx', 41 | ] 42 | 43 | linkerfile = files('src/STM32H743ZITx_FLASH.ld') 44 | startupfile = files('src/startup_stm32h743xx.s') 45 | 46 | # add defines to the c_args 47 | c_args += defines 48 | #c_args += '-U_FILE_OFFSET_BITS' 49 | 50 | # add the linker script to flags 51 | c_link_args += '-Wl,-T@0@/@1@'.format(meson.current_source_dir(), linkerfile[0]) 52 | 53 | # include doxygen generation if enabled 54 | if get_option('enable_docs') 55 | subdir('docs') 56 | endif 57 | 58 | # include tests if enabled 59 | if get_option('enable_test') 60 | subdir('test') 61 | endif 62 | 63 | # include the source files of the project 64 | subdir('src') 65 | 66 | # compile the main executable 67 | main = executable('main', 68 | [project_src, startupfile], 69 | name_suffix : 'elf', 70 | c_args : c_args, 71 | link_args : [c_link_args, '-Wl,--gc-sections'], 72 | dependencies : link_deps, 73 | include_directories : [project_inc]) 74 | 75 | # cutom target to always convert main.elf to binary 76 | mainbin = custom_target('main.bin', 77 | output : 'main.bin', 78 | build_by_default : true, 79 | command : [objcopy, ['-O', 'binary', '-S', main.full_path(), 'main.bin']], 80 | depends : main) 81 | 82 | # ouput size of the .elf 83 | run_target('size', 84 | command : [size, main.full_path()], 85 | depends : main) 86 | 87 | # upload the binary to the microcontroller 88 | if not stmprog.found() 89 | warning('STM32_Programmer_CLI not found, flashing not possible') 90 | else 91 | run_target('flash', 92 | command : [stmprog, '-c', 'port=SWD', '-w', mainbin.full_path(), '0x08000000', '-v', '-hardRst'], 93 | depends : mainbin) 94 | endif 95 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('enable_test', 2 | type : 'boolean', 3 | value : true, 4 | description : 'Enable tests') 5 | 6 | option('enable_docs', 7 | type : 'boolean', 8 | value : true, 9 | description : 'Generate documentation with doxygen') 10 | 11 | option('enable_graphs', 12 | type : 'boolean', 13 | value : true, 14 | description : 'Enable doxygen to generate graphs using dot') 15 | -------------------------------------------------------------------------------- /src/BSP/meson.build: -------------------------------------------------------------------------------- 1 | bsp_src = files('stm32h7xx_nucleo_144.c') 2 | -------------------------------------------------------------------------------- /src/STM32H743ZITx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Author : Auto-generated by Ac6 System Workbench 8 | ** 9 | ** Abstract : Linker script for STM32H743ZITx series 10 | ** 2048Kbytes FLASH and 1056Kbytes RAM 11 | ** 12 | ** Set heap size, stack size and stack location according 13 | ** to application requirements. 14 | ** 15 | ** Set memory bank area and size if external memory is used. 16 | ** 17 | ** Target : STMicroelectronics STM32 18 | ** 19 | ** Distribution: The file is distributed “as is,” without any warranty 20 | ** of any kind. 21 | ** 22 | ***************************************************************************** 23 | ** @attention 24 | ** 25 | **

© COPYRIGHT(c) 2014 Ac6

26 | ** 27 | ** Redistribution and use in source and binary forms, with or without modification, 28 | ** are permitted provided that the following conditions are met: 29 | ** 1. Redistributions of source code must retain the above copyright notice, 30 | ** this list of conditions and the following disclaimer. 31 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 32 | ** this list of conditions and the following disclaimer in the documentation 33 | ** and/or other materials provided with the distribution. 34 | ** 3. Neither the name of Ac6 nor the names of its contributors 35 | ** may be used to endorse or promote products derived from this software 36 | ** without specific prior written permission. 37 | ** 38 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 44 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 45 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | ** 49 | ***************************************************************************** 50 | */ 51 | 52 | /* Entry Point */ 53 | ENTRY(Reset_Handler) 54 | 55 | /* Highest address of the user mode stack */ 56 | _estack = 0x20020000; /* end of RAM */ 57 | /* Generate a link error if heap and stack don't fit into RAM */ 58 | _Min_Heap_Size = 0x200; /* required amount of heap */ 59 | _Min_Stack_Size = 0x400; /* required amount of stack */ 60 | 61 | /* Specify the memory areas */ 62 | MEMORY 63 | { 64 | DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 65 | RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K 66 | RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K 67 | RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K 68 | ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K 69 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K 70 | } 71 | 72 | /* Define output sections */ 73 | SECTIONS 74 | { 75 | /* The startup code goes first into FLASH */ 76 | .isr_vector : 77 | { 78 | . = ALIGN(4); 79 | KEEP(*(.isr_vector)) /* Startup code */ 80 | . = ALIGN(4); 81 | } >FLASH 82 | 83 | /* The program code and other data goes into FLASH */ 84 | .text : 85 | { 86 | . = ALIGN(4); 87 | *(.text) /* .text sections (code) */ 88 | *(.text*) /* .text* sections (code) */ 89 | *(.glue_7) /* glue arm to thumb code */ 90 | *(.glue_7t) /* glue thumb to arm code */ 91 | *(.eh_frame) 92 | 93 | KEEP (*(.init)) 94 | KEEP (*(.fini)) 95 | 96 | . = ALIGN(4); 97 | _etext = .; /* define a global symbols at end of code */ 98 | } >FLASH 99 | 100 | /* Constant data goes into FLASH */ 101 | .rodata : 102 | { 103 | . = ALIGN(4); 104 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 105 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 106 | . = ALIGN(4); 107 | } >FLASH 108 | 109 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 110 | .ARM : { 111 | __exidx_start = .; 112 | *(.ARM.exidx*) 113 | __exidx_end = .; 114 | } >FLASH 115 | 116 | .preinit_array : 117 | { 118 | PROVIDE_HIDDEN (__preinit_array_start = .); 119 | KEEP (*(.preinit_array*)) 120 | PROVIDE_HIDDEN (__preinit_array_end = .); 121 | } >FLASH 122 | .init_array : 123 | { 124 | PROVIDE_HIDDEN (__init_array_start = .); 125 | KEEP (*(SORT(.init_array.*))) 126 | KEEP (*(.init_array*)) 127 | PROVIDE_HIDDEN (__init_array_end = .); 128 | } >FLASH 129 | .fini_array : 130 | { 131 | PROVIDE_HIDDEN (__fini_array_start = .); 132 | KEEP (*(SORT(.fini_array.*))) 133 | KEEP (*(.fini_array*)) 134 | PROVIDE_HIDDEN (__fini_array_end = .); 135 | } >FLASH 136 | 137 | /* used by the startup to initialize data */ 138 | _sidata = LOADADDR(.data); 139 | 140 | /* Initialized data sections goes into RAM, load LMA copy after code */ 141 | .data : 142 | { 143 | . = ALIGN(4); 144 | _sdata = .; /* create a global symbol at data start */ 145 | *(.data) /* .data sections */ 146 | *(.data*) /* .data* sections */ 147 | 148 | . = ALIGN(4); 149 | _edata = .; /* define a global symbol at data end */ 150 | } >DTCMRAM AT> FLASH 151 | 152 | 153 | /* Uninitialized data section */ 154 | . = ALIGN(4); 155 | .bss : 156 | { 157 | /* This is used by the startup in order to initialize the .bss secion */ 158 | _sbss = .; /* define a global symbol at bss start */ 159 | __bss_start__ = _sbss; 160 | *(.bss) 161 | *(.bss*) 162 | *(COMMON) 163 | 164 | . = ALIGN(4); 165 | _ebss = .; /* define a global symbol at bss end */ 166 | __bss_end__ = _ebss; 167 | } >DTCMRAM 168 | 169 | /* User_heap_stack section, used to check that there is enough RAM left */ 170 | ._user_heap_stack : 171 | { 172 | . = ALIGN(8); 173 | PROVIDE ( end = . ); 174 | PROVIDE ( _end = . ); 175 | . = . + _Min_Heap_Size; 176 | . = . + _Min_Stack_Size; 177 | . = ALIGN(8); 178 | } >DTCMRAM 179 | 180 | 181 | 182 | /* Remove information from the standard libraries */ 183 | /DISCARD/ : 184 | { 185 | libc.a ( * ) 186 | libm.a ( * ) 187 | libgcc.a ( * ) 188 | } 189 | 190 | .ARM.attributes 0 : { *(.ARM.attributes) } 191 | } 192 | 193 | 194 | -------------------------------------------------------------------------------- /src/application/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /* 3 | * FreeRTOS Kernel V10.0.1 4 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | * this software and associated documentation files (the "Software"), to deal in 8 | * the Software without restriction, including without limitation the rights to 9 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | * the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * http://www.FreeRTOS.org 24 | * http://aws.amazon.com/freertos 25 | * 26 | * 1 tab == 4 spaces! 27 | */ 28 | /* USER CODE END Header */ 29 | 30 | #ifndef FREERTOS_CONFIG_H 31 | #define FREERTOS_CONFIG_H 32 | 33 | /*----------------------------------------------------------- 34 | * Application specific definitions. 35 | * 36 | * These definitions should be adjusted for your particular hardware and 37 | * application requirements. 38 | * 39 | * These parameters and more are described within the 'configuration' section of the 40 | * FreeRTOS API documentation available on the FreeRTOS.org web site. 41 | * 42 | * See http://www.freertos.org/a00110.html 43 | *----------------------------------------------------------*/ 44 | 45 | /* USER CODE BEGIN Includes */ 46 | /* Section where include file can be added */ 47 | /* USER CODE END Includes */ 48 | 49 | /* Ensure definitions are only used by the compiler, and not by the assembler. */ 50 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 51 | #include 52 | extern uint32_t SystemCoreClock; 53 | #endif 54 | #define configUSE_PREEMPTION 1 55 | #define configSUPPORT_STATIC_ALLOCATION 1 56 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 57 | #define configUSE_IDLE_HOOK 0 58 | #define configUSE_TICK_HOOK 0 59 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 60 | #define configTICK_RATE_HZ ((TickType_t)1000) 61 | #define configMAX_PRIORITIES ( 56 ) 62 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 63 | #define configTOTAL_HEAP_SIZE ((size_t)15360) 64 | #define configMAX_TASK_NAME_LEN ( 16 ) 65 | #define configUSE_TRACE_FACILITY 1 66 | #define configUSE_16_BIT_TICKS 0 67 | #define configUSE_MUTEXES 1 68 | #define configQUEUE_REGISTRY_SIZE 8 69 | #define configUSE_RECURSIVE_MUTEXES 1 70 | #define configUSE_COUNTING_SEMAPHORES 1 71 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 72 | 73 | /* Co-routine definitions. */ 74 | #define configUSE_CO_ROUTINES 0 75 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 76 | 77 | /* Software timer definitions. */ 78 | #define configUSE_TIMERS 1 79 | #define configTIMER_TASK_PRIORITY ( 2 ) 80 | #define configTIMER_QUEUE_LENGTH 10 81 | #define configTIMER_TASK_STACK_DEPTH 256 82 | 83 | /* Set the following definitions to 1 to include the API function, or zero 84 | to exclude the API function. */ 85 | #define INCLUDE_vTaskPrioritySet 1 86 | #define INCLUDE_uxTaskPriorityGet 1 87 | #define INCLUDE_vTaskDelete 1 88 | #define INCLUDE_vTaskCleanUpResources 0 89 | #define INCLUDE_vTaskSuspend 1 90 | #define INCLUDE_vTaskDelayUntil 1 91 | #define INCLUDE_vTaskDelay 1 92 | #define INCLUDE_xTaskGetSchedulerState 1 93 | #define INCLUDE_xTimerPendFunctionCall 1 94 | #define INCLUDE_xQueueGetMutexHolder 1 95 | #define INCLUDE_uxTaskGetStackHighWaterMark 1 96 | #define INCLUDE_eTaskGetState 1 97 | 98 | /* 99 | * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used 100 | * by the application thus the correct define need to be enabled below 101 | */ 102 | #define USE_FreeRTOS_HEAP_4 103 | 104 | /* Cortex-M specific definitions. */ 105 | #ifdef __NVIC_PRIO_BITS 106 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 107 | #define configPRIO_BITS __NVIC_PRIO_BITS 108 | #else 109 | #define configPRIO_BITS 4 110 | #endif 111 | 112 | /* The lowest interrupt priority that can be used in a call to a "set priority" 113 | function. */ 114 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 115 | 116 | /* The highest interrupt priority that can be used by any interrupt service 117 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 118 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 119 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 120 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 121 | 122 | /* Interrupt priorities used by the kernel port layer itself. These are generic 123 | to all Cortex-M ports, and do not rely on any particular library functions. */ 124 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 125 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 126 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 127 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 128 | 129 | /* Normal assert() semantics without relying on the provision of an assert.h 130 | header file. */ 131 | /* USER CODE BEGIN 1 */ 132 | #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} 133 | /* USER CODE END 1 */ 134 | 135 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 136 | standard names. */ 137 | #define vPortSVCHandler SVC_Handler 138 | #define xPortPendSVHandler PendSV_Handler 139 | 140 | /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, 141 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 142 | #define xPortSysTickHandler SysTick_Handler 143 | 144 | /* USER CODE BEGIN Defines */ 145 | /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ 146 | /* USER CODE END Defines */ 147 | 148 | #endif /* FREERTOS_CONFIG_H */ 149 | -------------------------------------------------------------------------------- /src/application/freertos.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : freertos.c 5 | * Description : Code for freertos applications 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "FreeRTOS.h" 23 | #include "task.h" 24 | #include "main.h" 25 | 26 | /* Private includes ----------------------------------------------------------*/ 27 | /* USER CODE BEGIN Includes */ 28 | 29 | /* USER CODE END Includes */ 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* USER CODE BEGIN PTD */ 33 | 34 | /* USER CODE END PTD */ 35 | 36 | /* Private define ------------------------------------------------------------*/ 37 | /* USER CODE BEGIN PD */ 38 | 39 | /* USER CODE END PD */ 40 | 41 | /* Private macro -------------------------------------------------------------*/ 42 | /* USER CODE BEGIN PM */ 43 | 44 | /* USER CODE END PM */ 45 | 46 | /* Private variables ---------------------------------------------------------*/ 47 | /* USER CODE BEGIN Variables */ 48 | 49 | /* USER CODE END Variables */ 50 | 51 | /* Private function prototypes -----------------------------------------------*/ 52 | /* USER CODE BEGIN FunctionPrototypes */ 53 | 54 | /* USER CODE END FunctionPrototypes */ 55 | 56 | /* Private application code --------------------------------------------------*/ 57 | /* USER CODE BEGIN Application */ 58 | 59 | /* USER CODE END Application */ 60 | 61 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 62 | -------------------------------------------------------------------------------- /src/application/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MAIN_H 24 | #define __MAIN_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32h7xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | 36 | /* USER CODE END Includes */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN ET */ 40 | 41 | /* USER CODE END ET */ 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* USER CODE BEGIN EC */ 45 | 46 | /* USER CODE END EC */ 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN EM */ 50 | 51 | /* USER CODE END EM */ 52 | 53 | /* Exported functions prototypes ---------------------------------------------*/ 54 | void Error_Handler(void); 55 | 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | /* Private defines -----------------------------------------------------------*/ 61 | #define B1_Pin GPIO_PIN_13 62 | #define B1_GPIO_Port GPIOC 63 | #define LD1_Pin GPIO_PIN_0 64 | #define LD1_GPIO_Port GPIOB 65 | #define LD3_Pin GPIO_PIN_14 66 | #define LD3_GPIO_Port GPIOB 67 | #define STLINK_RX_Pin GPIO_PIN_8 68 | #define STLINK_RX_GPIO_Port GPIOD 69 | #define STLINK_TX_Pin GPIO_PIN_9 70 | #define STLINK_TX_GPIO_Port GPIOD 71 | #define USB_OTG_FS_PWR_EN_Pin GPIO_PIN_10 72 | #define USB_OTG_FS_PWR_EN_GPIO_Port GPIOD 73 | #define USB_OTG_FS_OVCR_Pin GPIO_PIN_7 74 | #define USB_OTG_FS_OVCR_GPIO_Port GPIOG 75 | #define LD2_Pin GPIO_PIN_1 76 | #define LD2_GPIO_Port GPIOE 77 | /* USER CODE BEGIN Private defines */ 78 | 79 | /* USER CODE END Private defines */ 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* __MAIN_H */ 86 | 87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 88 | -------------------------------------------------------------------------------- /src/application/meson.build: -------------------------------------------------------------------------------- 1 | application_src = files( 2 | 'freertos.c', 3 | 'main.c', 4 | 'stm32h7xx_hal_msp.c', 5 | 'stm32h7xx_hal_timebase_tim.c', 6 | 'stm32h7xx_it.c', 7 | 'system_stm32h7xx.c', 8 | ) 9 | -------------------------------------------------------------------------------- /src/application/stm32h7xx_hal_timebase_tim.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_hal_timebase_TIM.c 5 | * @brief HAL time base based on the hardware TIM. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32h7xx_hal.h" 23 | #include "stm32h7xx_hal_tim.h" 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | /* Private macro -------------------------------------------------------------*/ 28 | /* Private variables ---------------------------------------------------------*/ 29 | TIM_HandleTypeDef htim1; 30 | /* Private function prototypes -----------------------------------------------*/ 31 | /* Private functions ---------------------------------------------------------*/ 32 | 33 | /** 34 | * @brief This function configures the TIM1 as a time base source. 35 | * The time source is configured to have 1ms time base with a dedicated 36 | * Tick interrupt priority. 37 | * @note This function is called automatically at the beginning of program after 38 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 39 | * @param TickPriority: Tick interrupt priority. 40 | * @retval HAL status 41 | */ 42 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 43 | { 44 | RCC_ClkInitTypeDef clkconfig; 45 | uint32_t uwTimclock = 0; 46 | uint32_t uwPrescalerValue = 0; 47 | uint32_t pFLatency; 48 | 49 | /*Configure the TIM1 IRQ priority */ 50 | HAL_NVIC_SetPriority(TIM1_UP_IRQn, TickPriority ,0); 51 | 52 | /* Enable the TIM1 global Interrupt */ 53 | HAL_NVIC_EnableIRQ(TIM1_UP_IRQn); 54 | 55 | /* Enable TIM1 clock */ 56 | __HAL_RCC_TIM1_CLK_ENABLE(); 57 | 58 | /* Get clock configuration */ 59 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 60 | 61 | /* Compute TIM1 clock */ 62 | uwTimclock = HAL_RCC_GetPCLK2Freq(); 63 | 64 | /* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */ 65 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1); 66 | 67 | /* Initialize TIM1 */ 68 | htim1.Instance = TIM1; 69 | 70 | /* Initialize TIMx peripheral as follow: 71 | + Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base. 72 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 73 | + ClockDivision = 0 74 | + Counter direction = Up 75 | */ 76 | htim1.Init.Period = (1000000 / 1000) - 1; 77 | htim1.Init.Prescaler = uwPrescalerValue; 78 | htim1.Init.ClockDivision = 0; 79 | htim1.Init.CounterMode = TIM_COUNTERMODE_UP; 80 | if(HAL_TIM_Base_Init(&htim1) == HAL_OK) 81 | { 82 | /* Start the TIM time Base generation in interrupt mode */ 83 | return HAL_TIM_Base_Start_IT(&htim1); 84 | } 85 | 86 | /* Return function status */ 87 | return HAL_ERROR; 88 | } 89 | 90 | /** 91 | * @brief Suspend Tick increment. 92 | * @note Disable the tick increment by disabling TIM1 update interrupt. 93 | * @param None 94 | * @retval None 95 | */ 96 | void HAL_SuspendTick(void) 97 | { 98 | /* Disable TIM1 update Interrupt */ 99 | __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE); 100 | } 101 | 102 | /** 103 | * @brief Resume Tick increment. 104 | * @note Enable the tick increment by Enabling TIM1 update interrupt. 105 | * @param None 106 | * @retval None 107 | */ 108 | void HAL_ResumeTick(void) 109 | { 110 | /* Enable TIM1 Update interrupt */ 111 | __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE); 112 | } 113 | 114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /src/application/stm32h7xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32h7xx_it.h" 24 | #include "FreeRTOS.h" 25 | #include "task.h" 26 | /* Private includes ----------------------------------------------------------*/ 27 | /* USER CODE BEGIN Includes */ 28 | /* USER CODE END Includes */ 29 | 30 | /* Private typedef -----------------------------------------------------------*/ 31 | /* USER CODE BEGIN TD */ 32 | 33 | /* USER CODE END TD */ 34 | 35 | /* Private define ------------------------------------------------------------*/ 36 | /* USER CODE BEGIN PD */ 37 | 38 | /* USER CODE END PD */ 39 | 40 | /* Private macro -------------------------------------------------------------*/ 41 | /* USER CODE BEGIN PM */ 42 | 43 | /* USER CODE END PM */ 44 | 45 | /* Private variables ---------------------------------------------------------*/ 46 | /* USER CODE BEGIN PV */ 47 | 48 | /* USER CODE END PV */ 49 | 50 | /* Private function prototypes -----------------------------------------------*/ 51 | /* USER CODE BEGIN PFP */ 52 | 53 | /* USER CODE END PFP */ 54 | 55 | /* Private user code ---------------------------------------------------------*/ 56 | /* USER CODE BEGIN 0 */ 57 | 58 | /* USER CODE END 0 */ 59 | 60 | /* External variables --------------------------------------------------------*/ 61 | extern TIM_HandleTypeDef htim1; 62 | 63 | /* USER CODE BEGIN EV */ 64 | 65 | /* USER CODE END EV */ 66 | 67 | /******************************************************************************/ 68 | /* Cortex Processor Interruption and Exception Handlers */ 69 | /******************************************************************************/ 70 | /** 71 | * @brief This function handles Non maskable interrupt. 72 | */ 73 | void NMI_Handler(void) 74 | { 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 76 | 77 | /* USER CODE END NonMaskableInt_IRQn 0 */ 78 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 79 | 80 | /* USER CODE END NonMaskableInt_IRQn 1 */ 81 | } 82 | 83 | /** 84 | * @brief This function handles Hard fault interrupt. 85 | */ 86 | void HardFault_Handler(void) 87 | { 88 | /* USER CODE BEGIN HardFault_IRQn 0 */ 89 | 90 | /* USER CODE END HardFault_IRQn 0 */ 91 | while (1) 92 | { 93 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 94 | /* USER CODE END W1_HardFault_IRQn 0 */ 95 | } 96 | } 97 | 98 | /** 99 | * @brief This function handles Memory management fault. 100 | */ 101 | void MemManage_Handler(void) 102 | { 103 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 104 | 105 | /* USER CODE END MemoryManagement_IRQn 0 */ 106 | while (1) 107 | { 108 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 109 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 110 | } 111 | } 112 | 113 | /** 114 | * @brief This function handles Pre-fetch fault, memory access fault. 115 | */ 116 | void BusFault_Handler(void) 117 | { 118 | /* USER CODE BEGIN BusFault_IRQn 0 */ 119 | 120 | /* USER CODE END BusFault_IRQn 0 */ 121 | while (1) 122 | { 123 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 124 | /* USER CODE END W1_BusFault_IRQn 0 */ 125 | } 126 | } 127 | 128 | /** 129 | * @brief This function handles Undefined instruction or illegal state. 130 | */ 131 | void UsageFault_Handler(void) 132 | { 133 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 134 | 135 | /* USER CODE END UsageFault_IRQn 0 */ 136 | while (1) 137 | { 138 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 139 | /* USER CODE END W1_UsageFault_IRQn 0 */ 140 | } 141 | } 142 | 143 | /** 144 | * @brief This function handles Debug monitor. 145 | */ 146 | void DebugMon_Handler(void) 147 | { 148 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 149 | 150 | /* USER CODE END DebugMonitor_IRQn 0 */ 151 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 152 | 153 | /* USER CODE END DebugMonitor_IRQn 1 */ 154 | } 155 | 156 | /******************************************************************************/ 157 | /* STM32H7xx Peripheral Interrupt Handlers */ 158 | /* Add here the Interrupt Handlers for the used peripherals. */ 159 | /* For the available peripheral interrupt handler names, */ 160 | /* please refer to the startup file (startup_stm32h7xx.s). */ 161 | /******************************************************************************/ 162 | 163 | /** 164 | * @brief This function handles TIM1 update interrupt. 165 | */ 166 | void TIM1_UP_IRQHandler(void) 167 | { 168 | /* USER CODE BEGIN TIM1_UP_IRQn 0 */ 169 | 170 | /* USER CODE END TIM1_UP_IRQn 0 */ 171 | HAL_TIM_IRQHandler(&htim1); 172 | /* USER CODE BEGIN TIM1_UP_IRQn 1 */ 173 | 174 | /* USER CODE END TIM1_UP_IRQn 1 */ 175 | } 176 | 177 | /* USER CODE BEGIN 1 */ 178 | 179 | /* USER CODE END 1 */ 180 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 181 | -------------------------------------------------------------------------------- /src/application/stm32h7xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32h7xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

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

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32H7xx_IT_H 23 | #define __STM32H7xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void DebugMon_Handler(void); 56 | void TIM1_UP_IRQHandler(void); 57 | /* USER CODE BEGIN EFP */ 58 | 59 | /* USER CODE END EFP */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* __STM32H7xx_IT_H */ 66 | 67 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 68 | -------------------------------------------------------------------------------- /src/drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlyingBBQ/meson_embedded/a173c87675f2326e888e702944e24070a242b29d/src/drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h -------------------------------------------------------------------------------- /src/drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32h7xx.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-Mx Device System Source File for STM32H7xx devices. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 | /** @addtogroup CMSIS 21 | * @{ 22 | */ 23 | 24 | /** @addtogroup stm32h7xx_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef SYSTEM_STM32H7XX_H 32 | #define SYSTEM_STM32H7XX_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32H7xx_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32H7xx_System_Exported_types 48 | * @{ 49 | */ 50 | /* This variable is updated in three ways: 51 | 1) by calling CMSIS function SystemCoreClockUpdate() 52 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq() 53 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency 54 | Note: If you use this function to configure the system clock; then there 55 | is no need to call the 2 first functions listed above, since SystemCoreClock 56 | variable is updated automatically. 57 | */ 58 | extern uint32_t SystemCoreClock; /*!< System Domain1 Clock Frequency */ 59 | extern uint32_t SystemD2Clock; /*!< System Domain2 Clock Frequency */ 60 | extern const uint8_t D1CorePrescTable[16] ; /*!< D1CorePrescTable prescalers table values */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32H7xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32H7xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32H7xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* SYSTEM_STM32H7XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /src/drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /src/drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /src/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef STM32H7xx_HAL_DEF 23 | #define STM32H7xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32h7xx.h" 31 | #include "Legacy/stm32_hal_legacy.h" 32 | #include 33 | #include 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | 37 | /** 38 | * @brief HAL Status structures definition 39 | */ 40 | typedef enum 41 | { 42 | HAL_OK = 0x00, 43 | HAL_ERROR = 0x01, 44 | HAL_BUSY = 0x02, 45 | HAL_TIMEOUT = 0x03 46 | } HAL_StatusTypeDef; 47 | 48 | /** 49 | * @brief HAL Lock structures definition 50 | */ 51 | typedef enum 52 | { 53 | HAL_UNLOCKED = 0x00, 54 | HAL_LOCKED = 0x01 55 | } HAL_LockTypeDef; 56 | 57 | /* Exported macro ------------------------------------------------------------*/ 58 | 59 | #define HAL_MAX_DELAY 0xFFFFFFFFU 60 | 61 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) 62 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 63 | 64 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 65 | do{ \ 66 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 67 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 68 | } while(0) 69 | 70 | #define UNUSED(x) ((void)(x)) 71 | 72 | /** @brief Reset the Handle's State field. 73 | * @param __HANDLE__: specifies the Peripheral Handle. 74 | * @note This macro can be used for the following purpose: 75 | * - When the Handle is declared as local variable; before passing it as parameter 76 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 77 | * to set to 0 the Handle's "State" field. 78 | * Otherwise, "State" field may have any random value and the first time the function 79 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 80 | * (i.e. HAL_PPP_MspInit() will not be executed). 81 | * - When there is a need to reconfigure the low level hardware: instead of calling 82 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 83 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 84 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 85 | * @retval None 86 | */ 87 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) 88 | 89 | #if (USE_RTOS == 1) 90 | #error " USE_RTOS should be 0 in the current HAL release " 91 | #else 92 | #define __HAL_LOCK(__HANDLE__) \ 93 | do{ \ 94 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 95 | { \ 96 | return HAL_BUSY; \ 97 | } \ 98 | else \ 99 | { \ 100 | (__HANDLE__)->Lock = HAL_LOCKED; \ 101 | } \ 102 | }while (0) 103 | 104 | #define __HAL_UNLOCK(__HANDLE__) \ 105 | do{ \ 106 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 107 | }while (0) 108 | #endif /* USE_RTOS */ 109 | 110 | #if defined ( __GNUC__ ) 111 | #ifndef __weak 112 | #define __weak __attribute__((weak)) 113 | #endif /* __weak */ 114 | #ifndef __packed 115 | #define __packed __attribute__((__packed__)) 116 | #endif /* __packed */ 117 | #endif /* __GNUC__ */ 118 | 119 | 120 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 121 | #if defined (__GNUC__) /* GNU Compiler */ 122 | #ifndef __ALIGN_END 123 | #define __ALIGN_END __attribute__ ((aligned (4))) 124 | #endif /* __ALIGN_END */ 125 | #ifndef __ALIGN_BEGIN 126 | #define __ALIGN_BEGIN 127 | #endif /* __ALIGN_BEGIN */ 128 | #else 129 | #ifndef __ALIGN_END 130 | #define __ALIGN_END 131 | #endif /* __ALIGN_END */ 132 | #ifndef __ALIGN_BEGIN 133 | #if defined (__CC_ARM) /* ARM Compiler */ 134 | #define __ALIGN_BEGIN __align(4) 135 | #elif defined (__ICCARM__) /* IAR Compiler */ 136 | #define __ALIGN_BEGIN 137 | #endif /* __CC_ARM */ 138 | #endif /* __ALIGN_BEGIN */ 139 | #endif /* __GNUC__ */ 140 | 141 | /* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */ 142 | #if defined (__GNUC__) /* GNU Compiler */ 143 | #define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32))) 144 | #elif defined (__ICCARM__) /* IAR Compiler */ 145 | #define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf 146 | #elif defined (__CC_ARM) /* ARM Compiler */ 147 | #define ALIGN_32BYTES(buf) __align(32) buf 148 | #endif 149 | 150 | /** 151 | * @brief __RAM_FUNC definition 152 | */ 153 | #if defined ( __CC_ARM ) 154 | /* ARM Compiler 155 | ------------ 156 | RAM functions are defined using the toolchain options. 157 | Functions that are executed in RAM should reside in a separate source module. 158 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 159 | area of a module to a memory space in physical RAM. 160 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 161 | dialog. 162 | */ 163 | #define __RAM_FUNC 164 | 165 | #elif defined ( __ICCARM__ ) 166 | /* ICCARM Compiler 167 | --------------- 168 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 169 | */ 170 | #define __RAM_FUNC __ramfunc 171 | 172 | #elif defined ( __GNUC__ ) 173 | /* GNU Compiler 174 | ------------ 175 | RAM functions are defined using a specific toolchain attribute 176 | "__attribute__((section(".RamFunc")))". 177 | */ 178 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 179 | 180 | #endif 181 | 182 | #ifdef __cplusplus 183 | } 184 | #endif 185 | 186 | #endif /* STM32H7xx_HAL_DEF */ 187 | 188 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 189 | -------------------------------------------------------------------------------- /src/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_hsem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_hsem.h 4 | * @author MCD Application Team 5 | * @brief Header file of HSEM HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 STM32H7xx_HAL_HSEM_H 22 | #define STM32H7xx_HAL_HSEM_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32h7xx_hal_def.h" 30 | 31 | /** @addtogroup STM32H7xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup HSEM 36 | * @{ 37 | */ 38 | 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /** @defgroup HSEM_Exported_Macros HSEM Exported Macros 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief SemID to mask helper Macro. 46 | * @param __SEMID__: semaphore ID from 0 to 31 47 | * @retval Semaphore Mask. 48 | */ 49 | #define __HAL_HSEM_SEMID_TO_MASK(__SEMID__) (1 << (__SEMID__)) 50 | 51 | /** 52 | * @brief Enables the specified HSEM interrupts. 53 | * @param __SEM_MASK__: semaphores Mask 54 | * @retval None. 55 | */ 56 | #if defined(DUAL_CORE) 57 | #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 58 | (HSEM->C1IER |= (__SEM_MASK__)) : \ 59 | (HSEM->C2IER |= (__SEM_MASK__))) 60 | #else 61 | #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) (HSEM->IER |= (__SEM_MASK__)) 62 | #endif /* DUAL_CORE */ 63 | /** 64 | * @brief Disables the specified HSEM interrupts. 65 | * @param __SEM_MASK__: semaphores Mask 66 | * @retval None. 67 | */ 68 | #if defined(DUAL_CORE) 69 | #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 70 | (HSEM->C1IER &= ~(__SEM_MASK__)) : \ 71 | (HSEM->C2IER &= ~(__SEM_MASK__))) 72 | #else 73 | #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) (HSEM->IER &= ~(__SEM_MASK__)) 74 | #endif /* DUAL_CORE */ 75 | 76 | /** 77 | * @brief Checks whether interrupt has occurred or not for semaphores specified by a mask. 78 | * @param __SEM_MASK__: semaphores Mask 79 | * @retval semaphores Mask : Semaphores where an interrupt occurred. 80 | */ 81 | #if defined(DUAL_CORE) 82 | #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 83 | ((__SEM_MASK__) & HSEM->C1MISR) : \ 84 | ((__SEM_MASK__) & HSEM->C2MISR1)) 85 | #else 86 | #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((__SEM_MASK__) & HSEM->MISR) 87 | #endif /* DUAL_CORE */ 88 | 89 | /** 90 | * @brief Get the semaphores release status flags. 91 | * @param __SEM_MASK__: semaphores Mask 92 | * @retval semaphores Mask : Semaphores where Release flags rise. 93 | */ 94 | #if defined(DUAL_CORE) 95 | #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 96 | (__SEM_MASK__) & HSEM->C1ISR : \ 97 | (__SEM_MASK__) & HSEM->C2ISR) 98 | #else 99 | #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((__SEM_MASK__) & HSEM->ISR) 100 | #endif /* DUAL_CORE */ 101 | 102 | /** 103 | * @brief Clears the HSEM Interrupt flags. 104 | * @param __SEM_MASK__: semaphores Mask 105 | * @retval None. 106 | */ 107 | #if defined(DUAL_CORE) 108 | #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ 109 | (HSEM->C1ICR |= (__SEM_MASK__)) : \ 110 | (HSEM->C2ICR |= (__SEM_MASK__))) 111 | #else 112 | #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) (HSEM->ICR |= (__SEM_MASK__)) 113 | #endif /* DUAL_CORE */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /* Exported functions --------------------------------------------------------*/ 120 | /** @defgroup HSEM_Exported_Functions HSEM Exported Functions 121 | * @{ 122 | */ 123 | 124 | /** @addtogroup HSEM_Exported_Functions_Group1 Take and Release functions 125 | * @brief HSEM Take and Release functions 126 | * @{ 127 | */ 128 | 129 | /* HSEM semaphore take (lock) using 2-Step method ****************************/ 130 | HAL_StatusTypeDef HAL_HSEM_Take(uint32_t SemID, uint32_t ProcessID); 131 | /* HSEM semaphore fast take (lock) using 1-Step method ***********************/ 132 | HAL_StatusTypeDef HAL_HSEM_FastTake(uint32_t SemID); 133 | /* HSEM Check semaphore state Taken or not **********************************/ 134 | uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID); 135 | /* HSEM Release **************************************************************/ 136 | void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID); 137 | /* HSEM Release All************************************************************/ 138 | void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID); 139 | 140 | /** 141 | * @} 142 | */ 143 | 144 | /** @addtogroup HSEM_Exported_Functions_Group2 HSEM Set and Get Key functions 145 | * @brief HSEM Set and Get Key functions. 146 | * @{ 147 | */ 148 | /* HSEM Set Clear Key *********************************************************/ 149 | void HAL_HSEM_SetClearKey(uint32_t Key); 150 | /* HSEM Get Clear Key *********************************************************/ 151 | uint32_t HAL_HSEM_GetClearKey(void); 152 | /** 153 | * @} 154 | */ 155 | 156 | /** @addtogroup HSEM_Exported_Functions_Group3 157 | * @brief HSEM Notification functions 158 | * @{ 159 | */ 160 | /* HSEM Activate HSEM Notification (When a semaphore is released) ) *****************/ 161 | void HAL_HSEM_ActivateNotification(uint32_t SemMask); 162 | /* HSEM Deactivate HSEM Notification (When a semaphore is released) ****************/ 163 | void HAL_HSEM_DeactivateNotification(uint32_t SemMask); 164 | /* HSEM Free Callback (When a semaphore is released) *******************************/ 165 | void HAL_HSEM_FreeCallback(uint32_t SemMask); 166 | /* HSEM IRQ Handler **********************************************************/ 167 | void HAL_HSEM_IRQHandler(void); 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /** 174 | * @} 175 | */ 176 | 177 | /* Private macros ------------------------------------------------------------*/ 178 | /** @defgroup HSEM_Private_Macros HSEM Private Macros 179 | * @{ 180 | */ 181 | 182 | #define IS_HSEM_SEMID(__SEMID__) ((__SEMID__) <= HSEM_SEMID_MAX ) 183 | 184 | #define IS_HSEM_PROCESSID(__PROCESSID__) ((__PROCESSID__) <= HSEM_PROCESSID_MAX ) 185 | 186 | #define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX ) 187 | 188 | #if defined(DUAL_CORE) 189 | #define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \ 190 | ((__COREID__) == HSEM_CPU2_COREID)) 191 | #else 192 | #define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID) 193 | #endif 194 | 195 | 196 | /** 197 | * @} 198 | */ 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | #ifdef __cplusplus 209 | } 210 | #endif 211 | 212 | #endif /* STM32H7xx_HAL_HSEM_H */ 213 | 214 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 215 | -------------------------------------------------------------------------------- /src/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of I2C HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 STM32H7xx_HAL_I2C_EX_H 22 | #define STM32H7xx_HAL_I2C_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32h7xx_hal_def.h" 30 | 31 | /** @addtogroup STM32H7xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup I2CEx 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | 42 | /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants 43 | * @{ 44 | */ 45 | 46 | /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter 47 | * @{ 48 | */ 49 | #define I2C_ANALOGFILTER_ENABLE 0x00000000U 50 | #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus 56 | * @{ 57 | */ 58 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_PMCR_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 59 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_PMCR_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 60 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_PMCR_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 61 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_PMCR_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 62 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_PMCR_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 63 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_PMCR_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 64 | #define I2C_FASTMODEPLUS_I2C3 SYSCFG_PMCR_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 65 | #define I2C_FASTMODEPLUS_I2C4 SYSCFG_PMCR_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /* Exported macro ------------------------------------------------------------*/ 75 | /* Exported functions --------------------------------------------------------*/ 76 | 77 | /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions 78 | * @{ 79 | */ 80 | 81 | /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions 82 | * @brief Extended features functions 83 | * @{ 84 | */ 85 | 86 | /* Peripheral Control functions ************************************************/ 87 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); 88 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); 89 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); 90 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); 91 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 92 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 93 | 94 | /* Private constants ---------------------------------------------------------*/ 95 | /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants 96 | * @{ 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /* Private macros ------------------------------------------------------------*/ 104 | /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros 105 | * @{ 106 | */ 107 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ 108 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) 109 | 110 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) 111 | 112 | #if (defined(SYSCFG_PMCR_I2C1_FMP) && defined(SYSCFG_PMCR_I2C2_FMP) && defined(SYSCFG_PMCR_I2C3_FMP) && defined(SYSCFG_PMCR_I2C4_FMP)) 113 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6) == I2C_FASTMODEPLUS_PB6) || \ 114 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB7) == I2C_FASTMODEPLUS_PB7) || \ 115 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB8) == I2C_FASTMODEPLUS_PB8) || \ 116 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB9) == I2C_FASTMODEPLUS_PB9) || \ 117 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1) || \ 118 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C2) == I2C_FASTMODEPLUS_I2C2) || \ 119 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C3) == I2C_FASTMODEPLUS_I2C3) || \ 120 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C4) == I2C_FASTMODEPLUS_I2C4)) 121 | #elif defined(SYSCFG_PMCR_I2C1_FMP) && defined(SYSCFG_PMCR_I2C2_FMP) && defined(SYSCFG_PMCR_I2C3_FMP) 122 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6) == I2C_FASTMODEPLUS_PB6) || \ 123 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB7) == I2C_FASTMODEPLUS_PB7) || \ 124 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB8) == I2C_FASTMODEPLUS_PB8) || \ 125 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB9) == I2C_FASTMODEPLUS_PB9) || \ 126 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1) || \ 127 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C2) == I2C_FASTMODEPLUS_I2C2) || \ 128 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C3) == I2C_FASTMODEPLUS_I2C3)) 129 | #elif defined(SYSCFG_PMCR_I2C1_FMP) && defined(SYSCFG_PMCR_I2C2_FMP) 130 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6) == I2C_FASTMODEPLUS_PB6) || \ 131 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB7) == I2C_FASTMODEPLUS_PB7) || \ 132 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB8) == I2C_FASTMODEPLUS_PB8) || \ 133 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB9) == I2C_FASTMODEPLUS_PB9) || \ 134 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1) || \ 135 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C2) == I2C_FASTMODEPLUS_I2C2)) 136 | #elif defined(SYSCFG_PMCR_I2C1_FMP) 137 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6) == I2C_FASTMODEPLUS_PB6) || \ 138 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB7) == I2C_FASTMODEPLUS_PB7) || \ 139 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB8) == I2C_FASTMODEPLUS_PB8) || \ 140 | (((__CONFIG__) & I2C_FASTMODEPLUS_PB9) == I2C_FASTMODEPLUS_PB9) || \ 141 | (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1)) 142 | #endif /* SYSCFG_PMCR_I2C1_FMP && SYSCFG_PMCR_I2C2_FMP && SYSCFG_PMCR_I2C3_FMP && SYSCFG_PMCR_I2C4_FMP */ 143 | 144 | 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /* Private Functions ---------------------------------------------------------*/ 151 | /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions 152 | * @{ 153 | */ 154 | /* Private functions are defined in stm32h7xx_hal_i2c_ex.c file */ 155 | /** 156 | * @} 157 | */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | /** 168 | * @} 169 | */ 170 | 171 | /** 172 | * @} 173 | */ 174 | 175 | #ifdef __cplusplus 176 | } 177 | #endif 178 | 179 | #endif /* STM32H7xx_HAL_I2C_EX_H */ 180 | 181 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 182 | -------------------------------------------------------------------------------- /src/drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32h7xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of PCD HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 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 STM32H7xx_HAL_PCD_EX_H 22 | #define STM32H7xx_HAL_PCD_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32h7xx_hal_def.h" 30 | 31 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS) 32 | /** @addtogroup STM32H7xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup PCDEx 37 | * @{ 38 | */ 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macros -----------------------------------------------------------*/ 42 | /* Exported functions --------------------------------------------------------*/ 43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 44 | * @{ 45 | */ 46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 47 | * @{ 48 | */ 49 | 50 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS) 51 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 52 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 53 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ 54 | 55 | 56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 58 | 59 | 60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 63 | 64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | 89 | #endif /* STM32H7xx_HAL_PCD_EX_H */ 90 | 91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 92 | -------------------------------------------------------------------------------- /src/drivers/STM32H7xx_HAL_Driver/Src/meson.build: -------------------------------------------------------------------------------- 1 | drivers_src = files( 2 | 'stm32h7xx_hal.c', 3 | 'stm32h7xx_hal_cortex.c', 4 | 'stm32h7xx_hal_dma.c', 5 | 'stm32h7xx_hal_dma_ex.c', 6 | 'stm32h7xx_hal_eth.c', 7 | 'stm32h7xx_hal_eth_ex.c', 8 | 'stm32h7xx_hal_exti.c', 9 | 'stm32h7xx_hal_flash.c', 10 | 'stm32h7xx_hal_flash_ex.c', 11 | 'stm32h7xx_hal_gpio.c', 12 | 'stm32h7xx_hal_hsem.c', 13 | 'stm32h7xx_hal_i2c.c', 14 | 'stm32h7xx_hal_i2c_ex.c', 15 | 'stm32h7xx_hal_mdma.c', 16 | 'stm32h7xx_hal_pcd.c', 17 | 'stm32h7xx_hal_pcd_ex.c', 18 | 'stm32h7xx_hal_pwr.c', 19 | 'stm32h7xx_hal_pwr_ex.c', 20 | 'stm32h7xx_hal_rcc.c', 21 | 'stm32h7xx_hal_rcc_ex.c', 22 | 'stm32h7xx_hal_tim.c', 23 | 'stm32h7xx_hal_tim_ex.c', 24 | 'stm32h7xx_hal_uart.c', 25 | 'stm32h7xx_hal_uart_ex.c', 26 | 'stm32h7xx_ll_usb.c', 27 | ) 28 | -------------------------------------------------------------------------------- /src/drivers/meson.build: -------------------------------------------------------------------------------- 1 | subdir('STM32H7xx_HAL_Driver/Src') 2 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | project_inc = [ 2 | include_directories('application'), 3 | include_directories('BSP'), 4 | include_directories('drivers/CMSIS/Include'), 5 | include_directories('drivers/CMSIS/Device/ST/STM32H7xx/Include'), 6 | include_directories('drivers/STM32H7xx_HAL_Driver/Inc'), 7 | include_directories('drivers/STM32H7xx_HAL_Driver/Inc/Legacy'), 8 | include_directories('middlewares/FreeRTOS/Source/include'), 9 | include_directories('middlewares/FreeRTOS/Source/CMSIS_RTOS_V2'), 10 | include_directories('middlewares/FreeRTOS/Source/portable/GCC/ARM_CM4F'), 11 | ] 12 | 13 | subdir('application') 14 | subdir('BSP') 15 | subdir('drivers') 16 | subdir('middlewares') 17 | 18 | project_src += application_src 19 | project_src += bsp_src 20 | project_src += drivers_src 21 | project_src += middlewares_src 22 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlyingBBQ/meson_embedded/a173c87675f2326e888e702944e24070a242b29d/src/middlewares/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released. 33 | #endif 34 | 35 | /* 36 | * Call the stack overflow hook function if the stack of the task being swapped 37 | * out is currently overflowed, or looks like it might have overflowed in the 38 | * past. 39 | * 40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 41 | * the current stack state only - comparing the current top of stack value to 42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 43 | * will also cause the last few stack bytes to be checked to ensure the value 44 | * to which the bytes were set when the task was created have not been 45 | * overwritten. Note this second test does not guarantee that an overflowed 46 | * stack will always be recognised. 47 | */ 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 52 | 53 | /* Only the current stack state is to be checked. */ 54 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 55 | { \ 56 | /* Is the currently saved stack pointer within the stack limit? */ \ 57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 58 | { \ 59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 60 | } \ 61 | } 62 | 63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 64 | /*-----------------------------------------------------------*/ 65 | 66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 67 | 68 | /* Only the current stack state is to be checked. */ 69 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 70 | { \ 71 | \ 72 | /* Is the currently saved stack pointer within the stack limit? */ \ 73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 74 | { \ 75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 76 | } \ 77 | } 78 | 79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 80 | /*-----------------------------------------------------------*/ 81 | 82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 83 | 84 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 85 | { \ 86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 88 | \ 89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 90 | ( pulStack[ 1 ] != ulCheckValue ) || \ 91 | ( pulStack[ 2 ] != ulCheckValue ) || \ 92 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 93 | { \ 94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 95 | } \ 96 | } 97 | 98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 99 | /*-----------------------------------------------------------*/ 100 | 101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 102 | 103 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 104 | { \ 105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 111 | \ 112 | \ 113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 114 | \ 115 | /* Has the extremity of the task stack ever been written over? */ \ 116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 117 | { \ 118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 119 | } \ 120 | } 121 | 122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 123 | /*-----------------------------------------------------------*/ 124 | 125 | /* Remove stack overflow macro if not being used. */ 126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 127 | #define taskCHECK_FOR_STACK_OVERFLOW() 128 | #endif 129 | 130 | 131 | 132 | #endif /* STACK_MACROS_H */ 133 | 134 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/include/deprecated_definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef DEPRECATED_DEFINITIONS_H 29 | #define DEPRECATED_DEFINITIONS_H 30 | 31 | 32 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 33 | pre-processor definition was used to ensure the pre-processor found the correct 34 | portmacro.h file for the port being used. That scheme was deprecated in favour 35 | of setting the compiler's include path such that it found the correct 36 | portmacro.h file - removing the need for the constant and allowing the 37 | portmacro.h file to be located anywhere in relation to the port being used. The 38 | definitions below remain in the code for backward compatibility only. New 39 | projects should not use them. */ 40 | 41 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT 42 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" 43 | typedef void ( __interrupt __far *pxISR )(); 44 | #endif 45 | 46 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT 47 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h" 48 | typedef void ( __interrupt __far *pxISR )(); 49 | #endif 50 | 51 | #ifdef GCC_MEGA_AVR 52 | #include "../portable/GCC/ATMega323/portmacro.h" 53 | #endif 54 | 55 | #ifdef IAR_MEGA_AVR 56 | #include "../portable/IAR/ATMega323/portmacro.h" 57 | #endif 58 | 59 | #ifdef MPLAB_PIC24_PORT 60 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 61 | #endif 62 | 63 | #ifdef MPLAB_DSPIC_PORT 64 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 65 | #endif 66 | 67 | #ifdef MPLAB_PIC18F_PORT 68 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h" 69 | #endif 70 | 71 | #ifdef MPLAB_PIC32MX_PORT 72 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h" 73 | #endif 74 | 75 | #ifdef _FEDPICC 76 | #include "libFreeRTOS/Include/portmacro.h" 77 | #endif 78 | 79 | #ifdef SDCC_CYGNAL 80 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h" 81 | #endif 82 | 83 | #ifdef GCC_ARM7 84 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h" 85 | #endif 86 | 87 | #ifdef GCC_ARM7_ECLIPSE 88 | #include "portmacro.h" 89 | #endif 90 | 91 | #ifdef ROWLEY_LPC23xx 92 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h" 93 | #endif 94 | 95 | #ifdef IAR_MSP430 96 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h" 97 | #endif 98 | 99 | #ifdef GCC_MSP430 100 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h" 101 | #endif 102 | 103 | #ifdef ROWLEY_MSP430 104 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h" 105 | #endif 106 | 107 | #ifdef ARM7_LPC21xx_KEIL_RVDS 108 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h" 109 | #endif 110 | 111 | #ifdef SAM7_GCC 112 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h" 113 | #endif 114 | 115 | #ifdef SAM7_IAR 116 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h" 117 | #endif 118 | 119 | #ifdef SAM9XE_IAR 120 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h" 121 | #endif 122 | 123 | #ifdef LPC2000_IAR 124 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h" 125 | #endif 126 | 127 | #ifdef STR71X_IAR 128 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h" 129 | #endif 130 | 131 | #ifdef STR75X_IAR 132 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h" 133 | #endif 134 | 135 | #ifdef STR75X_GCC 136 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h" 137 | #endif 138 | 139 | #ifdef STR91X_IAR 140 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h" 141 | #endif 142 | 143 | #ifdef GCC_H8S 144 | #include "../../Source/portable/GCC/H8S2329/portmacro.h" 145 | #endif 146 | 147 | #ifdef GCC_AT91FR40008 148 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h" 149 | #endif 150 | 151 | #ifdef RVDS_ARMCM3_LM3S102 152 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h" 153 | #endif 154 | 155 | #ifdef GCC_ARMCM3_LM3S102 156 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 157 | #endif 158 | 159 | #ifdef GCC_ARMCM3 160 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 161 | #endif 162 | 163 | #ifdef IAR_ARM_CM3 164 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 165 | #endif 166 | 167 | #ifdef IAR_ARMCM3_LM 168 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 169 | #endif 170 | 171 | #ifdef HCS12_CODE_WARRIOR 172 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h" 173 | #endif 174 | 175 | #ifdef MICROBLAZE_GCC 176 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h" 177 | #endif 178 | 179 | #ifdef TERN_EE 180 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h" 181 | #endif 182 | 183 | #ifdef GCC_HCS12 184 | #include "../../Source/portable/GCC/HCS12/portmacro.h" 185 | #endif 186 | 187 | #ifdef GCC_MCF5235 188 | #include "../../Source/portable/GCC/MCF5235/portmacro.h" 189 | #endif 190 | 191 | #ifdef COLDFIRE_V2_GCC 192 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h" 193 | #endif 194 | 195 | #ifdef COLDFIRE_V2_CODEWARRIOR 196 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h" 197 | #endif 198 | 199 | #ifdef GCC_PPC405 200 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h" 201 | #endif 202 | 203 | #ifdef GCC_PPC440 204 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h" 205 | #endif 206 | 207 | #ifdef _16FX_SOFTUNE 208 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h" 209 | #endif 210 | 211 | #ifdef BCC_INDUSTRIAL_PC_PORT 212 | /* A short file name has to be used in place of the normal 213 | FreeRTOSConfig.h when using the Borland compiler. */ 214 | #include "frconfig.h" 215 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h" 216 | typedef void ( __interrupt __far *pxISR )(); 217 | #endif 218 | 219 | #ifdef BCC_FLASH_LITE_186_PORT 220 | /* A short file name has to be used in place of the normal 221 | FreeRTOSConfig.h when using the Borland compiler. */ 222 | #include "frconfig.h" 223 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h" 224 | typedef void ( __interrupt __far *pxISR )(); 225 | #endif 226 | 227 | #ifdef __GNUC__ 228 | #ifdef __AVR32_AVR32A__ 229 | #include "portmacro.h" 230 | #endif 231 | #endif 232 | 233 | #ifdef __ICCAVR32__ 234 | #ifdef __CORE__ 235 | #if __CORE__ == __AVR32A__ 236 | #include "portmacro.h" 237 | #endif 238 | #endif 239 | #endif 240 | 241 | #ifdef __91467D 242 | #include "portmacro.h" 243 | #endif 244 | 245 | #ifdef __96340 246 | #include "portmacro.h" 247 | #endif 248 | 249 | 250 | #ifdef __IAR_V850ES_Fx3__ 251 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 252 | #endif 253 | 254 | #ifdef __IAR_V850ES_Jx3__ 255 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 256 | #endif 257 | 258 | #ifdef __IAR_V850ES_Jx3_L__ 259 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 260 | #endif 261 | 262 | #ifdef __IAR_V850ES_Jx2__ 263 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 264 | #endif 265 | 266 | #ifdef __IAR_V850ES_Hx2__ 267 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 268 | #endif 269 | 270 | #ifdef __IAR_78K0R_Kx3__ 271 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 272 | #endif 273 | 274 | #ifdef __IAR_78K0R_Kx3L__ 275 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 276 | #endif 277 | 278 | #endif /* DEPRECATED_DEFINITIONS_H */ 279 | 280 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/include/portable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | * Portable layer API. Each function must be defined for each port. 30 | *----------------------------------------------------------*/ 31 | 32 | #ifndef PORTABLE_H 33 | #define PORTABLE_H 34 | 35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 36 | pre-processor definition was used to ensure the pre-processor found the correct 37 | portmacro.h file for the port being used. That scheme was deprecated in favour 38 | of setting the compiler's include path such that it found the correct 39 | portmacro.h file - removing the need for the constant and allowing the 40 | portmacro.h file to be located anywhere in relation to the port being used. 41 | Purely for reasons of backward compatibility the old method is still valid, but 42 | to make it clear that new projects should not use it, support for the port 43 | specific constants has been moved into the deprecated_definitions.h header 44 | file. */ 45 | #include "deprecated_definitions.h" 46 | 47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h 48 | did not result in a portmacro.h header file being included - and it should be 49 | included here. In this case the path to the correct portmacro.h header file 50 | must be set in the compiler's include path. */ 51 | #ifndef portENTER_CRITICAL 52 | #include "portmacro.h" 53 | #endif 54 | 55 | #if portBYTE_ALIGNMENT == 32 56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f ) 57 | #endif 58 | 59 | #if portBYTE_ALIGNMENT == 16 60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f ) 61 | #endif 62 | 63 | #if portBYTE_ALIGNMENT == 8 64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) 65 | #endif 66 | 67 | #if portBYTE_ALIGNMENT == 4 68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 ) 69 | #endif 70 | 71 | #if portBYTE_ALIGNMENT == 2 72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 ) 73 | #endif 74 | 75 | #if portBYTE_ALIGNMENT == 1 76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 ) 77 | #endif 78 | 79 | #ifndef portBYTE_ALIGNMENT_MASK 80 | #error "Invalid portBYTE_ALIGNMENT definition" 81 | #endif 82 | 83 | #ifndef portNUM_CONFIGURABLE_REGIONS 84 | #define portNUM_CONFIGURABLE_REGIONS 1 85 | #endif 86 | 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | #include "mpu_wrappers.h" 92 | 93 | /* 94 | * Setup the stack of a new task so it is ready to be placed under the 95 | * scheduler control. The registers have to be placed on the stack in 96 | * the order that the port expects to find them. 97 | * 98 | */ 99 | #if( portUSING_MPU_WRAPPERS == 1 ) 100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; 101 | #else 102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; 103 | #endif 104 | 105 | /* Used by heap_5.c. */ 106 | typedef struct HeapRegion 107 | { 108 | uint8_t *pucStartAddress; 109 | size_t xSizeInBytes; 110 | } HeapRegion_t; 111 | 112 | /* 113 | * Used to define multiple heap regions for use by heap_5.c. This function 114 | * must be called before any calls to pvPortMalloc() - not creating a task, 115 | * queue, semaphore, mutex, software timer, event group, etc. will result in 116 | * pvPortMalloc being called. 117 | * 118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which 119 | * defines a region of memory that can be used as the heap. The array is 120 | * terminated by a HeapRegions_t structure that has a size of 0. The region 121 | * with the lowest start address must appear first in the array. 122 | */ 123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION; 124 | 125 | 126 | /* 127 | * Map to the memory management routines required for the port. 128 | */ 129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; 130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION; 131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; 132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; 133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; 134 | 135 | /* 136 | * Setup the hardware ready for the scheduler to take control. This generally 137 | * sets up a tick interrupt and sets timers for the correct tick frequency. 138 | */ 139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; 140 | 141 | /* 142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so 143 | * the hardware is left in its original condition after the scheduler stops 144 | * executing. 145 | */ 146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; 147 | 148 | /* 149 | * The structures and methods of manipulating the MPU are contained within the 150 | * port layer. 151 | * 152 | * Fills the xMPUSettings structure with the memory region information 153 | * contained in xRegions. 154 | */ 155 | #if( portUSING_MPU_WRAPPERS == 1 ) 156 | struct xMEMORY_REGION; 157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; 158 | #endif 159 | 160 | #ifdef __cplusplus 161 | } 162 | #endif 163 | 164 | #endif /* PORTABLE_H */ 165 | 166 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef PROJDEFS_H 29 | #define PROJDEFS_H 30 | 31 | /* 32 | * Defines the prototype to which task functions must conform. Defined in this 33 | * file to ensure the type is known before portable.h is included. 34 | */ 35 | typedef void (*TaskFunction_t)( void * ); 36 | 37 | /* Converts a time in milliseconds to a time in ticks. This macro can be 38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 39 | definition here is not suitable for your application. */ 40 | #ifndef pdMS_TO_TICKS 41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) ) 42 | #endif 43 | 44 | #define pdFALSE ( ( BaseType_t ) 0 ) 45 | #define pdTRUE ( ( BaseType_t ) 1 ) 46 | 47 | #define pdPASS ( pdTRUE ) 48 | #define pdFAIL ( pdFALSE ) 49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 51 | 52 | /* FreeRTOS error definitions. */ 53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 54 | #define errQUEUE_BLOCKED ( -4 ) 55 | #define errQUEUE_YIELD ( -5 ) 56 | 57 | /* Macros used for basic data corruption checks. */ 58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 60 | #endif 61 | 62 | #if( configUSE_16_BIT_TICKS == 1 ) 63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 64 | #else 65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 66 | #endif 67 | 68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 69 | itself. */ 70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 110 | 111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 112 | itself. */ 113 | #define pdFREERTOS_LITTLE_ENDIAN 0 114 | #define pdFREERTOS_BIG_ENDIAN 1 115 | 116 | /* Re-defining endian values for generic naming. */ 117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN 118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN 119 | 120 | 121 | #endif /* PROJDEFS_H */ 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/include/stack_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 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 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | /* 32 | * Call the stack overflow hook function if the stack of the task being swapped 33 | * out is currently overflowed, or looks like it might have overflowed in the 34 | * past. 35 | * 36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 37 | * the current stack state only - comparing the current top of stack value to 38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 39 | * will also cause the last few stack bytes to be checked to ensure the value 40 | * to which the bytes were set when the task was created have not been 41 | * overwritten. Note this second test does not guarantee that an overflowed 42 | * stack will always be recognised. 43 | */ 44 | 45 | /*-----------------------------------------------------------*/ 46 | 47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 48 | 49 | /* Only the current stack state is to be checked. */ 50 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 51 | { \ 52 | /* Is the currently saved stack pointer within the stack limit? */ \ 53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 54 | { \ 55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 56 | } \ 57 | } 58 | 59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 60 | /*-----------------------------------------------------------*/ 61 | 62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 63 | 64 | /* Only the current stack state is to be checked. */ 65 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 66 | { \ 67 | \ 68 | /* Is the currently saved stack pointer within the stack limit? */ \ 69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 70 | { \ 71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 72 | } \ 73 | } 74 | 75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 76 | /*-----------------------------------------------------------*/ 77 | 78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 79 | 80 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 81 | { \ 82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 84 | \ 85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 86 | ( pulStack[ 1 ] != ulCheckValue ) || \ 87 | ( pulStack[ 2 ] != ulCheckValue ) || \ 88 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 89 | { \ 90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 91 | } \ 92 | } 93 | 94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 95 | /*-----------------------------------------------------------*/ 96 | 97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 98 | 99 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 100 | { \ 101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 107 | \ 108 | \ 109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 110 | \ 111 | /* Has the extremity of the task stack ever been written over? */ \ 112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 113 | { \ 114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 115 | } \ 116 | } 117 | 118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 119 | /*-----------------------------------------------------------*/ 120 | 121 | /* Remove stack overflow macro if not being used. */ 122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 123 | #define taskCHECK_FOR_STACK_OVERFLOW() 124 | #endif 125 | 126 | 127 | 128 | #endif /* STACK_MACROS_H */ 129 | 130 | -------------------------------------------------------------------------------- /src/middlewares/FreeRTOS/Source/meson.build: -------------------------------------------------------------------------------- 1 | middlewares_src = files( 2 | 'croutine.c', 3 | 'event_groups.c', 4 | 'list.c', 5 | 'queue.c', 6 | 'stream_buffer.c', 7 | 'tasks.c', 8 | 'timers.c', 9 | 'CMSIS_RTOS_V2/cmsis_os2.c', 10 | 'portable/MemMang/heap_4.c', 11 | 'portable/GCC/ARM_CM4F/port.c', 12 | ) 13 | -------------------------------------------------------------------------------- /src/middlewares/meson.build: -------------------------------------------------------------------------------- 1 | subdir('FreeRTOS/Source') 2 | -------------------------------------------------------------------------------- /test/cpputest_main.cpp: -------------------------------------------------------------------------------- 1 | #include "CppUTest/CommandLineTestRunner.h" 2 | 3 | int main(int ac, char** av) 4 | { 5 | return CommandLineTestRunner::RunAllTests(ac, av); 6 | } 7 | -------------------------------------------------------------------------------- /test/meson.build: -------------------------------------------------------------------------------- 1 | # include the test framework 2 | cpputest_dep = dependency('cpputest', version : '>=3.7', native : true) 3 | 4 | # add your test sources 5 | test_src = files('sometest.cpp') 6 | 7 | test_exe = executable( 8 | 'test_exe', 9 | [test_src, 'cpputest_main.cpp'], 10 | link_args : ['-lpthread', '-lCppUTest', '-lCppUTestExt'], 11 | override_options : ['b_asneeded=false', 'b_lundef=false'], 12 | dependencies : cpputest_dep, 13 | native : true) 14 | 15 | # make the test executable visible to the build system test framework 16 | test('Unit tests', test_exe) 17 | -------------------------------------------------------------------------------- /test/sometest.cpp: -------------------------------------------------------------------------------- 1 | #include "CppUTest/TestHarness.h" 2 | 3 | TEST_GROUP(FirstTestGroup) 4 | { 5 | }; 6 | 7 | TEST(FirstTestGroup, FirstTest) 8 | { 9 | FAIL("Fail me!"); 10 | } 11 | --------------------------------------------------------------------------------