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,11 +1,10 @@
################################################################################ # ##############################################################################
# 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)
@ -13,8 +12,10 @@ cmake_minimum_required(VERSION 3.13)
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,13 +63,8 @@ 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")
@ -80,9 +73,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
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}
PRIVATE ${LIB_FSFW_NAME} etl
# Link against lwip which is part of the RTEMS BSP # Link against lwip which is part of the RTEMS BSP
${LIB_LWIP_NAME} ${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

@ -59,21 +59,24 @@
#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,
@ -83,8 +86,7 @@ typedef enum
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,
@ -95,55 +97,38 @@ typedef enum
} 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;
@ -152,8 +137,7 @@ typedef struct
} 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;
@ -166,7 +150,8 @@ typedef struct
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported
* Constants
* @{ * @{
*/ */
@ -176,11 +161,14 @@ typedef struct
#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
* @{ * @{
@ -192,7 +180,8 @@ typedef struct
#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) || \
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
#define LED2_PIN GPIO_PIN_1 #define LED2_PIN GPIO_PIN_1
#define LED2_GPIO_PORT GPIOE #define LED2_GPIO_PORT GPIOE
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
@ -283,7 +272,8 @@ extern USART_TypeDef* COM_USART[];
* @} * @}
*/ */
/** @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_GetVersion(void);
@ -310,7 +300,8 @@ int32_t BSP_COM_SelectLogPort (COM_TypeDef COM);
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 */
/** /**

View File

@ -26,8 +26,8 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"
#include "stm32h743xx.h" #include "stm32h743xx.h"
#include "stm32h7xx_hal.h"
/** @addtogroup BSP /** @addtogroup BSP
* @{ * @{

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

@ -31,12 +31,13 @@
*/ */
/** @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
* @{ * @{
*/ */
@ -44,7 +45,8 @@
* @} * @}
*/ */
/** @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);
@ -52,7 +54,8 @@ 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];
@ -63,23 +66,19 @@ USART_TypeDef* COM_USART[COMn] = {COM1_UART};
/** /**
* @} * @}
*/ */
/** @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, static GPIO_TypeDef *LED_PORT[LEDn] = {LED1_GPIO_PORT, LED2_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;
@ -93,7 +92,8 @@ static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn};
* @} * @}
*/ */
/** @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);
@ -105,7 +105,8 @@ static void COM1_MspDeInit(UART_HandleTypeDef *huart);
* @} * @}
*/ */
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions /** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported
* Functions
* @{ * @{
*/ */
@ -113,10 +114,7 @@ static void COM1_MspDeInit(UART_HandleTypeDef *huart);
* @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.
@ -127,28 +125,19 @@ int32_t BSP_GetVersion(void)
* @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 */
@ -174,17 +163,13 @@ int32_t BSP_LED_Init(Led_TypeDef Led)
* @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 */
@ -204,16 +189,12 @@ int32_t BSP_LED_DeInit(Led_TypeDef Led)
* @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);
} }
@ -229,16 +210,12 @@ int32_t BSP_LED_On(Led_TypeDef Led)
* @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);
} }
@ -254,16 +231,12 @@ int32_t BSP_LED_Off(Led_TypeDef Led)
* @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]);
} }
@ -279,16 +252,12 @@ int32_t BSP_LED_Toggle(Led_TypeDef Led)
* @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]);
} }
@ -306,10 +275,10 @@ int32_t BSP_LED_GetState (Led_TypeDef Led)
* @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] = {
BUTTON_USER_EXTI_Callback};
static uint32_t BSP_BUTTON_PRIO[BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY}; 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};
@ -320,13 +289,11 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
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);
@ -351,8 +319,7 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
* @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];
@ -369,8 +336,7 @@ int32_t BSP_PB_DeInit(Button_TypeDef Button)
* @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]);
} }
@ -379,8 +345,7 @@ int32_t BSP_PB_GetState(Button_TypeDef Button)
* @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]);
} }
@ -389,8 +354,7 @@ void BSP_PB_IRQHandler(Button_TypeDef Button)
* @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);
@ -404,34 +368,28 @@ __weak void BSP_PB_Callback(Button_TypeDef Button)
* @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
* peripheral.
* @retval BSP error code * @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;
} }
} }
@ -445,16 +403,12 @@ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
* 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;
} }
} }
@ -475,11 +428,12 @@ 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
* peripheral.
* @retval HAL error code * @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;
@ -500,29 +454,23 @@ __weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitT
* 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;
} }
} }
@ -538,29 +486,23 @@ int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
* @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;
} }
} }
@ -576,10 +518,8 @@ int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
* 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;
@ -594,7 +534,8 @@ int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
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 */
@ -604,17 +545,15 @@ int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
* @} * @}
*/ */
/** @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)
/** /**
@ -622,8 +561,7 @@ static void BUTTON_USER_EXTI_Callback(void)
* @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 */
@ -656,8 +594,7 @@ static void COM1_MspInit(UART_HandleTypeDef *huart)
* @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 */

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,19 +1,18 @@
#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
@ -33,7 +32,8 @@ void InitMission::createTasks() {
task::printInitError("TM funnel", objects::TM_FUNNEL); task::printInitError("TM funnel", objects::TM_FUNNEL);
} }
PeriodicTaskIF* eventManagerTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *eventManagerTask =
TaskFactory::instance()->createPeriodicTask(
"EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr); "EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
result = eventManagerTask->addComponent(objects::EVENT_MANAGER); result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
@ -102,19 +102,23 @@ void InitMission::createTasks() {
#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 =
TaskFactory::instance()->createFixedTimeslotTask(
"PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr); "PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr);
result = pst::pollingSequenceExamples(timeslotDemoTask); result = pst::pollingSequenceExamples(timeslotDemoTask);
if (result != HasReturnvaluesIF::RETURN_OK) { 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);
@ -122,20 +126,24 @@ void InitMission::createTasks() {
#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(
"PST_TEST_TASK", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0,
nullptr);
result = pst::pollingSequenceDevices(testTimeslotTask); result = pst::pollingSequenceDevices(testTimeslotTask);
if (result != HasReturnvaluesIF::RETURN_OK) { 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);
@ -180,17 +188,17 @@ void InitMission::createTasks() {
#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>
@ -25,29 +25,26 @@ void ObjectFactory::produce(void* args) {
#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 */

View File

@ -1,7 +1,6 @@
#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);
}; };

View File

@ -1,6 +1,6 @@
#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>
@ -9,8 +9,6 @@ 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

@ -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,7 +1,7 @@
#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 {

View File

@ -12,22 +12,26 @@ ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
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.3,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length, thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length,
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length, DeviceHandlerIF::GET_READ); 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

@ -10,6 +10,6 @@ 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,7 +3,8 @@
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
*/ */
@ -11,4 +12,3 @@ 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"
@ -36,17 +36,17 @@ int main() {
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, nullptr); ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce,
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