apply afmt
This commit is contained in:
parent
ec6a398631
commit
603b23714a
156
CMakeLists.txt
156
CMakeLists.txt
@ -1,20 +1,21 @@
|
||||
################################################################################
|
||||
# CMake support for the Flight Software Framework
|
||||
# Author: R. Mueller
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# CMake support for the Flight Software Framework Author: R. Mueller
|
||||
# ##############################################################################
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Pre-Project preparation
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
|
||||
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(STM32_ADD_NETWORKING_CODE ON)
|
||||
set(FSFW_OSAL
|
||||
rtems
|
||||
CACHE STRING "OS for the FSFW")
|
||||
set(STM32_ADD_NETWORKING_CODE ON)
|
||||
set(OBSW_MAX_SCHEDULED_TCS 200)
|
||||
set(FSFW_HAL_ADD_STM32H7 ON)
|
||||
|
||||
@ -28,16 +29,16 @@ include("${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake")
|
||||
# Project Name
|
||||
project(fsfw-example-stm32h7-rtems ASM C CXX)
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Pre-Sources preparation
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Set names and variables
|
||||
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(LIB_FSFW_NAME fsfw)
|
||||
set(LIB_LWIP_NAME lwip)
|
||||
|
||||
@ -51,12 +52,9 @@ set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||
set(BSP_NUCLEO_PATH "${BSP_PATH}/boarconfig/NUCLEO-H743ZI")
|
||||
set(BSP_NUCLEO_PATH_INC "${BSP_PATH}/boardconfig/NUCLEO-H743ZI/Inc")
|
||||
|
||||
set(FSFW_ADDITIONAL_INC_PATHS
|
||||
"${COMMON_CONFIG_PATH}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CACHE STRING
|
||||
"FSFW configuration paths"
|
||||
)
|
||||
set(FSFW_ADDITIONAL_INC_PATHS
|
||||
"${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CACHE STRING "FSFW configuration paths")
|
||||
|
||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.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)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(WARNING_FLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wimplicit-fallthrough=1
|
||||
-Wno-unused-parameter
|
||||
-Wno-psabi
|
||||
)
|
||||
set(WARNING_FLAGS -Wall -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")
|
||||
add_compile_options(/permissive- /d2SSAOptimizer-)
|
||||
# To avoid nameclashes with min and max macro
|
||||
add_compile_definitions(NOMINMAX)
|
||||
add_compile_options(/permissive- /d2SSAOptimizer-)
|
||||
# To avoid nameclashes with min and max macro
|
||||
add_compile_definitions(NOMINMAX)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Executable and Sources
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
# Add executable
|
||||
add_executable(${TARGET_NAME})
|
||||
@ -92,76 +85,83 @@ add_subdirectory(${BSP_PATH})
|
||||
add_subdirectory(${FSFW_PATH})
|
||||
add_subdirectory(${COMMON_PATH})
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# 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.
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_FSFW_NAME}
|
||||
# Link against lwip which is part of the RTEMS BSP
|
||||
${LIB_LWIP_NAME}
|
||||
)
|
||||
target_link_libraries(
|
||||
${TARGET_NAME}
|
||||
PRIVATE ${LIB_FSFW_NAME} etl
|
||||
# Link against lwip which is part of the RTEMS BSP
|
||||
${LIB_LWIP_NAME})
|
||||
|
||||
# Add include paths for all sources.
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${FSFW_CONFIG_PATH}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${FSFW_CONFIG_PATH})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
"-Wl,-Map=${TARGET_NAME}.map"
|
||||
)
|
||||
target_link_options(${TARGET_NAME} PRIVATE "-Wl,-Map=${TARGET_NAME}.map")
|
||||
|
||||
# Remove unused sections.
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
"-ffunction-sections"
|
||||
"-fdata-sections"
|
||||
)
|
||||
# Remove unused sections.
|
||||
target_compile_options(${TARGET_NAME} PRIVATE "-ffunction-sections"
|
||||
"-fdata-sections")
|
||||
|
||||
# Removed unused sections.
|
||||
if(NOT FSFW_OSAL MATCHES rtems)
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
"-Wl,--gc-sections"
|
||||
)
|
||||
endif()
|
||||
# Removed unused sections.
|
||||
if(NOT FSFW_OSAL MATCHES rtems)
|
||||
target_link_options(${TARGET_NAME} PRIVATE "-Wl,--gc-sections")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE)
|
||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||
endif()
|
||||
|
||||
|
||||
# Compile options for all sources.
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
${WARNING_FLAGS}
|
||||
)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE ${WARNING_FLAGS})
|
||||
|
||||
string(CONCAT POST_BUILD_COMMENT
|
||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||
"Target OSAL: ${FSFW_OSAL}\n"
|
||||
"Target RTEMS BSP: ${RTEMS_BSP}\n"
|
||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
|
||||
"${TARGET_STRING}"
|
||||
)
|
||||
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||
"Target OSAL: ${FSFW_OSAL}\n" "Target RTEMS BSP: ${RTEMS_BSP}\n"
|
||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}
|
||||
COMMENT ${POST_BUILD_COMMENT}
|
||||
)
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}
|
||||
COMMENT ${POST_BUILD_COMMENT})
|
||||
|
||||
include("${RTEMS_CONFIG_DIR}/BuildType.cmake")
|
||||
set_build_type()
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Load RTEMS post-project configuration and checks
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
include("${RTEMS_CONFIG_DIR}/RTEMSPostProjectConfig.cmake")
|
||||
rtems_post_project_config(${TARGET_NAME})
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
init.c
|
||||
main.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE init.c main.cpp)
|
||||
|
||||
add_subdirectory(boardconfig)
|
||||
add_subdirectory(fsfwconfig)
|
||||
|
@ -1,4 +1,3 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE)
|
||||
|
||||
add_subdirectory(NUCLEO-H743ZI)
|
||||
|
@ -1,5 +1,4 @@
|
||||
add_subdirectory(Src)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Inc
|
||||
)
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Inc)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_
|
||||
#define BSP_STM32H7_RTEMS_NUCLEO_H743ZI_INC_HARDWARE_INIT_H_
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,30 +1,30 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains definitions for:
|
||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||
* from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains definitions for:
|
||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||
* from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H7XX_NUCLEO_H
|
||||
#define STM32H7XX_NUCLEO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@ -32,48 +32,51 @@
|
||||
#include "stm32h7xx_nucleo_errno.h"
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
#if (USE_COM_LOG > 0)
|
||||
#ifndef __GNUC__
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
#if (USE_COM_LOG > 0)
|
||||
#ifndef __GNUC__
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define for STM32H7XX_NUCLEO board
|
||||
*/
|
||||
#if !defined (USE_STM32H7XX_NUCLEO)
|
||||
#define USE_STM32H7XX_NUCLEO
|
||||
* @brief Define for STM32H7XX_NUCLEO board
|
||||
*/
|
||||
#if !defined(USE_STM32H7XX_NUCLEO)
|
||||
#define USE_STM32H7XX_NUCLEO
|
||||
#endif
|
||||
|
||||
#if !defined (USE_NUCLEO_144)
|
||||
#error "Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
|
||||
#if !defined(USE_NUCLEO_144)
|
||||
#error \
|
||||
"Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
|
||||
#endif
|
||||
|
||||
#if !defined (USE_NUCLEO_H745ZI_Q) && !defined (USE_NUCLEO_H743ZI) && !defined (USE_NUCLEO_H743ZI2) &&\
|
||||
!defined (USE_NUCLEO_H7A3ZI_Q) && !defined (USE_NUCLEO_H723ZG)
|
||||
#error "Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\
|
||||
#if !defined(USE_NUCLEO_H745ZI_Q) && !defined(USE_NUCLEO_H743ZI) && \
|
||||
!defined(USE_NUCLEO_H743ZI2) && !defined(USE_NUCLEO_H7A3ZI_Q) && \
|
||||
!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"
|
||||
#endif
|
||||
|
||||
/** @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)
|
||||
typedef enum
|
||||
{
|
||||
* @{
|
||||
*/
|
||||
#if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
|
||||
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
|
||||
typedef enum {
|
||||
LED1 = 0,
|
||||
LED_GREEN = LED1,
|
||||
LED2 = 1,
|
||||
@ -81,10 +84,9 @@ typedef enum
|
||||
LED3 = 2,
|
||||
LED_RED = LED3,
|
||||
LEDn
|
||||
}Led_TypeDef;
|
||||
} Led_TypeDef;
|
||||
#else /* USE_NUCLEO_H743ZI */
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
LED1 = 0,
|
||||
LED_GREEN = LED1,
|
||||
LED2 = 1,
|
||||
@ -92,242 +94,231 @@ typedef enum
|
||||
LED3 = 2,
|
||||
LED_RED = LED3,
|
||||
LEDn
|
||||
}Led_TypeDef;
|
||||
} Led_TypeDef;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_USER = 0U,
|
||||
BUTTONn
|
||||
}Button_TypeDef;
|
||||
typedef enum { BUTTON_USER = 0U, BUTTONn } Button_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
}ButtonMode_TypeDef;
|
||||
typedef enum { BUTTON_MODE_GPIO = 0, BUTTON_MODE_EXTI = 1 } ButtonMode_TypeDef;
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0U,
|
||||
COMn
|
||||
}COM_TypeDef;
|
||||
typedef enum { COM1 = 0U, COMn } COM_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_STOPBITS_1 = UART_STOPBITS_1,
|
||||
COM_STOPBITS_2 = UART_STOPBITS_2,
|
||||
}COM_StopBitsTypeDef;
|
||||
typedef enum {
|
||||
COM_STOPBITS_1 = UART_STOPBITS_1,
|
||||
COM_STOPBITS_2 = UART_STOPBITS_2,
|
||||
} COM_StopBitsTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_PARITY_NONE = UART_PARITY_NONE,
|
||||
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
||||
COM_PARITY_ODD = UART_PARITY_ODD,
|
||||
}COM_ParityTypeDef;
|
||||
typedef enum {
|
||||
COM_PARITY_NONE = UART_PARITY_NONE,
|
||||
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
||||
COM_PARITY_ODD = UART_PARITY_ODD,
|
||||
} COM_ParityTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
||||
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
||||
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
||||
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
||||
}COM_HwFlowCtlTypeDef;
|
||||
typedef enum {
|
||||
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
||||
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
||||
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
||||
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
||||
} COM_HwFlowCtlTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
|
||||
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
||||
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
||||
}COM_WordLengthTypeDef;
|
||||
} COM_WordLengthTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t BaudRate;
|
||||
COM_WordLengthTypeDef WordLength;
|
||||
COM_StopBitsTypeDef StopBits;
|
||||
COM_ParityTypeDef Parity;
|
||||
COM_HwFlowCtlTypeDef HwFlowCtl;
|
||||
}COM_InitTypeDef;
|
||||
typedef struct {
|
||||
uint32_t BaudRate;
|
||||
COM_WordLengthTypeDef WordLength;
|
||||
COM_StopBitsTypeDef StopBits;
|
||||
COM_ParityTypeDef Parity;
|
||||
COM_HwFlowCtlTypeDef HwFlowCtl;
|
||||
} COM_InitTypeDef;
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
typedef struct
|
||||
{
|
||||
void (* pMspInitCb)(UART_HandleTypeDef *);
|
||||
void (* pMspDeInitCb)(UART_HandleTypeDef *);
|
||||
}BSP_COM_Cb_t;
|
||||
typedef struct {
|
||||
void (*pMspInitCb)(UART_HandleTypeDef *);
|
||||
void (*pMspDeInitCb)(UART_HandleTypeDef *);
|
||||
} BSP_COM_Cb_t;
|
||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
|
||||
|
||||
#define MX_UART_InitTypeDef COM_InitTypeDef
|
||||
#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
|
||||
*/
|
||||
#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_SUB2 (0x00U) /*!< [15:8] sub2 version */
|
||||
#define STM32H7XX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
||||
#define STM32H7XX_NUCLEO_BSP_VERSION ((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24)\
|
||||
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16)\
|
||||
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8 )\
|
||||
|(STM32H7XX_NUCLEO_BSP_VERSION_RC))
|
||||
* @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_SUB1 (0x03U) /*!< [23:16] sub1 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 \
|
||||
((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
|
||||
* @{
|
||||
*/
|
||||
#define LEDn 3U
|
||||
* @{
|
||||
*/
|
||||
#define LEDn 3U
|
||||
|
||||
#define LED1_PIN GPIO_PIN_0
|
||||
#define LED1_GPIO_PORT GPIOB
|
||||
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define LED1_PIN GPIO_PIN_0
|
||||
#define LED1_GPIO_PORT GPIOB
|
||||
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#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)
|
||||
#define LED2_PIN GPIO_PIN_1
|
||||
#define LED2_GPIO_PORT GPIOE
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
||||
#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_GPIO_PORT GPIOE
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
||||
#else /* USE_NUCLEO_H743ZI */
|
||||
#define LED2_PIN GPIO_PIN_7
|
||||
#define LED2_GPIO_PORT GPIOB
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define LED2_PIN GPIO_PIN_7
|
||||
#define LED2_GPIO_PORT GPIOB
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#endif
|
||||
|
||||
#define LED3_PIN GPIO_PIN_14
|
||||
#define LED3_GPIO_PORT GPIOB
|
||||
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define LED3_PIN GPIO_PIN_14
|
||||
#define LED3_GPIO_PORT GPIOB
|
||||
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
/* Button state */
|
||||
#define BUTTON_RELEASED 0U
|
||||
#define BUTTON_PRESSED 1U
|
||||
#define BUTTONn 1U
|
||||
#define BUTTON_RELEASED 0U
|
||||
#define BUTTON_PRESSED 1U
|
||||
#define BUTTONn 1U
|
||||
|
||||
/**
|
||||
* @brief Key push-button
|
||||
*/
|
||||
#define BUTTON_USER_PIN GPIO_PIN_13
|
||||
#define BUTTON_USER_GPIO_PORT GPIOC
|
||||
#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_EXTI_IRQn EXTI15_10_IRQn
|
||||
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13
|
||||
#define BUTTON_USER_PIN GPIO_PIN_13
|
||||
#define BUTTON_USER_GPIO_PORT GPIOC
|
||||
#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_EXTI_IRQn EXTI15_10_IRQn
|
||||
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Definition for COM port1, connected to USART3
|
||||
*/
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
|
||||
#define COMn 1U
|
||||
#define COM1_UART USART3
|
||||
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
||||
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
|
||||
#define COMn 1U
|
||||
#define COM1_UART USART3
|
||||
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
||||
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
|
||||
|
||||
#define COM1_TX_PIN GPIO_PIN_8
|
||||
#define COM1_TX_GPIO_PORT GPIOD
|
||||
#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_AF GPIO_AF7_USART3
|
||||
#define COM1_TX_PIN GPIO_PIN_8
|
||||
#define COM1_TX_GPIO_PORT GPIOD
|
||||
#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_AF GPIO_AF7_USART3
|
||||
|
||||
#define COM1_RX_PIN GPIO_PIN_9
|
||||
#define COM1_RX_GPIO_PORT GPIOD
|
||||
#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_AF GPIO_AF7_USART3
|
||||
#define COM_POLL_TIMEOUT 1000
|
||||
#define COM1_RX_PIN GPIO_PIN_9
|
||||
#define COM1_RX_GPIO_PORT GPIOD
|
||||
#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_AF GPIO_AF7_USART3
|
||||
#define COM_POLL_TIMEOUT 1000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
extern EXTI_HandleTypeDef hpb_exti[];
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
extern UART_HandleTypeDef hcom_uart[];
|
||||
extern USART_TypeDef* COM_USART[];
|
||||
extern USART_TypeDef *COM_USART[];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @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_LED_DeInit(Led_TypeDef Led);
|
||||
int32_t BSP_LED_On(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
||||
int32_t BSP_LED_GetState (Led_TypeDef Led);
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button);
|
||||
void BSP_PB_Callback(Button_TypeDef Button);
|
||||
/** @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_LED_DeInit(Led_TypeDef Led);
|
||||
int32_t BSP_LED_On(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
||||
int32_t BSP_LED_GetState(Led_TypeDef Led);
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button);
|
||||
void BSP_PB_Callback(Button_TypeDef Button);
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
||||
#if (USE_COM_LOG > 0)
|
||||
int32_t BSP_COM_SelectLogPort (COM_TypeDef COM);
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM);
|
||||
#endif
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
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 */
|
||||
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 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,77 +1,77 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief STM32H7xx_Nuleo board configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief STM32H7xx_Nuleo board configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H7XX_NUCLEO_CONF_H
|
||||
#define STM32H7XX_NUCLEO_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h7xx_hal.h"
|
||||
#include "stm32h743xx.h"
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7XX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO_CONFIG Config
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32H7XX_NUCLEO_CONFIG_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
/* Nucleo pin and part number defines */
|
||||
#define USE_NUCLEO_144
|
||||
#define USE_NUCLEO_H743ZI
|
||||
|
||||
/* COM define */
|
||||
#define USE_COM_LOG 0U
|
||||
#define USE_BSP_COM_FEATURE 1U
|
||||
#define USE_COM_LOG 0U
|
||||
#define USE_BSP_COM_FEATURE 1U
|
||||
|
||||
/* 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
|
||||
}
|
||||
|
@ -1,48 +1,48 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo_errno.h
|
||||
* @author MCD Application Team
|
||||
* @brief Error Code.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo_errno.h
|
||||
* @author MCD Application Team
|
||||
* @brief Error Code.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H7XX_NUCLEO_ERRNO_H
|
||||
#define STM32H7XX_NUCLEO_ERRNO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Common Error codes */
|
||||
#define BSP_ERROR_NONE 0
|
||||
#define BSP_ERROR_NO_INIT -1
|
||||
#define BSP_ERROR_WRONG_PARAM -2
|
||||
#define BSP_ERROR_BUSY -3
|
||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||
#define BSP_ERROR_BUS_FAILURE -8
|
||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||
#define BSP_ERROR_MSP_FAILURE -10
|
||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||
#define BSP_ERROR_NONE 0
|
||||
#define BSP_ERROR_NO_INIT -1
|
||||
#define BSP_ERROR_WRONG_PARAM -2
|
||||
#define BSP_ERROR_BUSY -3
|
||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||
#define BSP_ERROR_BUS_FAILURE -8
|
||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||
#define BSP_ERROR_MSP_FAILURE -10
|
||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* STM32H7XX_NUCLEO_ERRNO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
@ -1,4 +1 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
hardware_init.cpp
|
||||
stm32h7xx_nucleo.c
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE hardware_init.cpp stm32h7xx_nucleo.c)
|
||||
|
@ -1,11 +1,9 @@
|
||||
#include "hardware_init.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_ethernet.h>
|
||||
#include <rtems_lwip/ethernetif.h>
|
||||
#include <rtems_lwip/rtems_lwip.h>
|
||||
|
||||
void hardware_init() {
|
||||
rtems_lwip_init(NULL, ðernet_link_status_updated);
|
||||
}
|
||||
void hardware_init() { rtems_lwip_init(NULL, ðernet_link_status_updated); }
|
||||
|
@ -1,160 +1,149 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides set of firmware functions to manage:
|
||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||
* from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
******************************************************************************
|
||||
* @file stm32h7xx_nucleo.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides set of firmware functions to manage:
|
||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||
* from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h7xx_nucleo.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7XX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL
|
||||
* @brief This file provides set of firmware functions to manage Leds and push-button
|
||||
* available on STM32H7xx-Nucleo Kit from STMicroelectronics.
|
||||
* @{
|
||||
*/
|
||||
* @brief This file provides set of firmware functions to manage Leds and
|
||||
* 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
|
||||
* @{
|
||||
*/
|
||||
typedef void (* BSP_EXTI_LineCallback) (void);
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL
|
||||
* Private Typedef
|
||||
* @{
|
||||
*/
|
||||
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];
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
UART_HandleTypeDef hcom_uart[COMn];
|
||||
USART_TypeDef* COM_USART[COMn] = {COM1_UART};
|
||||
USART_TypeDef *COM_USART[COMn] = {COM1_UART};
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables
|
||||
* @{
|
||||
*/
|
||||
static GPIO_TypeDef* LED_PORT[LEDn] = {LED1_GPIO_PORT,
|
||||
LED2_GPIO_PORT,
|
||||
* @}
|
||||
*/
|
||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private
|
||||
* Variables
|
||||
* @{
|
||||
*/
|
||||
static GPIO_TypeDef *LED_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT,
|
||||
LED3_GPIO_PORT};
|
||||
|
||||
static const uint16_t LED_PIN[LEDn] = {LED1_PIN,
|
||||
LED2_PIN,
|
||||
LED3_PIN};
|
||||
static const uint16_t LED_PIN[LEDn] = {LED1_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 IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn};
|
||||
|
||||
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
#if (USE_COM_LOG > 0)
|
||||
static COM_TypeDef COM_ActiveLogPort = COM1;
|
||||
#endif
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
static uint32_t IsComMspCbValid[COMn] = {0};
|
||||
#endif
|
||||
#if (USE_COM_LOG > 0)
|
||||
static COM_TypeDef COM_ActiveLogPort = COM1;
|
||||
#endif
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
static uint32_t IsComMspCbValid[COMn] = {0};
|
||||
#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);
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
static void COM1_MspInit(UART_HandleTypeDef *huart);
|
||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart);
|
||||
#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
|
||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||
*/
|
||||
int32_t BSP_GetVersion(void)
|
||||
{
|
||||
return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION;
|
||||
}
|
||||
* @brief This method returns the STM32H7XX NUCLEO BSP Driver revision
|
||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||
*/
|
||||
int32_t BSP_GetVersion(void) { return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION; }
|
||||
|
||||
/**
|
||||
* @brief Configures LED GPIO.
|
||||
* @param Led Specifies the Led to be configured.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Init(Led_TypeDef Led)
|
||||
{
|
||||
* @brief Configures LED GPIO.
|
||||
* @param Led Specifies the Led to be configured.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Init(Led_TypeDef Led) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* Enable the GPIO LED Clock */
|
||||
if(Led == LED1)
|
||||
{
|
||||
if (Led == LED1) {
|
||||
LED1_GPIO_CLK_ENABLE();
|
||||
}
|
||||
else if(Led == LED2)
|
||||
{
|
||||
} else if (Led == LED2) {
|
||||
LED2_GPIO_CLK_ENABLE();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LED3_GPIO_CLK_ENABLE();
|
||||
}
|
||||
/* Configure the GPIO_LED pin */
|
||||
gpio_init_structure.Pin = LED_PIN[Led];
|
||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Pin = LED_PIN[Led];
|
||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
||||
HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure);
|
||||
@ -165,26 +154,22 @@ int32_t BSP_LED_Init(Led_TypeDef Led)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit LEDs.
|
||||
* @param Led LED to be de-init.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_DeInit(Led_TypeDef Led)
|
||||
{
|
||||
* @brief DeInit LEDs.
|
||||
* @param Led LED to be de-init.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_DeInit(Led_TypeDef Led) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* Turn off LED */
|
||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||
/* DeInit the GPIO_LED pin */
|
||||
@ -196,24 +181,20 @@ int32_t BSP_LED_DeInit(Led_TypeDef Led)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns selected LED On.
|
||||
* @param Led Specifies the Led to be set on.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_On(Led_TypeDef Led)
|
||||
{
|
||||
* @brief Turns selected LED On.
|
||||
* @param Led Specifies the Led to be set on.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_On(Led_TypeDef Led) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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.
|
||||
* @param Led: Specifies the Led to be set off.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led)
|
||||
{
|
||||
* @brief Turns selected LED Off.
|
||||
* @param Led: Specifies the Led to be set off.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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.
|
||||
* @param Led Specifies the Led to be toggled.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led)
|
||||
{
|
||||
* @brief Toggles the selected LED.
|
||||
* @param Led Specifies the Led to be toggled.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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.
|
||||
* @param Led LED to get its state
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval LED status
|
||||
*/
|
||||
int32_t BSP_LED_GetState (Led_TypeDef Led)
|
||||
{
|
||||
* @brief Get the state of the selected LED.
|
||||
* @param Led LED to get its state
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval LED status
|
||||
*/
|
||||
int32_t BSP_LED_GetState(Led_TypeDef Led) {
|
||||
int32_t ret;
|
||||
|
||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
||||
{
|
||||
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = (int32_t)HAL_GPIO_ReadPin (LED_PORT [Led], LED_PIN [Led]);
|
||||
} else {
|
||||
ret = (int32_t)HAL_GPIO_ReadPin(LED_PORT[Led], LED_PIN[Led]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures button GPIO and EXTI Line.
|
||||
* @param Button Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @param ButtonMode Button mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
||||
* with interrupt generation capability
|
||||
*/
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
||||
{
|
||||
* @brief Configures button GPIO and EXTI Line.
|
||||
* @param Button Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @param ButtonMode Button mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
||||
* with interrupt generation capability
|
||||
*/
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode) {
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {BUTTON_USER_EXTI_Callback};
|
||||
static uint32_t BSP_BUTTON_PRIO [BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY};
|
||||
static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {
|
||||
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};
|
||||
|
||||
/* Enable the BUTTON clock */
|
||||
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.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
if(ButtonMode == BUTTON_MODE_GPIO)
|
||||
{
|
||||
if (ButtonMode == BUTTON_MODE_GPIO) {
|
||||
/* Configure Button pin as input */
|
||||
gpio_init_structure.Mode = GPIO_MODE_INPUT;
|
||||
HAL_GPIO_Init(BUTTON_PORT [Button], &gpio_init_structure);
|
||||
}
|
||||
else /* (ButtonMode == BUTTON_MODE_EXTI) */
|
||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||
} else /* (ButtonMode == BUTTON_MODE_EXTI) */
|
||||
{
|
||||
/* Configure Button pin as input with External interrupt */
|
||||
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);
|
||||
|
||||
(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 */
|
||||
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.
|
||||
* @param Button Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @note PB DeInit does not disable the GPIO clock
|
||||
*/
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button)
|
||||
{
|
||||
* @brief Push Button DeInit.
|
||||
* @param Button Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @note PB DeInit does not disable the GPIO clock
|
||||
*/
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button) {
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
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.
|
||||
* @param Button Button to be checked
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
||||
*/
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button)
|
||||
{
|
||||
* @brief Returns the selected button state.
|
||||
* @param Button Button to be checked
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
||||
*/
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button) {
|
||||
return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BSP Button IRQ handler
|
||||
* @param Button Can only be BUTTON_USER
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button)
|
||||
{
|
||||
* @brief BSP Button IRQ handler
|
||||
* @param Button Can only be BUTTON_USER
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button) {
|
||||
HAL_EXTI_IRQHandler(&hpb_exti[Button]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BSP Push Button callback
|
||||
* @param Button Specifies the pin connected EXTI line
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_PB_Callback(Button_TypeDef Button)
|
||||
{
|
||||
* @brief BSP Push Button callback
|
||||
* @param Button Specifies the pin connected EXTI line
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_PB_Callback(Button_TypeDef Button) {
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(Button);
|
||||
|
||||
@ -400,38 +364,32 @@ __weak void BSP_PB_Callback(Button_TypeDef Button)
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval BSP error code
|
||||
*/
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
|
||||
{
|
||||
* @brief Configures COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART
|
||||
* peripheral.
|
||||
* @retval BSP error code
|
||||
*/
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
if (COM >= COMn) {
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
|
||||
/* Init the UART Msp */
|
||||
COM1_MspInit(&hcom_uart[COM]);
|
||||
#else
|
||||
if(IsComMspCbValid[COM] == 0U)
|
||||
{
|
||||
if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE)
|
||||
{
|
||||
if (IsComMspCbValid[COM] == 0U) {
|
||||
if (BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE) {
|
||||
return BSP_ERROR_MSP_FAILURE;
|
||||
}
|
||||
}
|
||||
#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;
|
||||
}
|
||||
}
|
||||
@ -440,21 +398,17 @@ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
||||
{
|
||||
* @brief DeInit COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
if (COM >= COMn) {
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* USART configuration */
|
||||
hcom_uart[COM].Instance = COM_USART[COM];
|
||||
|
||||
@ -462,8 +416,7 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
||||
COM1_MspDeInit(&hcom_uart[COM]);
|
||||
#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;
|
||||
}
|
||||
}
|
||||
@ -472,57 +425,52 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param huart USART handle
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval HAL error code
|
||||
*/
|
||||
__weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init)
|
||||
{
|
||||
* @brief Configures COM port.
|
||||
* @param huart USART handle
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART
|
||||
* peripheral.
|
||||
* @retval HAL error code
|
||||
*/
|
||||
__weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
|
||||
MX_UART_InitTypeDef *COM_Init) {
|
||||
/* USART configuration */
|
||||
huart->Instance = COM_USART[COM1];
|
||||
huart->Init.BaudRate = COM_Init->BaudRate;
|
||||
huart->Init.Mode = UART_MODE_TX_RX;
|
||||
huart->Init.Parity = (uint32_t)COM_Init->Parity;
|
||||
huart->Init.WordLength = (uint32_t)COM_Init->WordLength;
|
||||
huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
|
||||
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
|
||||
huart->Init.OverSampling = UART_OVERSAMPLING_8;
|
||||
huart->Instance = COM_USART[COM1];
|
||||
huart->Init.BaudRate = COM_Init->BaudRate;
|
||||
huart->Init.Mode = UART_MODE_TX_RX;
|
||||
huart->Init.Parity = (uint32_t)COM_Init->Parity;
|
||||
huart->Init.WordLength = (uint32_t)COM_Init->WordLength;
|
||||
huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
|
||||
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
|
||||
huart->Init.OverSampling = UART_OVERSAMPLING_8;
|
||||
|
||||
return HAL_UART_Init(huart);
|
||||
return HAL_UART_Init(huart);
|
||||
}
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
/**
|
||||
* @brief Register Default COM Msp Callbacks
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
||||
{
|
||||
* @brief Register Default COM Msp Callbacks
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
if (COM >= COMn) {
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, COM1_MspDeInit) != HAL_OK)
|
||||
{
|
||||
} else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
|
||||
HAL_UART_MSPDEINIT_CB_ID,
|
||||
COM1_MspDeInit) != HAL_OK) {
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
IsComMspCbValid[COM] = 1U;
|
||||
}
|
||||
}
|
||||
@ -532,35 +480,29 @@ int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register COM Msp Callback registering
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
|
||||
{
|
||||
* @brief Register COM Msp Callback registering
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
if (COM >= COMn) {
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
|
||||
{
|
||||
} else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
|
||||
HAL_UART_MSPDEINIT_CB_ID,
|
||||
Callback->pMspDeInitCb) != HAL_OK) {
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
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)
|
||||
/**
|
||||
* @brief Select the active COM port.
|
||||
* @param COM COM port to be activated.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
|
||||
{
|
||||
if(COM_ActiveLogPort != COM)
|
||||
{
|
||||
* @brief Select the active COM port.
|
||||
* @param COM COM port to be activated.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM) {
|
||||
if (COM_ActiveLogPort != COM) {
|
||||
COM_ActiveLogPort = COM;
|
||||
}
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Redirect console output to COM
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
int __io_putchar (int ch)
|
||||
#else
|
||||
int fputc (int ch, FILE *f)
|
||||
#endif /* __GNUC__ */
|
||||
* @brief Redirect console output to COM
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
int __io_putchar(int ch)
|
||||
#else
|
||||
int fputc(int ch, FILE *f)
|
||||
#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;
|
||||
}
|
||||
#endif /* USE_COM_LOG */
|
||||
#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.
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void BUTTON_USER_EXTI_Callback(void)
|
||||
{
|
||||
BSP_PB_Callback(BUTTON_USER);
|
||||
}
|
||||
* @brief Key EXTI line detection callbacks.
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void BUTTON_USER_EXTI_Callback(void) { BSP_PB_Callback(BUTTON_USER); }
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/**
|
||||
* @brief Initializes UART MSP.
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
* @brief Initializes UART MSP.
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspInit(UART_HandleTypeDef *huart) {
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
@ -652,22 +590,21 @@ static void COM1_MspInit(UART_HandleTypeDef *huart)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize USART3 Msp part
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
* @brief Initialize USART3 Msp part
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart) {
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(huart);
|
||||
|
||||
/* 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);
|
||||
|
||||
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);
|
||||
|
||||
/* Disable USART clock */
|
||||
@ -675,19 +612,19 @@ static void COM1_MspDeInit(UART_HandleTypeDef *huart)
|
||||
}
|
||||
#endif /* USE_BSP_COM_FEATURE */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
@ -1,2 +1 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE)
|
||||
|
@ -1,6 +1,2 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
InitMission.cpp
|
||||
ObjectFactory.cpp
|
||||
printChar.c
|
||||
)
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE InitMission.cpp ObjectFactory.cpp
|
||||
printChar.c)
|
||||
|
@ -1,196 +1,204 @@
|
||||
#include "InitMission.h"
|
||||
|
||||
#include "example/utility/TaskCreation.h"
|
||||
#include <OBSWConfig.h>
|
||||
#include <mission/utility/TaskCreation.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
#include <pollingsequence/pollingSequenceFactory.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
#include <pollingsequence/pollingSequenceFactory.h>
|
||||
|
||||
#include <rtems/rtems/support.h>
|
||||
#include <rtems/score/heapinfo.h>
|
||||
|
||||
|
||||
void InitMission::createTasks() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* distributerTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"DIST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::TM_FUNNEL);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||
}
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF *distributerTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"DIST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::TM_FUNNEL);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* eventManagerTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
|
||||
result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||
}
|
||||
PeriodicTaskIF *eventManagerTask =
|
||||
TaskFactory::instance()->createPeriodicTask(
|
||||
"EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
|
||||
result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP bridge", objects::UDP_BRIDGE);
|
||||
}
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF *udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP bridge", objects::UDP_BRIDGE);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* udpPollingTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"UDP_POLLING", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.1, nullptr);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
|
||||
}
|
||||
PeriodicTaskIF *udpPollingTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"UDP_POLLING", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.1, nullptr);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
|
||||
}
|
||||
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
#if OBSW_ADD_PUS_STACK == 1
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* pusVerification = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_VERIF_1", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
|
||||
}
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF *pusVerification = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_VERIF_1", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusHighPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
PeriodicTaskIF *pusHighPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusMedPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
PeriodicTaskIF *pusMedPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
PeriodicTaskIF *pusLowPrio = TaskFactory::instance()->createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||
|
||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||
FixedTimeslotTaskIF* timeslotDemoTask = TaskFactory::instance()->createFixedTimeslotTask(
|
||||
"PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr);
|
||||
result = pst::pollingSequenceExamples(timeslotDemoTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
FixedTimeslotTaskIF *timeslotDemoTask =
|
||||
TaskFactory::instance()->createFixedTimeslotTask(
|
||||
"PST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr);
|
||||
result = pst::pollingSequenceExamples(timeslotDemoTask);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#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
|
||||
sif::printError("InitMission::createTasks: Examples PST initialization failed!\n");
|
||||
sif::printError(
|
||||
"InitMission::createTasks: Examples PST initialization failed!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
PeriodicTaskIF* readerTask = TaskFactory::instance()->
|
||||
createPeriodicTask("READER_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = readerTask->addComponent(objects::TEST_DUMMY_4);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Demo Reader Task", objects::TEST_DUMMY_4);
|
||||
}
|
||||
PeriodicTaskIF *readerTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"READER_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = readerTask->addComponent(objects::TEST_DUMMY_4);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Demo Reader Task", objects::TEST_DUMMY_4);
|
||||
}
|
||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->createFixedTimeslotTask(
|
||||
"PST_TEST_TASK", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = pst::pollingSequenceDevices(testTimeslotTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
FixedTimeslotTaskIF *testTimeslotTask =
|
||||
TaskFactory::instance()->createFixedTimeslotTask(
|
||||
"PST_TEST_TASK", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0,
|
||||
nullptr);
|
||||
result = pst::pollingSequenceDevices(testTimeslotTask);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#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
|
||||
sif::printError("InitMission::createTasks: Devices PST initialization failed!\n");
|
||||
sif::printError(
|
||||
"InitMission::createTasks: Devices PST initialization failed!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||
|
||||
PeriodicTaskIF* testTask = TaskFactory::instance()->
|
||||
createPeriodicTask("TEST", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Test Task", objects::TEST_TASK);
|
||||
}
|
||||
PeriodicTaskIF *testTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"TEST", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Test Task", objects::TEST_TASK);
|
||||
}
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Starting tasks..\n");
|
||||
sif::printInfo("Starting tasks..\n");
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
distributerTask->startTask();
|
||||
eventManagerTask->startTask();
|
||||
distributerTask->startTask();
|
||||
eventManagerTask->startTask();
|
||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
#if OBSW_ADD_PUS_STACK == 1
|
||||
pusVerification->startTask();
|
||||
pusHighPrio->startTask();
|
||||
pusMedPrio->startTask();
|
||||
pusLowPrio->startTask();
|
||||
pusVerification->startTask();
|
||||
pusHighPrio->startTask();
|
||||
pusMedPrio->startTask();
|
||||
pusLowPrio->startTask();
|
||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||
|
||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||
timeslotDemoTask->startTask();
|
||||
readerTask->startTask();
|
||||
timeslotDemoTask->startTask();
|
||||
readerTask->startTask();
|
||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||
testTimeslotTask->startTask();
|
||||
testTimeslotTask->startTask();
|
||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||
|
||||
testTask->startTask();
|
||||
testTask->startTask();
|
||||
|
||||
Heap_Information_block block;
|
||||
rtems_workspace_get_information(&block);
|
||||
uint32_t failedAllocs = block.Stats.failed_allocs;
|
||||
Heap_Information_block block;
|
||||
rtems_workspace_get_information(&block);
|
||||
uint32_t failedAllocs = block.Stats.failed_allocs;
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
sif::info << "Remaining RTEMS heap: " << block.Stats.free_size << " bytes" << std::endl;
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
sif::info << "Remaining RTEMS heap: " << block.Stats.free_size << " bytes"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printInfo("Tasks started..\n");
|
||||
sif::printInfo("Allocated RTEMS heap: %lu bytes\n", static_cast<unsigned long>(
|
||||
block.Stats.size));
|
||||
sif::printInfo("Remaining RTEMS heap: %lu bytes\n", static_cast<unsigned long>(
|
||||
block.Stats.free_size));
|
||||
if(failedAllocs > 0) {
|
||||
sif::printWarning("%d allocations from RTEMS workspace failed!\n", failedAllocs);
|
||||
}
|
||||
sif::printInfo("Tasks started..\n");
|
||||
sif::printInfo("Allocated RTEMS heap: %lu bytes\n",
|
||||
static_cast<unsigned long>(block.Stats.size));
|
||||
sif::printInfo("Remaining RTEMS heap: %lu bytes\n",
|
||||
static_cast<unsigned long>(block.Stats.free_size));
|
||||
if (failedAllocs > 0) {
|
||||
sif::printWarning("%d allocations from RTEMS workspace failed!\n",
|
||||
failedAllocs);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <OBSWConfig.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
|
||||
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
|
||||
#include "example/core/GenericFactory.h"
|
||||
#include "example/test/FsfwTestTask.h"
|
||||
#include "example/utility/TmFunnel.h"
|
||||
#include "example_common/stm32h7/STM32TestTask.h"
|
||||
#include <test/TestTask.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
#include <mission/core/GenericFactory.h>
|
||||
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
|
||||
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
|
||||
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/monitoring/MonitoringMessageContent.h>
|
||||
@ -18,43 +18,40 @@
|
||||
|
||||
#include <rtems_lwip/rtems_lwip.h>
|
||||
|
||||
void ObjectFactory::produce(void* args) {
|
||||
/* Located inside GenericFactory source file */
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
void ObjectFactory::produce(void *args) {
|
||||
/* Located inside GenericFactory source file */
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}
|
||||
};
|
||||
new PoolManager(objects::TC_STORE, poolCfg);
|
||||
}
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}};
|
||||
new PoolManager(objects::TC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}
|
||||
};
|
||||
new PoolManager(objects::TM_STORE, poolCfg);
|
||||
}
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}};
|
||||
new PoolManager(objects::TM_STORE, poolCfg);
|
||||
}
|
||||
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}
|
||||
};
|
||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{15, 32}, {10, 64}, {5, 128}, {1, 1024}};
|
||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||
/* UDP Server */
|
||||
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE,
|
||||
objects::CCSDS_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE);
|
||||
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE,
|
||||
rtems_lwip_get_netif(0));
|
||||
/* UDP Server */
|
||||
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
|
||||
objects::TM_STORE, objects::TC_STORE);
|
||||
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE,
|
||||
rtems_lwip_get_netif(0));
|
||||
#endif /* OBSW_ADD_LWIP_NETWORKING == 1 */
|
||||
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
ObjectFactory::produceGenericObjects();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
new STM32TestTask(objects::TEST_TASK, false);
|
||||
new STM32TestTask(objects::TEST_TASK, false);
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#ifndef MISSION_CORE_OBJECTFACTORY_H_
|
||||
#define MISSION_CORE_OBJECTFACTORY_H_
|
||||
|
||||
|
||||
namespace ObjectFactory {
|
||||
void produce(void* args);
|
||||
void produce(void *args);
|
||||
};
|
||||
|
||||
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include <OBSWConfig.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <OBSWConfig.h>
|
||||
#include <stm32h7xx_hal_uart.h>
|
||||
|
||||
#include <hal.h>
|
||||
|
||||
void printChar(const char* character, bool errStream) {
|
||||
HAL_UART_Transmit(&stm32h7_usart3_instance.uart, (uint8_t*) character, 1,
|
||||
DEBUG_UART_MS_TIMEOUT);
|
||||
/* Does not work for some reason */
|
||||
//stm32h7_uart_polled_write(&stm32h7_usart3_instance.device, (int) character);
|
||||
void printChar(const char *character, bool errStream) {
|
||||
HAL_UART_Transmit(&stm32h7_usart3_instance.uart, (uint8_t *)character, 1,
|
||||
DEBUG_UART_MS_TIMEOUT);
|
||||
/* Does not work for some reason */
|
||||
// stm32h7_uart_polled_write(&stm32h7_usart3_instance.device, (int)
|
||||
// character);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
ipc/missionMessageTypes.cpp
|
||||
pollingsequence/pollingSequenceFactory.cpp
|
||||
)
|
||||
target_sources(
|
||||
${TARGET_NAME} PRIVATE ipc/missionMessageTypes.cpp
|
||||
pollingsequence/pollingSequenceFactory.cpp)
|
||||
|
||||
# Add include paths for the executable
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -4,11 +4,8 @@
|
||||
#include <cstdint>
|
||||
|
||||
namespace devaddress {
|
||||
enum devaddress: uint32_t {
|
||||
L3GD20H = 1
|
||||
};
|
||||
enum devaddress : uint32_t { L3GD20H = 1 };
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include "commonSubsystemIds.h"
|
||||
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum subsystemId: uint8_t {
|
||||
};
|
||||
enum subsystemId : uint8_t {};
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */
|
||||
|
@ -2,10 +2,10 @@
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||
|
||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||
switch((message->getMessageType())) {
|
||||
default:
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
break;
|
||||
}
|
||||
void messagetypes::clearMissionMessage(CommandMessage *message) {
|
||||
switch ((message->getMessageType())) {
|
||||
default:
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,14 @@ class CommandMessage;
|
||||
|
||||
namespace messagetypes {
|
||||
/* 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 {
|
||||
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_ */
|
||||
|
@ -1,19 +1,19 @@
|
||||
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
|
||||
#include <commonSystemObjects.h>
|
||||
#include "commonObjects.h"
|
||||
|
||||
namespace objects {
|
||||
enum mission_objects {
|
||||
/* 0x62 ('b') Board and mission specific objects */
|
||||
UDP_BRIDGE = 0x62000300,
|
||||
UDP_POLLING_TASK = 0x62000400,
|
||||
/* 0x62 ('b') Board and mission specific objects */
|
||||
UDP_BRIDGE = 0x62000300,
|
||||
UDP_POLLING_TASK = 0x62000400,
|
||||
|
||||
SPI_COM_IF = 0x63001000,
|
||||
SPI_DEVICE_TEST = 0x74001000,
|
||||
SPI_COM_IF = 0x63001000,
|
||||
SPI_DEVICE_TEST = 0x74001000,
|
||||
|
||||
/* Generic name for FSFW static ID setter */
|
||||
DOWNLINK_DESTINATION = UDP_BRIDGE
|
||||
/* Generic name for FSFW static ID setter */
|
||||
DOWNLINK_DESTINATION = UDP_BRIDGE
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,26 +8,30 @@
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
|
||||
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
static_cast<void>(length);
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
static_cast<void>(length);
|
||||
|
||||
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
|
||||
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);
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
|
||||
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
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl;
|
||||
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
|
||||
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class FixedTimeslotTaskIF;
|
||||
namespace pst {
|
||||
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
|
||||
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
|
||||
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence);
|
||||
}
|
||||
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF *thisSequence);
|
||||
} // namespace pst
|
||||
|
||||
#endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */
|
||||
|
@ -4,9 +4,7 @@
|
||||
#include <commonConfig.h>
|
||||
|
||||
namespace CLASS_ID {
|
||||
enum classIds: uint8_t {
|
||||
};
|
||||
enum classIds : uint8_t {};
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef FSFWCONFIG_TMTC_APID_H_
|
||||
#define FSFWCONFIG_TMTC_APID_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <commonConfig.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace apid {
|
||||
static const uint16_t APID = COMMON_APID;
|
||||
|
@ -3,5 +3,4 @@
|
||||
|
||||
#include <commonConfig.h>
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */
|
||||
|
@ -3,12 +3,12 @@
|
||||
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
|
||||
* @return
|
||||
*/
|
||||
rtems_task Init(rtems_task_argument argument) {
|
||||
main();
|
||||
return (void) rtems_task_delete( RTEMS_SELF );
|
||||
main();
|
||||
return (void)rtems_task_delete(RTEMS_SELF);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "core/ObjectFactory.h"
|
||||
#include "core/InitMission.h"
|
||||
#include "stm32h7xx_nucleo.h"
|
||||
#include "core/ObjectFactory.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/serviceinterface/ServiceInterface.h"
|
||||
@ -30,24 +30,24 @@ ServiceInterfaceStream sif::error("ERROR", true);
|
||||
* @author R. Mueller
|
||||
*/
|
||||
int main() {
|
||||
hardware_init();
|
||||
hardware_init();
|
||||
|
||||
printf("\n\r%s-- FSFW Example (RTEMS) --\n", sif::ANSI_COLOR_RESET);
|
||||
printf("-- Compiled for %s --\n", BOARD_NAME);
|
||||
printf("-- Compiled on %s %s --\n\r",__DATE__, __TIME__);
|
||||
printf("\n\r%s-- FSFW Example (RTEMS) --\n", sif::ANSI_COLOR_RESET);
|
||||
printf("-- Compiled for %s --\n", BOARD_NAME);
|
||||
printf("-- Compiled on %s %s --\n\r", __DATE__, __TIME__);
|
||||
|
||||
timeval timeToSet;
|
||||
timeToSet.tv_sec = UNIX_TIMESTAMP;
|
||||
timeToSet.tv_usec = 0;
|
||||
ReturnValue_t clockStatus = Clock::setClock(&timeToSet);
|
||||
if(clockStatus != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::printError("Clock configuration failed!\n");
|
||||
}
|
||||
else {
|
||||
sif::printInfo("Clock configured successfully.\n");
|
||||
}
|
||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||
ObjectManager::instance()->initialize();
|
||||
timeval timeToSet{};
|
||||
timeToSet.tv_sec = UNIX_TIMESTAMP;
|
||||
timeToSet.tv_usec = 0;
|
||||
ReturnValue_t clockStatus = Clock::setClock(&timeToSet);
|
||||
if (clockStatus != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::printError("Clock configuration failed!\n");
|
||||
} else {
|
||||
sif::printInfo("Clock configured successfully.\n");
|
||||
}
|
||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce,
|
||||
nullptr);
|
||||
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
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit c7cf8e710db2fbf99b37f263f064aabdddf379b5
|
||||
Subproject commit 828ede80964f04ab94eda199415f16d0161fdb0e
|
32
scripts/auto-formatter.sh
Executable file
32
scripts/auto-formatter.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user