apply afmt

This commit is contained in:
Robin Müller 2022-05-27 02:17:19 +02:00
parent ec6a398631
commit 603b23714a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
34 changed files with 952 additions and 1013 deletions

View File

@ -1,20 +1,21 @@
################################################################################ # ##############################################################################
# CMake support for the Flight Software Framework # CMake support for the Flight Software Framework Author: R. Mueller
# Author: R. Mueller # ##############################################################################
################################################################################
################################################################################ # ##############################################################################
# Pre-Project preparation # Pre-Project preparation
################################################################################ # ##############################################################################
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
# set(CMAKE_VERBOSE TRUE) # set(CMAKE_VERBOSE TRUE)
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(RTEMS_CMAKE_PATH "${CMAKE_SCRIPT_PATH}/rtems-cmake") set(RTEMS_CMAKE_PATH "${CMAKE_SCRIPT_PATH}/rtems-cmake")
set(FSFW_OSAL rtems CACHE STRING "OS for the FSFW") set(FSFW_OSAL
SET(STM32_ADD_NETWORKING_CODE ON) rtems
CACHE STRING "OS for the FSFW")
set(STM32_ADD_NETWORKING_CODE ON)
set(OBSW_MAX_SCHEDULED_TCS 200) set(OBSW_MAX_SCHEDULED_TCS 200)
set(FSFW_HAL_ADD_STM32H7 ON) set(FSFW_HAL_ADD_STM32H7 ON)
@ -28,9 +29,9 @@ include("${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake")
# Project Name # Project Name
project(fsfw-example-stm32h7-rtems ASM C CXX) project(fsfw-example-stm32h7-rtems ASM C CXX)
################################################################################ # ##############################################################################
# Pre-Sources preparation # Pre-Sources preparation
################################################################################ # ##############################################################################
# Specify the C++ standard # Specify the C++ standard
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@ -52,11 +53,8 @@ set(BSP_NUCLEO_PATH "${BSP_PATH}/boarconfig/NUCLEO-H743ZI")
set(BSP_NUCLEO_PATH_INC "${BSP_PATH}/boardconfig/NUCLEO-H743ZI/Inc") set(BSP_NUCLEO_PATH_INC "${BSP_PATH}/boardconfig/NUCLEO-H743ZI/Inc")
set(FSFW_ADDITIONAL_INC_PATHS set(FSFW_ADDITIONAL_INC_PATHS
"${COMMON_CONFIG_PATH}" "${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}" CACHE STRING "FSFW configuration paths")
CACHE STRING
"FSFW configuration paths"
)
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
@ -65,24 +63,19 @@ configure_file(${BSP_NUCLEO_PATH_INC}/lwipopts.h.in lwipopts.h)
configure_file(${BSP_PATH}/RTEMSConfig.h.in RTEMSConfig.h) configure_file(${BSP_PATH}/RTEMSConfig.h.in RTEMSConfig.h)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS set(WARNING_FLAGS -Wall -Wextra -Wimplicit-fallthrough=1
-Wall -Wno-unused-parameter -Wno-psabi)
-Wextra
-Wimplicit-fallthrough=1
-Wno-unused-parameter
-Wno-psabi
)
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS}) set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/permissive- /d2SSAOptimizer-) add_compile_options(/permissive- /d2SSAOptimizer-)
# To avoid nameclashes with min and max macro # To avoid nameclashes with min and max macro
add_compile_definitions(NOMINMAX) add_compile_definitions(NOMINMAX)
endif() endif()
################################################################################ # ##############################################################################
# Executable and Sources # Executable and Sources
################################################################################ # ##############################################################################
# Add executable # Add executable
add_executable(${TARGET_NAME}) add_executable(${TARGET_NAME})
@ -92,76 +85,83 @@ add_subdirectory(${BSP_PATH})
add_subdirectory(${FSFW_PATH}) add_subdirectory(${FSFW_PATH})
add_subdirectory(${COMMON_PATH}) add_subdirectory(${COMMON_PATH})
################################################################################ # ##############################################################################
# Post-Sources preparation # Post-Sources preparation
################################################################################ # ##############################################################################
# Check whether the user has already installed ETL first find_package(etl
# ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) Not installed, so use FetchContent
# to download and provide etl if(NOT etl_FOUND) There are issues using
# find_package. For now, always use FetchContent See this github issue:
# https://github.com/ETLCPP/etl/issues/548
message(
STATUS
"No ETL installation was found with find_package. Installing and providing "
"etl with FindPackage")
include(FetchContent)
FetchContent_Declare(
etl
GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG ${FSFW_ETL_LIB_VERSION})
list(APPEND FSFW_FETCH_CONTENT_TARGETS etl)
# endif()
# The documentation for FetchContent recommends declaring all the dependencies
# before making them available. We make all declared dependency available here
# after their declaration
if(FSFW_FETCH_CONTENT_TARGETS)
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
endif()
# Add libraries for all sources. # Add libraries for all sources.
target_link_libraries(${TARGET_NAME} PRIVATE target_link_libraries(
${LIB_FSFW_NAME} ${TARGET_NAME}
# Link against lwip which is part of the RTEMS BSP PRIVATE ${LIB_FSFW_NAME} etl
${LIB_LWIP_NAME} # Link against lwip which is part of the RTEMS BSP
) ${LIB_LWIP_NAME})
# Add include paths for all sources. # Add include paths for all sources.
target_include_directories(${TARGET_NAME} PRIVATE target_include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${FSFW_CONFIG_PATH})
${FSFW_CONFIG_PATH}
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_options(${TARGET_NAME} PRIVATE target_link_options(${TARGET_NAME} PRIVATE "-Wl,-Map=${TARGET_NAME}.map")
"-Wl,-Map=${TARGET_NAME}.map"
)
# Remove unused sections. # Remove unused sections.
target_compile_options(${TARGET_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE "-ffunction-sections"
"-ffunction-sections" "-fdata-sections")
"-fdata-sections"
)
# Removed unused sections. # Removed unused sections.
if(NOT FSFW_OSAL MATCHES rtems) if(NOT FSFW_OSAL MATCHES rtems)
target_link_options(${TARGET_NAME} PRIVATE target_link_options(${TARGET_NAME} PRIVATE "-Wl,--gc-sections")
"-Wl,--gc-sections" endif()
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif() endif()
if(CMAKE_VERBOSE) if(CMAKE_VERBOSE)
message(STATUS "Warning flags: ${WARNING_FLAGS}") message(STATUS "Warning flags: ${WARNING_FLAGS}")
endif() endif()
# Compile options for all sources. # Compile options for all sources.
target_compile_options(${TARGET_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE ${WARNING_FLAGS})
${WARNING_FLAGS}
)
string(CONCAT POST_BUILD_COMMENT string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
"Build directory: ${CMAKE_BINARY_DIR}\n" "Target OSAL: ${FSFW_OSAL}\n" "Target RTEMS BSP: ${RTEMS_BSP}\n"
"Target OSAL: ${FSFW_OSAL}\n" "Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
"Target RTEMS BSP: ${RTEMS_BSP}\n"
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
"${TARGET_STRING}"
)
add_custom_command( add_custom_command(
TARGET ${TARGET_NAME} TARGET ${TARGET_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_SIZE} ${TARGET_NAME} COMMAND ${CMAKE_SIZE} ${TARGET_NAME}
COMMENT ${POST_BUILD_COMMENT} COMMENT ${POST_BUILD_COMMENT})
)
include("${RTEMS_CONFIG_DIR}/BuildType.cmake") include("${RTEMS_CONFIG_DIR}/BuildType.cmake")
set_build_type() set_build_type()
################################################################################ # ##############################################################################
# Load RTEMS post-project configuration and checks # Load RTEMS post-project configuration and checks
################################################################################ # ##############################################################################
include("${RTEMS_CONFIG_DIR}/RTEMSPostProjectConfig.cmake") include("${RTEMS_CONFIG_DIR}/RTEMSPostProjectConfig.cmake")
rtems_post_project_config(${TARGET_NAME}) rtems_post_project_config(${TARGET_NAME})

View File

@ -1,7 +1,4 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE init.c main.cpp)
init.c
main.cpp
)
add_subdirectory(boardconfig) add_subdirectory(boardconfig)
add_subdirectory(fsfwconfig) add_subdirectory(fsfwconfig)

View File

@ -1,4 +1,3 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE)
)
add_subdirectory(NUCLEO-H743ZI) add_subdirectory(NUCLEO-H743ZI)

View File

@ -1,5 +1,4 @@
add_subdirectory(Src) add_subdirectory(Src)
target_include_directories(${TARGET_NAME} PRIVATE target_include_directories(${TARGET_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/Inc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Inc)
)

View File

@ -1,7 +1,6 @@
#ifndef BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_ #ifndef BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_
#define BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_ #define BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,30 +1,30 @@
/** /**
****************************************************************************** ******************************************************************************
* @file stm32h7xx_nucleo.h * @file stm32h7xx_nucleo.h
* @author MCD Application Team * @author MCD Application Team
* @brief This file contains definitions for: * @brief This file contains definitions for:
* - LEDs and push-button available on STM32H7xx-Nucleo Kit * - LEDs and push-button available on STM32H7xx-Nucleo Kit
* from STMicroelectronics * from STMicroelectronics
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2> * All rights reserved.</center></h2>
* *
* This software component is licensed by ST under BSD 3-Clause license, * This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the * the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at: * License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause * opensource.org/licenses/BSD-3-Clause
* *
****************************************************************************** ******************************************************************************
*/ */
/* Define to prevent recursive inclusion -------------------------------------*/ /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32H7XX_NUCLEO_H #ifndef STM32H7XX_NUCLEO_H
#define STM32H7XX_NUCLEO_H #define STM32H7XX_NUCLEO_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
@ -32,48 +32,51 @@
#include "stm32h7xx_nucleo_errno.h" #include "stm32h7xx_nucleo_errno.h"
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
#if (USE_COM_LOG > 0) #if (USE_COM_LOG > 0)
#ifndef __GNUC__ #ifndef __GNUC__
#include <stdio.h> #include <stdio.h>
#endif #endif
#endif #endif
#endif #endif
/** @addtogroup BSP /** @addtogroup BSP
* @{ * @{
*/ */
/** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO /** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO
* @{ * @{
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL
* @{ * @{
*/ */
/** /**
* @brief Define for STM32H7XX_NUCLEO board * @brief Define for STM32H7XX_NUCLEO board
*/ */
#if !defined (USE_STM32H7XX_NUCLEO) #if !defined(USE_STM32H7XX_NUCLEO)
#define USE_STM32H7XX_NUCLEO #define USE_STM32H7XX_NUCLEO
#endif #endif
#if !defined (USE_NUCLEO_144) #if !defined(USE_NUCLEO_144)
#error "Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file" #error \
"Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
#endif #endif
#if !defined (USE_NUCLEO_H745ZI_Q) && !defined (USE_NUCLEO_H743ZI) && !defined (USE_NUCLEO_H743ZI2) &&\ #if !defined(USE_NUCLEO_H745ZI_Q) && !defined(USE_NUCLEO_H743ZI) && \
!defined (USE_NUCLEO_H7A3ZI_Q) && !defined (USE_NUCLEO_H723ZG) !defined(USE_NUCLEO_H743ZI2) && !defined(USE_NUCLEO_H7A3ZI_Q) && \
#error "Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\ !defined(USE_NUCLEO_H723ZG)
#error \
"Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\
USE_NUCLEO_H745ZI_Q, USE_NUCLEO_H743ZI, USE_NUCLEO_H743ZI2, USE_NUCLEO_H7A3ZI_Q, USE_NUCLEO_H723ZG" USE_NUCLEO_H745ZI_Q, USE_NUCLEO_H743ZI, USE_NUCLEO_H743ZI2, USE_NUCLEO_H7A3ZI_Q, USE_NUCLEO_H723ZG"
#endif #endif
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
* @{ * @{
*/ */
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q) || defined (USE_NUCLEO_H723ZG) #if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
typedef enum defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
{ typedef enum {
LED1 = 0, LED1 = 0,
LED_GREEN = LED1, LED_GREEN = LED1,
LED2 = 1, LED2 = 1,
@ -81,10 +84,9 @@ typedef enum
LED3 = 2, LED3 = 2,
LED_RED = LED3, LED_RED = LED3,
LEDn LEDn
}Led_TypeDef; } Led_TypeDef;
#else /* USE_NUCLEO_H743ZI */ #else /* USE_NUCLEO_H743ZI */
typedef enum typedef enum {
{
LED1 = 0, LED1 = 0,
LED_GREEN = LED1, LED_GREEN = LED1,
LED2 = 1, LED2 = 1,
@ -92,242 +94,231 @@ typedef enum
LED3 = 2, LED3 = 2,
LED_RED = LED3, LED_RED = LED3,
LEDn LEDn
}Led_TypeDef; } Led_TypeDef;
#endif #endif
typedef enum typedef enum { BUTTON_USER = 0U, BUTTONn } Button_TypeDef;
{
BUTTON_USER = 0U,
BUTTONn
}Button_TypeDef;
typedef enum typedef enum { BUTTON_MODE_GPIO = 0, BUTTON_MODE_EXTI = 1 } ButtonMode_TypeDef;
{
BUTTON_MODE_GPIO = 0,
BUTTON_MODE_EXTI = 1
}ButtonMode_TypeDef;
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
typedef enum typedef enum { COM1 = 0U, COMn } COM_TypeDef;
{
COM1 = 0U,
COMn
}COM_TypeDef;
typedef enum typedef enum {
{ COM_STOPBITS_1 = UART_STOPBITS_1,
COM_STOPBITS_1 = UART_STOPBITS_1, COM_STOPBITS_2 = UART_STOPBITS_2,
COM_STOPBITS_2 = UART_STOPBITS_2, } COM_StopBitsTypeDef;
}COM_StopBitsTypeDef;
typedef enum typedef enum {
{ COM_PARITY_NONE = UART_PARITY_NONE,
COM_PARITY_NONE = UART_PARITY_NONE, COM_PARITY_EVEN = UART_PARITY_EVEN,
COM_PARITY_EVEN = UART_PARITY_EVEN, COM_PARITY_ODD = UART_PARITY_ODD,
COM_PARITY_ODD = UART_PARITY_ODD, } COM_ParityTypeDef;
}COM_ParityTypeDef;
typedef enum typedef enum {
{ COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE, COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS, COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS, COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS, } COM_HwFlowCtlTypeDef;
}COM_HwFlowCtlTypeDef;
typedef enum typedef enum {
{
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B, COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B, COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B, COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
}COM_WordLengthTypeDef; } COM_WordLengthTypeDef;
typedef struct typedef struct {
{ uint32_t BaudRate;
uint32_t BaudRate; COM_WordLengthTypeDef WordLength;
COM_WordLengthTypeDef WordLength; COM_StopBitsTypeDef StopBits;
COM_StopBitsTypeDef StopBits; COM_ParityTypeDef Parity;
COM_ParityTypeDef Parity; COM_HwFlowCtlTypeDef HwFlowCtl;
COM_HwFlowCtlTypeDef HwFlowCtl; } COM_InitTypeDef;
}COM_InitTypeDef;
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1) #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
typedef struct typedef struct {
{ void (*pMspInitCb)(UART_HandleTypeDef *);
void (* pMspInitCb)(UART_HandleTypeDef *); void (*pMspDeInitCb)(UART_HandleTypeDef *);
void (* pMspDeInitCb)(UART_HandleTypeDef *); } BSP_COM_Cb_t;
}BSP_COM_Cb_t;
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */ #endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
#define MX_UART_InitTypeDef COM_InitTypeDef #define MX_UART_InitTypeDef COM_InitTypeDef
#endif #endif
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported
* @{ * Constants
*/ * @{
*/
/** /**
* @brief STM32H7XX NUCLEO BSP Driver version number V1.3.0 * @brief STM32H7XX NUCLEO BSP Driver version number V1.3.0
*/ */
#define STM32H7XX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */ #define STM32H7XX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */ #define STM32H7XX_NUCLEO_BSP_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ #define STM32H7XX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
#define STM32H7XX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */ #define STM32H7XX_NUCLEO_BSP_VERSION_RC \
#define STM32H7XX_NUCLEO_BSP_VERSION ((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24)\ (0x00U) /*!< [7:0] release candidate \
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16)\ */
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8 )\ #define STM32H7XX_NUCLEO_BSP_VERSION \
|(STM32H7XX_NUCLEO_BSP_VERSION_RC)) ((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24) | \
(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16) | \
(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8) | \
(STM32H7XX_NUCLEO_BSP_VERSION_RC))
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED
* @{ * @{
*/ */
#define LEDn 3U #define LEDn 3U
#define LED1_PIN GPIO_PIN_0 #define LED1_PIN GPIO_PIN_0
#define LED1_GPIO_PORT GPIOB #define LED1_GPIO_PORT GPIOB
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() #define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q) || defined (USE_NUCLEO_H723ZG) #if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
#define LED2_PIN GPIO_PIN_1 defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
#define LED2_GPIO_PORT GPIOE #define LED2_PIN GPIO_PIN_1
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() #define LED2_GPIO_PORT GPIOE
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */ #else /* USE_NUCLEO_H743ZI */
#define LED2_PIN GPIO_PIN_7 #define LED2_PIN GPIO_PIN_7
#define LED2_GPIO_PORT GPIOB #define LED2_GPIO_PORT GPIOB
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() #define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#endif #endif
#define LED3_PIN GPIO_PIN_14 #define LED3_PIN GPIO_PIN_14
#define LED3_GPIO_PORT GPIOB #define LED3_GPIO_PORT GPIOB
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON
* @{ * @{
*/ */
/* Button state */ /* Button state */
#define BUTTON_RELEASED 0U #define BUTTON_RELEASED 0U
#define BUTTON_PRESSED 1U #define BUTTON_PRESSED 1U
#define BUTTONn 1U #define BUTTONn 1U
/** /**
* @brief Key push-button * @brief Key push-button
*/ */
#define BUTTON_USER_PIN GPIO_PIN_13 #define BUTTON_USER_PIN GPIO_PIN_13
#define BUTTON_USER_GPIO_PORT GPIOC #define BUTTON_USER_GPIO_PORT GPIOC
#define BUTTON_USER_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() #define BUTTON_USER_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define BUTTON_USER_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() #define BUTTON_USER_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#define BUTTON_USER_EXTI_IRQn EXTI15_10_IRQn #define BUTTON_USER_EXTI_IRQn EXTI15_10_IRQn
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13 #define BUTTON_USER_EXTI_LINE EXTI_LINE_13
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM
* @{ * @{
*/ */
/** /**
* @brief Definition for COM port1, connected to USART3 * @brief Definition for COM port1, connected to USART3
*/ */
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
#define COMn 1U #define COMn 1U
#define COM1_UART USART3 #define COM1_UART USART3
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE() #define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE() #define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
#define COM1_TX_PIN GPIO_PIN_8 #define COM1_TX_PIN GPIO_PIN_8
#define COM1_TX_GPIO_PORT GPIOD #define COM1_TX_GPIO_PORT GPIOD
#define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() #define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() #define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define COM1_TX_AF GPIO_AF7_USART3 #define COM1_TX_AF GPIO_AF7_USART3
#define COM1_RX_PIN GPIO_PIN_9 #define COM1_RX_PIN GPIO_PIN_9
#define COM1_RX_GPIO_PORT GPIOD #define COM1_RX_GPIO_PORT GPIOD
#define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() #define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() #define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define COM1_RX_AF GPIO_AF7_USART3 #define COM1_RX_AF GPIO_AF7_USART3
#define COM_POLL_TIMEOUT 1000 #define COM_POLL_TIMEOUT 1000
#endif #endif
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables /** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables
* @{ * @{
*/ */
extern EXTI_HandleTypeDef hpb_exti[]; extern EXTI_HandleTypeDef hpb_exti[];
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
extern UART_HandleTypeDef hcom_uart[]; extern UART_HandleTypeDef hcom_uart[];
extern USART_TypeDef* COM_USART[]; extern USART_TypeDef *COM_USART[];
#endif #endif
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_FunctionsPrototypes LOW LEVEL Exported Functions Prototypes /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_FunctionsPrototypes LOW LEVEL
* @{ * Exported Functions Prototypes
*/ * @{
int32_t BSP_GetVersion(void); */
int32_t BSP_LED_Init(Led_TypeDef Led); int32_t BSP_GetVersion(void);
int32_t BSP_LED_DeInit(Led_TypeDef Led); int32_t BSP_LED_Init(Led_TypeDef Led);
int32_t BSP_LED_On(Led_TypeDef Led); int32_t BSP_LED_DeInit(Led_TypeDef Led);
int32_t BSP_LED_Off(Led_TypeDef Led); int32_t BSP_LED_On(Led_TypeDef Led);
int32_t BSP_LED_Toggle(Led_TypeDef Led); int32_t BSP_LED_Off(Led_TypeDef Led);
int32_t BSP_LED_GetState (Led_TypeDef Led); int32_t BSP_LED_Toggle(Led_TypeDef Led);
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); int32_t BSP_LED_GetState(Led_TypeDef Led);
int32_t BSP_PB_DeInit(Button_TypeDef Button); int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
int32_t BSP_PB_GetState(Button_TypeDef Button); int32_t BSP_PB_DeInit(Button_TypeDef Button);
void BSP_PB_IRQHandler(Button_TypeDef Button); int32_t BSP_PB_GetState(Button_TypeDef Button);
void BSP_PB_Callback(Button_TypeDef Button); void BSP_PB_IRQHandler(Button_TypeDef Button);
void BSP_PB_Callback(Button_TypeDef Button);
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init); int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
int32_t BSP_COM_DeInit(COM_TypeDef COM); int32_t BSP_COM_DeInit(COM_TypeDef COM);
#if (USE_COM_LOG > 0) #if (USE_COM_LOG > 0)
int32_t BSP_COM_SelectLogPort (COM_TypeDef COM); int32_t BSP_COM_SelectLogPort(COM_TypeDef COM);
#endif #endif
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1) #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM); int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback); int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback);
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */ #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init); HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
MX_UART_InitTypeDef *COM_Init);
#endif /* USE_BSP_COM_FEATURE */ #endif /* USE_BSP_COM_FEATURE */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,77 +1,77 @@
/** /**
****************************************************************************** ******************************************************************************
* @file stm32h7xx_nucleo_conf.h * @file stm32h7xx_nucleo_conf.h
* @author MCD Application Team * @author MCD Application Team
* @brief STM32H7xx_Nuleo board configuration file. * @brief STM32H7xx_Nuleo board configuration file.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2> * All rights reserved.</center></h2>
* *
* This software component is licensed by ST under BSD 3-Clause license, * This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the * the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at: * License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause * opensource.org/licenses/BSD-3-Clause
* *
****************************************************************************** ******************************************************************************
*/ */
/* Define to prevent recursive inclusion -------------------------------------*/ /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32H7XX_NUCLEO_CONF_H #ifndef STM32H7XX_NUCLEO_CONF_H
#define STM32H7XX_NUCLEO_CONF_H #define STM32H7XX_NUCLEO_CONF_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"
#include "stm32h743xx.h" #include "stm32h743xx.h"
#include "stm32h7xx_hal.h"
/** @addtogroup BSP /** @addtogroup BSP
* @{ * @{
*/ */
/** @addtogroup STM32H7XX_NUCLEO /** @addtogroup STM32H7XX_NUCLEO
* @{ * @{
*/ */
/** @defgroup STM32H7XX_NUCLEO_CONFIG Config /** @defgroup STM32H7XX_NUCLEO_CONFIG Config
* @{ * @{
*/ */
/** @defgroup STM32H7XX_NUCLEO_CONFIG_Exported_Constants Exported Constants /** @defgroup STM32H7XX_NUCLEO_CONFIG_Exported_Constants Exported Constants
* @{ * @{
*/ */
/* Nucleo pin and part number defines */ /* Nucleo pin and part number defines */
#define USE_NUCLEO_144 #define USE_NUCLEO_144
#define USE_NUCLEO_H743ZI #define USE_NUCLEO_H743ZI
/* COM define */ /* COM define */
#define USE_COM_LOG 0U #define USE_COM_LOG 0U
#define USE_BSP_COM_FEATURE 1U #define USE_BSP_COM_FEATURE 1U
/* IRQ priorities */ /* IRQ priorities */
#define BSP_BUTTON_USER_IT_PRIORITY 15U #define BSP_BUTTON_USER_IT_PRIORITY 15U
#define BUS_SPI1_BAUDRATE 18000000 #define BUS_SPI1_BAUDRATE 18000000
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,43 +1,43 @@
/** /**
****************************************************************************** ******************************************************************************
* @file stm32h7xx_nucleo_errno.h * @file stm32h7xx_nucleo_errno.h
* @author MCD Application Team * @author MCD Application Team
* @brief Error Code. * @brief Error Code.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2> * All rights reserved.</center></h2>
* *
* This software component is licensed by ST under BSD 3-Clause license, * This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the * the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at: * License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause * opensource.org/licenses/BSD-3-Clause
* *
****************************************************************************** ******************************************************************************
*/ */
/* Define to prevent recursive inclusion -------------------------------------*/ /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32H7XX_NUCLEO_ERRNO_H #ifndef STM32H7XX_NUCLEO_ERRNO_H
#define STM32H7XX_NUCLEO_ERRNO_H #define STM32H7XX_NUCLEO_ERRNO_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Common Error codes */ /* Common Error codes */
#define BSP_ERROR_NONE 0 #define BSP_ERROR_NONE 0
#define BSP_ERROR_NO_INIT -1 #define BSP_ERROR_NO_INIT -1
#define BSP_ERROR_WRONG_PARAM -2 #define BSP_ERROR_WRONG_PARAM -2
#define BSP_ERROR_BUSY -3 #define BSP_ERROR_BUSY -3
#define BSP_ERROR_PERIPH_FAILURE -4 #define BSP_ERROR_PERIPH_FAILURE -4
#define BSP_ERROR_COMPONENT_FAILURE -5 #define BSP_ERROR_COMPONENT_FAILURE -5
#define BSP_ERROR_UNKNOWN_FAILURE -6 #define BSP_ERROR_UNKNOWN_FAILURE -6
#define BSP_ERROR_UNKNOWN_COMPONENT -7 #define BSP_ERROR_UNKNOWN_COMPONENT -7
#define BSP_ERROR_BUS_FAILURE -8 #define BSP_ERROR_BUS_FAILURE -8
#define BSP_ERROR_CLOCK_FAILURE -9 #define BSP_ERROR_CLOCK_FAILURE -9
#define BSP_ERROR_MSP_FAILURE -10 #define BSP_ERROR_MSP_FAILURE -10
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11 #define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,4 +1 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE hardware_init.cpp stm32h7xx_nucleo.c)
hardware_init.cpp
stm32h7xx_nucleo.c
)

View File

@ -1,11 +1,9 @@
#include "hardware_init.h" #include "hardware_init.h"
#include "fsfw/tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskIF.h"
#include <rtems_lwip/rtems_lwip.h>
#include <rtems_lwip/ethernetif.h>
#include <rtems_lwip/app_ethernet.h>
#include <rtems_lwip/app_dhcp.h> #include <rtems_lwip/app_dhcp.h>
#include <rtems_lwip/app_ethernet.h>
#include <rtems_lwip/ethernetif.h>
#include <rtems_lwip/rtems_lwip.h>
void hardware_init() { void hardware_init() { rtems_lwip_init(NULL, &ethernet_link_status_updated); }
rtems_lwip_init(NULL, &ethernet_link_status_updated);
}

View File

@ -1,160 +1,149 @@
/** /**
****************************************************************************** ******************************************************************************
* @file stm32h7xx_nucleo.c * @file stm32h7xx_nucleo.c
* @author MCD Application Team * @author MCD Application Team
* @brief This file provides set of firmware functions to manage: * @brief This file provides set of firmware functions to manage:
* - LEDs and push-button available on STM32H7xx-Nucleo Kit * - LEDs and push-button available on STM32H7xx-Nucleo Kit
* from STMicroelectronics * from STMicroelectronics
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics. * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
* All rights reserved.</center></h2> * All rights reserved.</center></h2>
* *
* This software component is licensed by ST under BSD 3-Clause license, * This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the * the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at: * License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause * opensource.org/licenses/BSD-3-Clause
* *
****************************************************************************** ******************************************************************************
*/ */
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_nucleo.h" #include "stm32h7xx_nucleo.h"
/** @addtogroup BSP /** @addtogroup BSP
* @{ * @{
*/ */
/** @addtogroup STM32H7XX_NUCLEO /** @addtogroup STM32H7XX_NUCLEO
* @{ * @{
*/ */
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL /** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL
* @brief This file provides set of firmware functions to manage Leds and push-button * @brief This file provides set of firmware functions to manage Leds and
* available on STM32H7xx-Nucleo Kit from STMicroelectronics. * push-button available on STM32H7xx-Nucleo Kit from STMicroelectronics.
* @{ * @{
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Defines LOW LEVEL Private Defines /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Defines LOW LEVEL Private
* @{ * Defines
*/ * @{
*/
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL Private Typedef /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL
* @{ * Private Typedef
*/ * @{
typedef void (* BSP_EXTI_LineCallback) (void); */
typedef void (*BSP_EXTI_LineCallback)(void);
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported Variables /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported
* @{ * Variables
*/ * @{
*/
EXTI_HandleTypeDef hpb_exti[BUTTONn]; EXTI_HandleTypeDef hpb_exti[BUTTONn];
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
UART_HandleTypeDef hcom_uart[COMn]; UART_HandleTypeDef hcom_uart[COMn];
USART_TypeDef* COM_USART[COMn] = {COM1_UART}; USART_TypeDef *COM_USART[COMn] = {COM1_UART};
#endif #endif
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private
* @{ * Variables
*/ * @{
static GPIO_TypeDef* LED_PORT[LEDn] = {LED1_GPIO_PORT, */
LED2_GPIO_PORT, static GPIO_TypeDef *LED_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT,
LED3_GPIO_PORT}; LED3_GPIO_PORT};
static const uint16_t LED_PIN[LEDn] = {LED1_PIN, static const uint16_t LED_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN};
LED2_PIN,
LED3_PIN};
static GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {BUTTON_USER_GPIO_PORT}; static GPIO_TypeDef *BUTTON_PORT[BUTTONn] = {BUTTON_USER_GPIO_PORT};
static const uint16_t BUTTON_PIN[BUTTONn] = {BUTTON_USER_PIN}; static const uint16_t BUTTON_PIN[BUTTONn] = {BUTTON_USER_PIN};
static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn}; static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn};
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
#if (USE_COM_LOG > 0) #if (USE_COM_LOG > 0)
static COM_TypeDef COM_ActiveLogPort = COM1; static COM_TypeDef COM_ActiveLogPort = COM1;
#endif #endif
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1) #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
static uint32_t IsComMspCbValid[COMn] = {0}; static uint32_t IsComMspCbValid[COMn] = {0};
#endif #endif
#endif #endif
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL Private functions Prototypes /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL
* @{ * Private functions Prototypes
*/ * @{
*/
static void BUTTON_USER_EXTI_Callback(void); static void BUTTON_USER_EXTI_Callback(void);
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
static void COM1_MspInit(UART_HandleTypeDef *huart); static void COM1_MspInit(UART_HandleTypeDef *huart);
static void COM1_MspDeInit(UART_HandleTypeDef *huart); static void COM1_MspDeInit(UART_HandleTypeDef *huart);
#endif #endif
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported
* @{ * Functions
*/ * @{
*/
/** /**
* @brief This method returns the STM32H7XX NUCLEO BSP Driver revision * @brief This method returns the STM32H7XX NUCLEO BSP Driver revision
* @retval version: 0xXYZR (8bits for each decimal, R for RC) * @retval version: 0xXYZR (8bits for each decimal, R for RC)
*/ */
int32_t BSP_GetVersion(void) int32_t BSP_GetVersion(void) { return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION; }
{
return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION;
}
/** /**
* @brief Configures LED GPIO. * @brief Configures LED GPIO.
* @param Led Specifies the Led to be configured. * @param Led Specifies the Led to be configured.
* This parameter can be one of following parameters: * This parameter can be one of following parameters:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_LED_Init(Led_TypeDef Led) int32_t BSP_LED_Init(Led_TypeDef Led) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
GPIO_InitTypeDef gpio_init_structure; GPIO_InitTypeDef gpio_init_structure;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
/* Enable the GPIO LED Clock */ /* Enable the GPIO LED Clock */
if(Led == LED1) if (Led == LED1) {
{
LED1_GPIO_CLK_ENABLE(); LED1_GPIO_CLK_ENABLE();
} } else if (Led == LED2) {
else if(Led == LED2)
{
LED2_GPIO_CLK_ENABLE(); LED2_GPIO_CLK_ENABLE();
} } else {
else
{
LED3_GPIO_CLK_ENABLE(); LED3_GPIO_CLK_ENABLE();
} }
/* Configure the GPIO_LED pin */ /* Configure the GPIO_LED pin */
gpio_init_structure.Pin = LED_PIN[Led]; gpio_init_structure.Pin = LED_PIN[Led];
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP; gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
gpio_init_structure.Pull = GPIO_NOPULL; gpio_init_structure.Pull = GPIO_NOPULL;
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure); HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure);
@ -165,26 +154,22 @@ int32_t BSP_LED_Init(Led_TypeDef Led)
} }
/** /**
* @brief DeInit LEDs. * @brief DeInit LEDs.
* @param Led LED to be de-init. * @param Led LED to be de-init.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx * @note Led DeInit does not disable the GPIO clock nor disable the Mfx
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_LED_DeInit(Led_TypeDef Led) int32_t BSP_LED_DeInit(Led_TypeDef Led) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
GPIO_InitTypeDef gpio_init_structure; GPIO_InitTypeDef gpio_init_structure;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
/* Turn off LED */ /* Turn off LED */
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET); HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
/* DeInit the GPIO_LED pin */ /* DeInit the GPIO_LED pin */
@ -196,24 +181,20 @@ int32_t BSP_LED_DeInit(Led_TypeDef Led)
} }
/** /**
* @brief Turns selected LED On. * @brief Turns selected LED On.
* @param Led Specifies the Led to be set on. * @param Led Specifies the Led to be set on.
* This parameter can be one of following parameters: * This parameter can be one of following parameters:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_LED_On(Led_TypeDef Led) int32_t BSP_LED_On(Led_TypeDef Led) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET); HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET);
} }
@ -221,24 +202,20 @@ int32_t BSP_LED_On(Led_TypeDef Led)
} }
/** /**
* @brief Turns selected LED Off. * @brief Turns selected LED Off.
* @param Led: Specifies the Led to be set off. * @param Led: Specifies the Led to be set off.
* This parameter can be one of following parameters: * This parameter can be one of following parameters:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_LED_Off(Led_TypeDef Led) int32_t BSP_LED_Off(Led_TypeDef Led) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET); HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
} }
@ -246,24 +223,20 @@ int32_t BSP_LED_Off(Led_TypeDef Led)
} }
/** /**
* @brief Toggles the selected LED. * @brief Toggles the selected LED.
* @param Led Specifies the Led to be toggled. * @param Led Specifies the Led to be toggled.
* This parameter can be one of following parameters: * This parameter can be one of following parameters:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_LED_Toggle(Led_TypeDef Led) int32_t BSP_LED_Toggle(Led_TypeDef Led) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]); HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]);
} }
@ -271,62 +244,56 @@ int32_t BSP_LED_Toggle(Led_TypeDef Led)
} }
/** /**
* @brief Get the state of the selected LED. * @brief Get the state of the selected LED.
* @param Led LED to get its state * @param Led LED to get its state
* This parameter can be one of following parameters: * This parameter can be one of following parameters:
* @arg LED1 * @arg LED1
* @arg LED2 * @arg LED2
* @arg LED3 * @arg LED3
* @retval LED status * @retval LED status
*/ */
int32_t BSP_LED_GetState (Led_TypeDef Led) int32_t BSP_LED_GetState(Led_TypeDef Led) {
{
int32_t ret; int32_t ret;
if((Led != LED1) && (Led != LED2) && (Led != LED3)) if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else ret = (int32_t)HAL_GPIO_ReadPin(LED_PORT[Led], LED_PIN[Led]);
{
ret = (int32_t)HAL_GPIO_ReadPin (LED_PORT [Led], LED_PIN [Led]);
} }
return ret; return ret;
} }
/** /**
* @brief Configures button GPIO and EXTI Line. * @brief Configures button GPIO and EXTI Line.
* @param Button Button to be configured * @param Button Button to be configured
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg BUTTON_USER: Wakeup Push Button * @arg BUTTON_USER: Wakeup Push Button
* @param ButtonMode Button mode * @param ButtonMode Button mode
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO * @arg BUTTON_MODE_GPIO: Button will be used as simple IO
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
* with interrupt generation capability * with interrupt generation capability
*/ */
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode) int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode) {
{
GPIO_InitTypeDef gpio_init_structure; GPIO_InitTypeDef gpio_init_structure;
static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {BUTTON_USER_EXTI_Callback}; static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {
static uint32_t BSP_BUTTON_PRIO [BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY}; BUTTON_USER_EXTI_Callback};
static uint32_t BSP_BUTTON_PRIO[BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY};
static const uint32_t BUTTON_EXTI_LINE[BUTTONn] = {BUTTON_USER_EXTI_LINE}; static const uint32_t BUTTON_EXTI_LINE[BUTTONn] = {BUTTON_USER_EXTI_LINE};
/* Enable the BUTTON clock */ /* Enable the BUTTON clock */
BUTTON_USER_GPIO_CLK_ENABLE(); BUTTON_USER_GPIO_CLK_ENABLE();
gpio_init_structure.Pin = BUTTON_PIN [Button]; gpio_init_structure.Pin = BUTTON_PIN[Button];
gpio_init_structure.Pull = GPIO_PULLDOWN; gpio_init_structure.Pull = GPIO_PULLDOWN;
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH; gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
if(ButtonMode == BUTTON_MODE_GPIO) if (ButtonMode == BUTTON_MODE_GPIO) {
{
/* Configure Button pin as input */ /* Configure Button pin as input */
gpio_init_structure.Mode = GPIO_MODE_INPUT; gpio_init_structure.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(BUTTON_PORT [Button], &gpio_init_structure); HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
} } else /* (ButtonMode == BUTTON_MODE_EXTI) */
else /* (ButtonMode == BUTTON_MODE_EXTI) */
{ {
/* Configure Button pin as input with External interrupt */ /* Configure Button pin as input with External interrupt */
gpio_init_structure.Mode = GPIO_MODE_IT_RISING; gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
@ -334,7 +301,8 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure); HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
(void)HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]); (void)HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]);
(void)HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID, ButtonCallback[Button]); (void)HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID,
ButtonCallback[Button]);
/* Enable and set Button EXTI Interrupt to the lowest priority */ /* Enable and set Button EXTI Interrupt to the lowest priority */
HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), BSP_BUTTON_PRIO[Button], 0x00); HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), BSP_BUTTON_PRIO[Button], 0x00);
@ -345,14 +313,13 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
} }
/** /**
* @brief Push Button DeInit. * @brief Push Button DeInit.
* @param Button Button to be configured * @param Button Button to be configured
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg BUTTON_USER: Wakeup Push Button * @arg BUTTON_USER: Wakeup Push Button
* @note PB DeInit does not disable the GPIO clock * @note PB DeInit does not disable the GPIO clock
*/ */
int32_t BSP_PB_DeInit(Button_TypeDef Button) int32_t BSP_PB_DeInit(Button_TypeDef Button) {
{
GPIO_InitTypeDef gpio_init_structure; GPIO_InitTypeDef gpio_init_structure;
gpio_init_structure.Pin = BUTTON_PIN[Button]; gpio_init_structure.Pin = BUTTON_PIN[Button];
@ -363,34 +330,31 @@ int32_t BSP_PB_DeInit(Button_TypeDef Button)
} }
/** /**
* @brief Returns the selected button state. * @brief Returns the selected button state.
* @param Button Button to be checked * @param Button Button to be checked
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg BUTTON_USER: Wakeup Push Button * @arg BUTTON_USER: Wakeup Push Button
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed) * @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
*/ */
int32_t BSP_PB_GetState(Button_TypeDef Button) int32_t BSP_PB_GetState(Button_TypeDef Button) {
{
return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]); return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
} }
/** /**
* @brief BSP Button IRQ handler * @brief BSP Button IRQ handler
* @param Button Can only be BUTTON_USER * @param Button Can only be BUTTON_USER
* @retval None * @retval None
*/ */
void BSP_PB_IRQHandler(Button_TypeDef Button) void BSP_PB_IRQHandler(Button_TypeDef Button) {
{
HAL_EXTI_IRQHandler(&hpb_exti[Button]); HAL_EXTI_IRQHandler(&hpb_exti[Button]);
} }
/** /**
* @brief BSP Push Button callback * @brief BSP Push Button callback
* @param Button Specifies the pin connected EXTI line * @param Button Specifies the pin connected EXTI line
* @retval None * @retval None
*/ */
__weak void BSP_PB_Callback(Button_TypeDef Button) __weak void BSP_PB_Callback(Button_TypeDef Button) {
{
/* Prevent unused argument(s) compilation warning */ /* Prevent unused argument(s) compilation warning */
UNUSED(Button); UNUSED(Button);
@ -400,38 +364,32 @@ __weak void BSP_PB_Callback(Button_TypeDef Button)
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
/** /**
* @brief Configures COM port. * @brief Configures COM port.
* @param COM COM port to be configured. * @param COM COM port to be configured.
* This parameter can be COM1 * This parameter can be COM1
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the * @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
* configuration information for the specified USART peripheral. * configuration information for the specified USART
* @retval BSP error code * peripheral.
*/ * @retval BSP error code
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init) */
{ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init) {
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if(COM >= COMn) if (COM >= COMn) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0) #if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
/* Init the UART Msp */ /* Init the UART Msp */
COM1_MspInit(&hcom_uart[COM]); COM1_MspInit(&hcom_uart[COM]);
#else #else
if(IsComMspCbValid[COM] == 0U) if (IsComMspCbValid[COM] == 0U) {
{ if (BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE) {
if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE)
{
return BSP_ERROR_MSP_FAILURE; return BSP_ERROR_MSP_FAILURE;
} }
} }
#endif #endif
if(MX_USART3_Init(&hcom_uart[COM], COM_Init) != HAL_OK) if (MX_USART3_Init(&hcom_uart[COM], COM_Init) != HAL_OK) {
{
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} }
} }
@ -440,21 +398,17 @@ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
} }
/** /**
* @brief DeInit COM port. * @brief DeInit COM port.
* @param COM COM port to be configured. * @param COM COM port to be configured.
* This parameter can be COM1 * This parameter can be COM1
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_COM_DeInit(COM_TypeDef COM) int32_t BSP_COM_DeInit(COM_TypeDef COM) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if(COM >= COMn) if (COM >= COMn) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
/* USART configuration */ /* USART configuration */
hcom_uart[COM].Instance = COM_USART[COM]; hcom_uart[COM].Instance = COM_USART[COM];
@ -462,8 +416,7 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
COM1_MspDeInit(&hcom_uart[COM]); COM1_MspDeInit(&hcom_uart[COM]);
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */ #endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
if(HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK) if (HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK) {
{
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} }
} }
@ -472,57 +425,52 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
} }
/** /**
* @brief Configures COM port. * @brief Configures COM port.
* @param huart USART handle * @param huart USART handle
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the * @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
* configuration information for the specified USART peripheral. * configuration information for the specified USART
* @retval HAL error code * peripheral.
*/ * @retval HAL error code
__weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init) */
{ __weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
MX_UART_InitTypeDef *COM_Init) {
/* USART configuration */ /* USART configuration */
huart->Instance = COM_USART[COM1]; huart->Instance = COM_USART[COM1];
huart->Init.BaudRate = COM_Init->BaudRate; huart->Init.BaudRate = COM_Init->BaudRate;
huart->Init.Mode = UART_MODE_TX_RX; huart->Init.Mode = UART_MODE_TX_RX;
huart->Init.Parity = (uint32_t)COM_Init->Parity; huart->Init.Parity = (uint32_t)COM_Init->Parity;
huart->Init.WordLength = (uint32_t)COM_Init->WordLength; huart->Init.WordLength = (uint32_t)COM_Init->WordLength;
huart->Init.StopBits = (uint32_t)COM_Init->StopBits; huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl; huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
huart->Init.OverSampling = UART_OVERSAMPLING_8; huart->Init.OverSampling = UART_OVERSAMPLING_8;
return HAL_UART_Init(huart); return HAL_UART_Init(huart);
} }
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1) #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
/** /**
* @brief Register Default COM Msp Callbacks * @brief Register Default COM Msp Callbacks
* @param COM COM port to be configured. * @param COM COM port to be configured.
* This parameter can be COM1 * This parameter can be COM1
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM) int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if(COM >= COMn) if (COM >= COMn) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]); __HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
/* Register default MspInit/MspDeInit Callback */ /* Register default MspInit/MspDeInit Callback */
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, COM1_MspInit) != HAL_OK) if (HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID,
{ COM1_MspInit) != HAL_OK) {
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} } else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, COM1_MspDeInit) != HAL_OK) HAL_UART_MSPDEINIT_CB_ID,
{ COM1_MspDeInit) != HAL_OK) {
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} } else {
else
{
IsComMspCbValid[COM] = 1U; IsComMspCbValid[COM] = 1U;
} }
} }
@ -532,35 +480,29 @@ int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
} }
/** /**
* @brief Register COM Msp Callback registering * @brief Register COM Msp Callback registering
* @param COM COM port to be configured. * @param COM COM port to be configured.
* This parameter can be COM1 * This parameter can be COM1
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions * @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback) int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback) {
{
int32_t ret = BSP_ERROR_NONE; int32_t ret = BSP_ERROR_NONE;
if(COM >= COMn) if (COM >= COMn) {
{
ret = BSP_ERROR_WRONG_PARAM; ret = BSP_ERROR_WRONG_PARAM;
} } else {
else
{
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]); __HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
/* Register MspInit/MspDeInit Callbacks */ /* Register MspInit/MspDeInit Callbacks */
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK) if (HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID,
{ Callback->pMspInitCb) != HAL_OK) {
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} } else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK) HAL_UART_MSPDEINIT_CB_ID,
{ Callback->pMspDeInitCb) != HAL_OK) {
ret = BSP_ERROR_PERIPH_FAILURE; ret = BSP_ERROR_PERIPH_FAILURE;
} } else {
else
{
IsComMspCbValid[COM] = 1U; IsComMspCbValid[COM] = 1U;
} }
} }
@ -571,59 +513,55 @@ int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
#if (USE_COM_LOG > 0) #if (USE_COM_LOG > 0)
/** /**
* @brief Select the active COM port. * @brief Select the active COM port.
* @param COM COM port to be activated. * @param COM COM port to be activated.
* This parameter can be COM1 * This parameter can be COM1
* @retval BSP status * @retval BSP status
*/ */
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM) int32_t BSP_COM_SelectLogPort(COM_TypeDef COM) {
{ if (COM_ActiveLogPort != COM) {
if(COM_ActiveLogPort != COM)
{
COM_ActiveLogPort = COM; COM_ActiveLogPort = COM;
} }
return BSP_ERROR_NONE; return BSP_ERROR_NONE;
} }
/** /**
* @brief Redirect console output to COM * @brief Redirect console output to COM
*/ */
#ifdef __GNUC__ #ifdef __GNUC__
int __io_putchar (int ch) int __io_putchar(int ch)
#else #else
int fputc (int ch, FILE *f) int fputc(int ch, FILE *f)
#endif /* __GNUC__ */ #endif /* __GNUC__ */
{ {
HAL_UART_Transmit (&hcom_uart [COM_ActiveLogPort], (uint8_t *) &ch, 1, COM_POLL_TIMEOUT); HAL_UART_Transmit(&hcom_uart[COM_ActiveLogPort], (uint8_t *)&ch, 1,
COM_POLL_TIMEOUT);
return ch; return ch;
} }
#endif /* USE_COM_LOG */ #endif /* USE_COM_LOG */
#endif /* USE_BSP_COM_FEATURE */ #endif /* USE_BSP_COM_FEATURE */
/** /**
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Functions LOW LEVEL Private functions /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Functions LOW LEVEL Private
* @{ * functions
*/ * @{
*/
/** /**
* @brief Key EXTI line detection callbacks. * @brief Key EXTI line detection callbacks.
* @retval BSP status * @retval BSP status
*/ */
static void BUTTON_USER_EXTI_Callback(void) static void BUTTON_USER_EXTI_Callback(void) { BSP_PB_Callback(BUTTON_USER); }
{
BSP_PB_Callback(BUTTON_USER);
}
#if (USE_BSP_COM_FEATURE > 0) #if (USE_BSP_COM_FEATURE > 0)
/** /**
* @brief Initializes UART MSP. * @brief Initializes UART MSP.
* @param huart UART handle * @param huart UART handle
* @retval BSP status * @retval BSP status
*/ */
static void COM1_MspInit(UART_HandleTypeDef *huart) static void COM1_MspInit(UART_HandleTypeDef *huart) {
{
GPIO_InitTypeDef gpio_init_structure; GPIO_InitTypeDef gpio_init_structure;
/* Prevent unused argument(s) compilation warning */ /* Prevent unused argument(s) compilation warning */
@ -652,22 +590,21 @@ static void COM1_MspInit(UART_HandleTypeDef *huart)
} }
/** /**
* @brief Initialize USART3 Msp part * @brief Initialize USART3 Msp part
* @param huart UART handle * @param huart UART handle
* @retval BSP status * @retval BSP status
*/ */
static void COM1_MspDeInit(UART_HandleTypeDef *huart) static void COM1_MspDeInit(UART_HandleTypeDef *huart) {
{ GPIO_InitTypeDef gpio_init_structure;
GPIO_InitTypeDef gpio_init_structure;
/* Prevent unused argument(s) compilation warning */ /* Prevent unused argument(s) compilation warning */
UNUSED(huart); UNUSED(huart);
/* COM GPIO pin configuration */ /* COM GPIO pin configuration */
gpio_init_structure.Pin = COM1_TX_PIN; gpio_init_structure.Pin = COM1_TX_PIN;
HAL_GPIO_DeInit(COM1_TX_GPIO_PORT, gpio_init_structure.Pin); HAL_GPIO_DeInit(COM1_TX_GPIO_PORT, gpio_init_structure.Pin);
gpio_init_structure.Pin = COM1_RX_PIN; gpio_init_structure.Pin = COM1_RX_PIN;
HAL_GPIO_DeInit(COM1_RX_GPIO_PORT, gpio_init_structure.Pin); HAL_GPIO_DeInit(COM1_RX_GPIO_PORT, gpio_init_structure.Pin);
/* Disable USART clock */ /* Disable USART clock */
@ -675,19 +612,19 @@ static void COM1_MspDeInit(UART_HandleTypeDef *huart)
} }
#endif /* USE_BSP_COM_FEATURE */ #endif /* USE_BSP_COM_FEATURE */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/** /**
* @} * @}
*/ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,2 +1 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE)
)

View File

@ -1,6 +1,2 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE InitMission.cpp ObjectFactory.cpp
InitMission.cpp printChar.c)
ObjectFactory.cpp
printChar.c
)

View File

@ -1,196 +1,204 @@
#include "InitMission.h" #include "InitMission.h"
#include "example/utility/TaskCreation.h"
#include <OBSWConfig.h> #include <OBSWConfig.h>
#include <mission/utility/TaskCreation.h>
#include <objects/systemObjectList.h>
#include <pollingsequence/pollingSequenceFactory.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <objects/systemObjectList.h>
#include <pollingsequence/pollingSequenceFactory.h>
#include <rtems/rtems/support.h> #include <rtems/rtems/support.h>
#include <rtems/score/heapinfo.h> #include <rtems/score/heapinfo.h>
void InitMission::createTasks() { void InitMission::createTasks() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if OBSW_ADD_CORE_COMPONENTS == 1 #if OBSW_ADD_CORE_COMPONENTS == 1
/* TMTC Distribution */ /* TMTC Distribution */
PeriodicTaskIF* distributerTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *distributerTask = TaskFactory::instance()->createPeriodicTask(
"DIST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr); "DIST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR); result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR); task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
} }
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR); result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS distributor", objects::CCSDS_DISTRIBUTOR); task::printInitError("PUS distributor", objects::CCSDS_DISTRIBUTOR);
} }
result = distributerTask->addComponent(objects::TM_FUNNEL); result = distributerTask->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("TM funnel", objects::TM_FUNNEL); task::printInitError("TM funnel", objects::TM_FUNNEL);
} }
PeriodicTaskIF* eventManagerTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *eventManagerTask =
"EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr); TaskFactory::instance()->createPeriodicTask(
result = eventManagerTask->addComponent(objects::EVENT_MANAGER); "EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
if(result != HasReturnvaluesIF::RETURN_OK) { result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
task::printInitError("TM funnel", objects::TM_FUNNEL); if (result != HasReturnvaluesIF::RETURN_OK) {
} task::printInitError("TM funnel", objects::TM_FUNNEL);
}
#if OBSW_ADD_LWIP_COMPONENTS == 1 #if OBSW_ADD_LWIP_COMPONENTS == 1
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
"UDP_UNIX_BRIDGE", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr); "UDP_UNIX_BRIDGE", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE); result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("UDP bridge", objects::UDP_BRIDGE); task::printInitError("UDP bridge", objects::UDP_BRIDGE);
} }
PeriodicTaskIF* udpPollingTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *udpPollingTask = TaskFactory::instance()->createPeriodicTask(
"UDP_POLLING", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.1, nullptr); "UDP_POLLING", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.1, nullptr);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK); result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK); task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
} }
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */ #endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
#if OBSW_ADD_PUS_STACK == 1 #if OBSW_ADD_PUS_STACK == 1
/* PUS Services */ /* PUS Services */
PeriodicTaskIF* pusVerification = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *pusVerification = TaskFactory::instance()->createPeriodicTask(
"PUS_VERIF_1", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); "PUS_VERIF_1", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){ if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION); task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
} }
PeriodicTaskIF* pusHighPrio = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *pusHighPrio = TaskFactory::instance()->createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr); "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS); task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
} }
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){ if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING); task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING);
} }
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT); task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
} }
PeriodicTaskIF* pusMedPrio = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *pusMedPrio = TaskFactory::instance()->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr); "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT); task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
} }
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT); task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
} }
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *pusLowPrio = TaskFactory::instance()->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr); "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK){ if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST); task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
} }
#endif /* OBSW_ADD_PUS_STACK == 1 */ #endif /* OBSW_ADD_PUS_STACK == 1 */
#if OBSW_ADD_TASK_EXAMPLE == 1 #if OBSW_ADD_TASK_EXAMPLE == 1
FixedTimeslotTaskIF* timeslotDemoTask = TaskFactory::instance()->createFixedTimeslotTask( FixedTimeslotTaskIF *timeslotDemoTask =
"PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr); TaskFactory::instance()->createFixedTimeslotTask(
result = pst::pollingSequenceExamples(timeslotDemoTask); "PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr);
if(result != HasReturnvaluesIF::RETURN_OK) { result = pst::pollingSequenceExamples(timeslotDemoTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "InitMission::createTasks: Examples PST initialization failed!" << std::endl; sif::error
<< "InitMission::createTasks: Examples PST initialization failed!"
<< std::endl;
#else #else
sif::printError("InitMission::createTasks: Examples PST initialization failed!\n"); sif::printError(
"InitMission::createTasks: Examples PST initialization failed!\n");
#endif #endif
} }
PeriodicTaskIF* readerTask = TaskFactory::instance()-> PeriodicTaskIF *readerTask = TaskFactory::instance()->createPeriodicTask(
createPeriodicTask("READER_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); "READER_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = readerTask->addComponent(objects::TEST_DUMMY_4); result = readerTask->addComponent(objects::TEST_DUMMY_4);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("Demo Reader Task", objects::TEST_DUMMY_4); task::printInitError("Demo Reader Task", objects::TEST_DUMMY_4);
} }
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */ #endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1 #if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->createFixedTimeslotTask( FixedTimeslotTaskIF *testTimeslotTask =
"PST_TEST_TASK", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); TaskFactory::instance()->createFixedTimeslotTask(
result = pst::pollingSequenceDevices(testTimeslotTask); "PST_TEST_TASK", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0,
if(result != HasReturnvaluesIF::RETURN_OK) { nullptr);
result = pst::pollingSequenceDevices(testTimeslotTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "InitMission::createTasks: Devices PST initialization failed!" << std::endl; sif::error << "InitMission::createTasks: Devices PST initialization failed!"
<< std::endl;
#else #else
sif::printError("InitMission::createTasks: Devices PST initialization failed!\n"); sif::printError(
"InitMission::createTasks: Devices PST initialization failed!\n");
#endif #endif
} }
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */ #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
PeriodicTaskIF* testTask = TaskFactory::instance()-> PeriodicTaskIF *testTask = TaskFactory::instance()->createPeriodicTask(
createPeriodicTask("TEST", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); "TEST", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = testTask->addComponent(objects::TEST_TASK); result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("Test Task", objects::TEST_TASK); task::printInitError("Test Task", objects::TEST_TASK);
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Starting tasks.." << std::endl; sif::info << "Starting tasks.." << std::endl;
#else #else
sif::printInfo("Starting tasks..\n"); sif::printInfo("Starting tasks..\n");
#endif #endif
#if OBSW_ADD_CORE_COMPONENTS == 1 #if OBSW_ADD_CORE_COMPONENTS == 1
distributerTask->startTask(); distributerTask->startTask();
eventManagerTask->startTask(); eventManagerTask->startTask();
#if OBSW_ADD_LWIP_COMPONENTS == 1 #if OBSW_ADD_LWIP_COMPONENTS == 1
udpBridgeTask->startTask(); udpBridgeTask->startTask();
udpPollingTask->startTask(); udpPollingTask->startTask();
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */ #endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
#if OBSW_ADD_PUS_STACK == 1 #if OBSW_ADD_PUS_STACK == 1
pusVerification->startTask(); pusVerification->startTask();
pusHighPrio->startTask(); pusHighPrio->startTask();
pusMedPrio->startTask(); pusMedPrio->startTask();
pusLowPrio->startTask(); pusLowPrio->startTask();
#endif /* OBSW_ADD_PUS_STACK == 1 */ #endif /* OBSW_ADD_PUS_STACK == 1 */
#if OBSW_ADD_TASK_EXAMPLE == 1 #if OBSW_ADD_TASK_EXAMPLE == 1
timeslotDemoTask->startTask(); timeslotDemoTask->startTask();
readerTask->startTask(); readerTask->startTask();
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */ #endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1 #if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
testTimeslotTask->startTask(); testTimeslotTask->startTask();
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */ #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
testTask->startTask(); testTask->startTask();
Heap_Information_block block; Heap_Information_block block;
rtems_workspace_get_information(&block); rtems_workspace_get_information(&block);
uint32_t failedAllocs = block.Stats.failed_allocs; uint32_t failedAllocs = block.Stats.failed_allocs;
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Tasks started.." << std::endl; sif::info << "Tasks started.." << std::endl;
sif::info << "Remaining RTEMS heap: " << block.Stats.free_size << " bytes" << std::endl; sif::info << "Remaining RTEMS heap: " << block.Stats.free_size << " bytes"
<< std::endl;
#else #else
sif::printInfo("Tasks started..\n"); sif::printInfo("Tasks started..\n");
sif::printInfo("Allocated RTEMS heap: %lu bytes\n", static_cast<unsigned long>( sif::printInfo("Allocated RTEMS heap: %lu bytes\n",
block.Stats.size)); static_cast<unsigned long>(block.Stats.size));
sif::printInfo("Remaining RTEMS heap: %lu bytes\n", static_cast<unsigned long>( sif::printInfo("Remaining RTEMS heap: %lu bytes\n",
block.Stats.free_size)); static_cast<unsigned long>(block.Stats.free_size));
if(failedAllocs > 0) { if (failedAllocs > 0) {
sif::printWarning("%d allocations from RTEMS workspace failed!\n", failedAllocs); sif::printWarning("%d allocations from RTEMS workspace failed!\n",
} failedAllocs);
}
#endif #endif
} }

View File

@ -2,12 +2,12 @@
#include <OBSWConfig.h> #include <OBSWConfig.h>
#include <objects/systemObjectList.h> #include <objects/systemObjectList.h>
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h" #include "example/core/GenericFactory.h"
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h" #include "example/test/FsfwTestTask.h"
#include "example/utility/TmFunnel.h"
#include "example_common/stm32h7/STM32TestTask.h" #include "example_common/stm32h7/STM32TestTask.h"
#include <test/TestTask.h> #include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
#include <mission/utility/TmFunnel.h> #include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
#include <mission/core/GenericFactory.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h> #include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/monitoring/MonitoringMessageContent.h> #include <fsfw/monitoring/MonitoringMessageContent.h>
@ -18,43 +18,40 @@
#include <rtems_lwip/rtems_lwip.h> #include <rtems_lwip/rtems_lwip.h>
void ObjectFactory::produce(void* args) { void ObjectFactory::produce(void *args) {
/* Located inside GenericFactory source file */ /* Located inside GenericFactory source file */
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
#if OBSW_ADD_CORE_COMPONENTS == 1 #if OBSW_ADD_CORE_COMPONENTS == 1
{ {
LocalPool::LocalPoolConfig poolCfg = { LocalPool::LocalPoolConfig poolCfg = {
{15, 32}, {10, 64}, {5, 128}, {1, 1024} {15, 32}, {10, 64}, {5, 128}, {1, 1024}};
}; new PoolManager(objects::TC_STORE, poolCfg);
new PoolManager(objects::TC_STORE, poolCfg); }
}
{ {
LocalPool::LocalPoolConfig poolCfg = { LocalPool::LocalPoolConfig poolCfg = {
{15, 32}, {10, 64}, {5, 128}, {1, 1024} {15, 32}, {10, 64}, {5, 128}, {1, 1024}};
}; new PoolManager(objects::TM_STORE, poolCfg);
new PoolManager(objects::TM_STORE, poolCfg); }
}
{ {
LocalPool::LocalPoolConfig poolCfg = { LocalPool::LocalPoolConfig poolCfg = {
{15, 32}, {10, 64}, {5, 128}, {1, 1024} {15, 32}, {10, 64}, {5, 128}, {1, 1024}};
}; new PoolManager(objects::IPC_STORE, poolCfg);
new PoolManager(objects::IPC_STORE, poolCfg); }
}
#if OBSW_ADD_LWIP_COMPONENTS == 1 #if OBSW_ADD_LWIP_COMPONENTS == 1
/* UDP Server */ /* UDP Server */
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
objects::CCSDS_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); objects::TM_STORE, objects::TC_STORE);
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE, new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE,
rtems_lwip_get_netif(0)); rtems_lwip_get_netif(0));
#endif /* OBSW_ADD_LWIP_NETWORKING == 1 */ #endif /* OBSW_ADD_LWIP_NETWORKING == 1 */
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
new STM32TestTask(objects::TEST_TASK, false); new STM32TestTask(objects::TEST_TASK, false);
} }

View File

@ -1,9 +1,8 @@
#ifndef MISSION_CORE_OBJECTFACTORY_H_ #ifndef MISSION_CORE_OBJECTFACTORY_H_
#define MISSION_CORE_OBJECTFACTORY_H_ #define MISSION_CORE_OBJECTFACTORY_H_
namespace ObjectFactory { namespace ObjectFactory {
void produce(void* args); void produce(void *args);
}; };
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */ #endif /* MISSION_CORE_OBJECTFACTORY_H_ */

View File

@ -1,16 +1,14 @@
#include <OBSWConfig.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <OBSWConfig.h>
#include <stm32h7xx_hal_uart.h> #include <stm32h7xx_hal_uart.h>
#include <hal.h> #include <hal.h>
void printChar(const char* character, bool errStream) { void printChar(const char *character, bool errStream) {
HAL_UART_Transmit(&stm32h7_usart3_instance.uart, (uint8_t*) character, 1, HAL_UART_Transmit(&stm32h7_usart3_instance.uart, (uint8_t *)character, 1,
DEBUG_UART_MS_TIMEOUT); DEBUG_UART_MS_TIMEOUT);
/* Does not work for some reason */ /* Does not work for some reason */
//stm32h7_uart_polled_write(&stm32h7_usart3_instance.device, (int) character); // stm32h7_uart_polled_write(&stm32h7_usart3_instance.device, (int)
// character);
} }

View File

@ -1,11 +1,6 @@
target_sources(${TARGET_NAME} target_sources(
PRIVATE ${TARGET_NAME} PRIVATE ipc/missionMessageTypes.cpp
ipc/missionMessageTypes.cpp pollingsequence/pollingSequenceFactory.cpp)
pollingsequence/pollingSequenceFactory.cpp
)
# Add include paths for the executable # Add include paths for the executable
target_include_directories(${TARGET_NAME} target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -4,11 +4,8 @@
#include <cstdint> #include <cstdint>
namespace devaddress { namespace devaddress {
enum devaddress: uint32_t { enum devaddress : uint32_t { L3GD20H = 1 };
L3GD20H = 1
};
} }
#endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */ #endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */

View File

@ -4,8 +4,7 @@
#include "commonSubsystemIds.h" #include "commonSubsystemIds.h"
namespace SUBSYSTEM_ID { namespace SUBSYSTEM_ID {
enum subsystemId: uint8_t { enum subsystemId : uint8_t {};
};
} }
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */ #endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */

View File

@ -2,10 +2,10 @@
#include <fsfw/ipc/CommandMessage.h> #include <fsfw/ipc/CommandMessage.h>
#include <fsfw/ipc/CommandMessageCleaner.h> #include <fsfw/ipc/CommandMessageCleaner.h>
void messagetypes::clearMissionMessage(CommandMessage* message) { void messagetypes::clearMissionMessage(CommandMessage *message) {
switch((message->getMessageType())) { switch ((message->getMessageType())) {
default: default:
message->setCommand(CommandMessage::CMD_NONE); message->setCommand(CommandMessage::CMD_NONE);
break; break;
} }
} }

View File

@ -7,13 +7,14 @@ class CommandMessage;
namespace messagetypes { namespace messagetypes {
/* First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT! */ /* First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT! */
/* Remember to add new message types to the clearMissionMessage function below! */ /* Remember to add new message types to the clearMissionMessage function below!
*/
enum MISSION_MESSAGE_TYPE { enum MISSION_MESSAGE_TYPE {
COSTUM_MESSAGE = FW_MESSAGES_COUNT, COSTUM_MESSAGE = FW_MESSAGES_COUNT,
}; };
void clearMissionMessage(CommandMessage* message); void clearMissionMessage(CommandMessage *message);
} } // namespace messagetypes
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */ #endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */

View File

@ -1,19 +1,19 @@
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <commonSystemObjects.h> #include "commonObjects.h"
namespace objects { namespace objects {
enum mission_objects { enum mission_objects {
/* 0x62 ('b') Board and mission specific objects */ /* 0x62 ('b') Board and mission specific objects */
UDP_BRIDGE = 0x62000300, UDP_BRIDGE = 0x62000300,
UDP_POLLING_TASK = 0x62000400, UDP_POLLING_TASK = 0x62000400,
SPI_COM_IF = 0x63001000, SPI_COM_IF = 0x63001000,
SPI_DEVICE_TEST = 0x74001000, SPI_DEVICE_TEST = 0x74001000,
/* Generic name for FSFW static ID setter */ /* Generic name for FSFW static ID setter */
DOWNLINK_DESTINATION = UDP_BRIDGE DOWNLINK_DESTINATION = UDP_BRIDGE
}; };
} }

View File

@ -8,26 +8,30 @@
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length); static_cast<void>(length);
#if OBSW_PERFORM_L3GD20H_TEST == 1 #if OBSW_PERFORM_L3GD20H_TEST == 1
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0,
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3, DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length, thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length, DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length,
DeviceHandlerIF::GET_READ);
#endif #endif
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl; sif::error << "pst::pollingSequenceInitFunction: Initialization errors!"
<< std::endl;
#else #else
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n"); sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -9,7 +9,7 @@ class FixedTimeslotTaskIF;
namespace pst { namespace pst {
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence); ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence); ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence); ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF *thisSequence);
} } // namespace pst
#endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */ #endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */

View File

@ -4,9 +4,7 @@
#include <commonConfig.h> #include <commonConfig.h>
namespace CLASS_ID { namespace CLASS_ID {
enum classIds: uint8_t { enum classIds : uint8_t {};
};
} }
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */ #endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */

View File

@ -1,8 +1,8 @@
#ifndef FSFWCONFIG_TMTC_APID_H_ #ifndef FSFWCONFIG_TMTC_APID_H_
#define FSFWCONFIG_TMTC_APID_H_ #define FSFWCONFIG_TMTC_APID_H_
#include <cstdint>
#include <commonConfig.h> #include <commonConfig.h>
#include <cstdint>
namespace apid { namespace apid {
static const uint16_t APID = COMMON_APID; static const uint16_t APID = COMMON_APID;

View File

@ -3,5 +3,4 @@
#include <commonConfig.h> #include <commonConfig.h>
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */ #endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */

View File

@ -3,12 +3,12 @@
extern int main(); extern int main();
/** /**
* Entry point for the RTEMS BSP after low level and RTEMS executive initialization. * Entry point for the RTEMS BSP after low level and RTEMS executive
* initialization.
* @param argument * @param argument
* @return * @return
*/ */
rtems_task Init(rtems_task_argument argument) { rtems_task Init(rtems_task_argument argument) {
main(); main();
return (void) rtems_task_delete( RTEMS_SELF ); return (void)rtems_task_delete(RTEMS_SELF);
} }

View File

@ -1,9 +1,9 @@
#include "core/ObjectFactory.h"
#include "core/InitMission.h" #include "core/InitMission.h"
#include "stm32h7xx_nucleo.h" #include "core/ObjectFactory.h"
#include "hardware_init.h" #include "hardware_init.h"
#include "stm32h7xx_nucleo.h"
#include "example_common/mission/utility/compile_time.h" #include "example/utility/compile_time.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
@ -30,24 +30,24 @@ ServiceInterfaceStream sif::error("ERROR", true);
* @author R. Mueller * @author R. Mueller
*/ */
int main() { int main() {
hardware_init(); hardware_init();
printf("\n\r%s-- FSFW Example (RTEMS) --\n", sif::ANSI_COLOR_RESET); printf("\n\r%s-- FSFW Example (RTEMS) --\n", sif::ANSI_COLOR_RESET);
printf("-- Compiled for %s --\n", BOARD_NAME); printf("-- Compiled for %s --\n", BOARD_NAME);
printf("-- Compiled on %s %s --\n\r",__DATE__, __TIME__); printf("-- Compiled on %s %s --\n\r", __DATE__, __TIME__);
timeval timeToSet; timeval timeToSet{};
timeToSet.tv_sec = UNIX_TIMESTAMP; timeToSet.tv_sec = UNIX_TIMESTAMP;
timeToSet.tv_usec = 0; timeToSet.tv_usec = 0;
ReturnValue_t clockStatus = Clock::setClock(&timeToSet); ReturnValue_t clockStatus = Clock::setClock(&timeToSet);
if(clockStatus != HasReturnvaluesIF::RETURN_OK) { if (clockStatus != HasReturnvaluesIF::RETURN_OK) {
sif::printError("Clock configuration failed!\n"); sif::printError("Clock configuration failed!\n");
} } else {
else { sif::printInfo("Clock configured successfully.\n");
sif::printInfo("Clock configured successfully.\n"); }
} ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce,
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr); nullptr);
ObjectManager::instance()->initialize(); ObjectManager::instance()->initialize();
InitMission::createTasks(); InitMission::createTasks();
} }

@ -1 +1 @@
Subproject commit 365c84c4f2be44cb14cb990c9d04769b1e69fbc2 Subproject commit 65b89ccd888df8f873b6dafb344efbc6692c0d45

@ -1 +1 @@
Subproject commit d34effb278c645fb6532db56521dd4d08eb0f4a6 Subproject commit ebb6a6d6a15d5b3a9bb3178b7fb02b70378ebfb1

2
fsfw

@ -1 +1 @@
Subproject commit c7cf8e710db2fbf99b37f263f064aabdddf379b5 Subproject commit 828ede80964f04ab94eda199415f16d0161fdb0e

32
scripts/auto-formatter.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
if [[ ! -f README.md ]]; then
cd ..
fi
folder_list=(
"./bsp_stm32h7_rtems"
"./example_common"
)
cmake_fmt="cmake-format"
file_selectors="-iname CMakeLists.txt"
if command -v ${cmake_fmt} &> /dev/null; then
echo "Auto-formatting all CMakeLists.txt files"
${cmake_fmt} -i CMakeLists.txt
for dir in ${folder_list[@]}; do
find ${dir} ${file_selectors} | xargs ${cmake_fmt} -i
done
else
echo "No ${cmake_fmt} tool found, not formatting CMake files"
fi
cpp_format="clang-format"
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then
for dir in ${folder_list[@]}; do
echo "Auto-formatting C/C++ files in ${dir} recursively"
find ${dir} ${file_selectors} | xargs ${cpp_format} --style=file -i
done
else
echo "No ${cpp_format} tool found, not formatting C++/C files"
fi