diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f5409..4b16bd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,7 @@ set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(RTEMS_CMAKE_PATH "${CMAKE_SCRIPT_PATH}/rtems-cmake") set(FSFW_OSAL rtems CACHE STRING "OS for the FSFW") -# Set off, networking code is part of RTEMS BSP -set(STM32_ADD_NETWORKING_CODE OFF) +SET(STM32_ADD_NETWORKING_CODE ON) set(FSFW_HAL_ADD_STM32H7 ON) # Set TGT_BSP to correct target for pre-project configuration @@ -62,6 +61,7 @@ configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) 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 diff --git a/bsp_stm32h7_rtems/RTEMSConfig.h b/bsp_stm32h7_rtems/RTEMSConfig.h.in similarity index 100% rename from bsp_stm32h7_rtems/RTEMSConfig.h rename to bsp_stm32h7_rtems/RTEMSConfig.h.in diff --git a/bsp_stm32h7_rtems/boardconfig/NUCLEO-H743ZI/Src/hardware_init.cpp b/bsp_stm32h7_rtems/boardconfig/NUCLEO-H743ZI/Src/hardware_init.cpp index df30cef..73b2e2a 100644 --- a/bsp_stm32h7_rtems/boardconfig/NUCLEO-H743ZI/Src/hardware_init.cpp +++ b/bsp_stm32h7_rtems/boardconfig/NUCLEO-H743ZI/Src/hardware_init.cpp @@ -1,5 +1,6 @@ #include "hardware_init.h" +#include "fsfw/tasks/PeriodicTaskIF.h" #include #include #include diff --git a/bsp_stm32h7_rtems/core/InitMission.cpp b/bsp_stm32h7_rtems/core/InitMission.cpp index 7e8ccad..6e4ec44 100644 --- a/bsp_stm32h7_rtems/core/InitMission.cpp +++ b/bsp_stm32h7_rtems/core/InitMission.cpp @@ -40,7 +40,7 @@ void InitMission::createTasks() { task::printInitError("TM funnel", objects::TM_FUNNEL); } -#if OBSW_ADD_LWIP_NETWORKING == 1 +#if OBSW_ADD_LWIP_COMPONENTS == 1 /* UDP bridge */ PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask( "UDP_UNIX_BRIDGE", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr); @@ -55,7 +55,7 @@ void InitMission::createTasks() { if(result != HasReturnvaluesIF::RETURN_OK) { task::printInitError("UDP polling task", objects::UDP_POLLING_TASK); } -#endif /* OBSW_ADD_LWIP_NETWORKING == 1 */ +#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #if OBSW_ADD_PUS_STACK == 1 @@ -150,10 +150,10 @@ void InitMission::createTasks() { #if OBSW_ADD_CORE_COMPONENTS == 1 distributerTask->startTask(); eventManagerTask->startTask(); -#if OBSW_ADD_LWIP_NETWORKING == 1 +#if OBSW_ADD_LWIP_COMPONENTS == 1 udpBridgeTask->startTask(); udpPollingTask->startTask(); -#endif /* OBSW_ADD_LWIP_NETWORKING == 1 */ +#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #if OBSW_ADD_PUS_STACK == 1 diff --git a/bsp_stm32h7_rtems/core/ObjectFactory.cpp b/bsp_stm32h7_rtems/core/ObjectFactory.cpp index 88dcc7f..e9d815b 100644 --- a/bsp_stm32h7_rtems/core/ObjectFactory.cpp +++ b/bsp_stm32h7_rtems/core/ObjectFactory.cpp @@ -16,6 +16,8 @@ #include #include +#include + void ObjectFactory::produce(void* args) { /* Located inside GenericFactory source file */ Factory::setStaticFrameworkObjectIds(); @@ -42,12 +44,12 @@ void ObjectFactory::produce(void* args) { new PoolManager(objects::IPC_STORE, poolCfg); } - -#if OBSW_ADD_LWIP_NETWORKING == 1 +#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); + 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 */ diff --git a/example_common b/example_common index afe0a13..d5a342a 160000 --- a/example_common +++ b/example_common @@ -1 +1 @@ -Subproject commit afe0a1356633baf7ba117295fa57c93fb8e0d8a3 +Subproject commit d5a342a50994ad71aab47425285bc2699ac55dcd diff --git a/tmtc/common_tmtc b/tmtc/common_tmtc index a31a9d3..117213a 160000 --- a/tmtc/common_tmtc +++ b/tmtc/common_tmtc @@ -1 +1 @@ -Subproject commit a31a9d39257d545a1a35752f35d7d1bfcf1b2c49 +Subproject commit 117213a922e71f6a058998305c01d98c878cb856 diff --git a/tmtc/config/__init__.py b/tmtc/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tmtc/tmtc_client_cli.py b/tmtc/tmtc_client_cli.py new file mode 100755 index 0000000..d22134a --- /dev/null +++ b/tmtc/tmtc_client_cli.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +""" +@brief TMTC Commander entry point for command line mode. +@details +This client was developed by KSat for the SOURCE project to test the on-board software but +has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand) +handling and testing via different communication interfaces. Currently, only the PUS standard is +implemented as a packet standard. + +Run this file with the -h flag to display options. + +@license +Copyright 2020 KSat e.V. Stuttgart + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +@author R. Mueller +""" +import sys + +from common_tmtc.config.hook_implementation import FsfwHookBase +from common_tmtc.config.definitions import PUS_APID +from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler +try: + from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler + from tmtccmd.ccsds.handler import CcsdsTmHandler +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print("Python tmtccmd submodule could not be imported") + print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") + sys.exit(0) + + +def main(): + hook_obj = FsfwHookBase() + initialize_tmtc_commander(hook_object=hook_obj) + ccsds_handler = CcsdsTmHandler() + ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) + add_ccsds_handler(ccsds_handler) + run_tmtc_commander(use_gui=False, app_name="TMTC Commander FSFW") + + +if __name__ == "__main__": + main() diff --git a/tmtc/tmtc_client_gui.py b/tmtc/tmtc_client_gui.py new file mode 100644 index 0000000..cde216e --- /dev/null +++ b/tmtc/tmtc_client_gui.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +""" +@brief TMTC Commander entry point for command line mode. +@details +This client was developed by KSat for the SOURCE project to test the on-board software but +has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand) +handling and testing via different communication interfaces. Currently, only the PUS standard is +implemented as a packet standard. + +Run this file with the -h flag to display options. + +@license +Copyright 2020 KSat e.V. Stuttgart + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +@author R. Mueller +""" +import sys + +from common_tmtc.config.hook_implementation import FsfwHookBase +from common_tmtc.config.definitions import PUS_APID +from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler +try: + from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler + from tmtccmd.ccsds.handler import CcsdsTmHandler +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print("Python tmtccmd submodule could not be imported") + print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") + sys.exit(0) + + +def main(): + hook_obj = FsfwHookBase() + initialize_tmtc_commander(hook_object=hook_obj) + ccsds_handler = CcsdsTmHandler() + ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) + add_ccsds_handler(ccsds_handler) + run_tmtc_commander(use_gui=True, app_name="TMTC Commander FSFW") + + +if __name__ == "__main__": + main()