From ff3a95efa6179e97f5dec2979e2bcb164155b684 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 29 May 2022 17:35:32 +0200 Subject: [PATCH] fix some issues and test on hw --- STM32CubeH7 | 2 +- .../NUCLEO-H743ZI/Inc/lwipopts.h.in | 6 +- .../NUCLEO-H743ZI/Src/hardware_init.cpp | 23 ++++---- bsp_stm32h7_freertos/core/InitMission.cpp | 2 + bsp_stm32h7_freertos/core/ObjectFactory.cpp | 8 --- example_common | 2 +- tmtc/.idea/runConfigurations/tmtccli.xml | 24 ++++++++ tmtc/config/hook.py | 11 ++++ tmtc/tmtc_client_cli.py | 56 ------------------- tmtc/tmtc_client_gui.py | 56 ------------------- tmtc/tmtc_conf.json | 6 ++ tmtc/tmtccli.py | 23 ++++++++ tmtc/tmtcgui.py | 12 ++++ 13 files changed, 94 insertions(+), 137 deletions(-) create mode 100644 tmtc/.idea/runConfigurations/tmtccli.xml create mode 100644 tmtc/config/hook.py delete mode 100755 tmtc/tmtc_client_cli.py delete mode 100644 tmtc/tmtc_client_gui.py create mode 100644 tmtc/tmtc_conf.json create mode 100755 tmtc/tmtccli.py create mode 100644 tmtc/tmtcgui.py diff --git a/STM32CubeH7 b/STM32CubeH7 index 5975bff..b340b13 160000 --- a/STM32CubeH7 +++ b/STM32CubeH7 @@ -1 +1 @@ -Subproject commit 5975bffae9358bc2b2890a35a203d940a395efef +Subproject commit b340b13929e36a3427b8d94e8b1006022f82273f diff --git a/bsp_stm32h7_freertos/NUCLEO-H743ZI/Inc/lwipopts.h.in b/bsp_stm32h7_freertos/NUCLEO-H743ZI/Inc/lwipopts.h.in index 1d4d369..235eef3 100644 --- a/bsp_stm32h7_freertos/NUCLEO-H743ZI/Inc/lwipopts.h.in +++ b/bsp_stm32h7_freertos/NUCLEO-H743ZI/Inc/lwipopts.h.in @@ -98,7 +98,7 @@ a lot of data that needs to be copied, this should be set high. */ #define PBUF_POOL_SIZE 4 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE 1528 +#define PBUF_POOL_BUFSIZE 1536 /* LWIP_SUPPORT_CUSTOM_PBUF == 1: to pass directly MAC Rx buffers to the stack no copy is needed */ @@ -232,12 +232,12 @@ The STM32H7xx allows computing and verifying the IP, UDP, TCP and ICMP checksums */ #define TCPIP_THREAD_NAME "TCP/IP" -#define TCPIP_THREAD_STACKSIZE 1000 +#define TCPIP_THREAD_STACKSIZE 2048 #define TCPIP_MBOX_SIZE 6 #define DEFAULT_UDP_RECVMBOX_SIZE 6 #define DEFAULT_TCP_RECVMBOX_SIZE 6 #define DEFAULT_ACCEPTMBOX_SIZE 6 -#define DEFAULT_THREAD_STACKSIZE 500 +#define DEFAULT_THREAD_STACKSIZE 1024 #define TCPIP_THREAD_PRIO osPriorityHigh /* diff --git a/bsp_stm32h7_freertos/NUCLEO-H743ZI/Src/hardware_init.cpp b/bsp_stm32h7_freertos/NUCLEO-H743ZI/Src/hardware_init.cpp index a68a658..a702cb5 100644 --- a/bsp_stm32h7_freertos/NUCLEO-H743ZI/Src/hardware_init.cpp +++ b/bsp_stm32h7_freertos/NUCLEO-H743ZI/Src/hardware_init.cpp @@ -8,7 +8,6 @@ #if OBSW_ADD_LWIP_COMPONENTS == 1 #include "example_common/stm32h7/networking/app_ethernet.h" #include "example_common/stm32h7/networking/ethernetif.h" -#include #include #include #include @@ -16,13 +15,13 @@ #endif #include -#include +#include /* Forward declarations */ -void MPU_Config(void); -void SystemClock_Config(void); -void BSP_Config(void); -void CPU_CACHE_Enable(void); +void MPU_Config(); +void SystemClock_Config(); +void BSP_Config(); +void CPU_CACHE_Enable(); void MX_USART3_UART_Init(uint32_t baudRate); /** @@ -113,7 +112,7 @@ void MX_USART3_UART_Init(uint32_t baudRate) { * @param None * @retval None */ -void SystemClock_Config(void) { +void SystemClock_Config() { RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_OscInitTypeDef RCC_OscInitStruct; HAL_StatusTypeDef ret = HAL_OK; @@ -176,7 +175,7 @@ value regarding system frequency refer to product datasheet. */ } /*Configure the MPU attributes */ -void MPU_Config(void) { +void MPU_Config() { MPU_Region_InitTypeDef MPU_InitStruct; /* Disable the MPU */ @@ -219,7 +218,7 @@ for LwIP RAM heap which contains the Tx buffers */ } /*CPU L1-Cache enable*/ -void CPU_CACHE_Enable(void) { +void CPU_CACHE_Enable() { /* Enable I-Cache */ SCB_EnableICache(); @@ -227,7 +226,7 @@ void CPU_CACHE_Enable(void) { SCB_EnableDCache(); } -void BSP_Config(void) { +void BSP_Config() { BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); @@ -253,8 +252,8 @@ void Netif_Config(void) { /* add the network interface */ struct netif *netif_valid = netif_add(&gnetif, (ip4_addr_t *)&ipaddr, (ip4_addr_t *)&netmask, - (ip4_addr_t *)&gw, NULL, ðernetif_init, ðernet_input); - if (netif_valid == NULL) { + (ip4_addr_t *)&gw, nullptr, ðernetif_init, ðernet_input); + if (netif_valid == nullptr) { printf("Error: netif initialization failed!\n\r"); return; } diff --git a/bsp_stm32h7_freertos/core/InitMission.cpp b/bsp_stm32h7_freertos/core/InitMission.cpp index 40f4359..ff545f9 100644 --- a/bsp_stm32h7_freertos/core/InitMission.cpp +++ b/bsp_stm32h7_freertos/core/InitMission.cpp @@ -22,6 +22,8 @@ void assemlyDemo(); void InitMission::createTasks() { TaskFactory *taskFactory = TaskFactory::instance(); ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + static_cast(taskFactory); + static_cast(result); #if OBSW_ADD_CORE_COMPONENTS == 1 /* TMTC Distribution */ PeriodicTaskIF *distributerTask = diff --git a/bsp_stm32h7_freertos/core/ObjectFactory.cpp b/bsp_stm32h7_freertos/core/ObjectFactory.cpp index c78ba93..a663e44 100644 --- a/bsp_stm32h7_freertos/core/ObjectFactory.cpp +++ b/bsp_stm32h7_freertos/core/ObjectFactory.cpp @@ -1,21 +1,14 @@ #include "ObjectFactory.h" #include "OBSWConfig.h" -#include "devices/devAddresses.h" #include "hardware_init.h" #include "objects/systemObjectList.h" #include "example/core/GenericFactory.h" -#include "example/utility/TmFunnel.h" #include "example_common/stm32h7/STM32TestTask.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" #include "fsfw/storagemanager/PoolManager.h" -#include "fsfw/tmtcpacket/pus/tm.h" -#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h" #if OBSW_PERFORM_L3GD20H_TEST == 1 @@ -66,7 +59,6 @@ void ObjectFactory::produce(void *args) { new STM32TestTask(objects::TEST_TASK, true, true); #if OBSW_PERFORM_L3GD20H_TEST == 1 - spi::MspCfgBase *mspCfg = nullptr; spi::TransferModes transferMode = spi::TransferModes::DMA; if (transferMode == spi::TransferModes::POLLING) { diff --git a/example_common b/example_common index d34effb..ff569dd 160000 --- a/example_common +++ b/example_common @@ -1 +1 @@ -Subproject commit d34effb278c645fb6532db56521dd4d08eb0f4a6 +Subproject commit ff569dd02c5915de5804914d7bfcc1d9688befca diff --git a/tmtc/.idea/runConfigurations/tmtccli.xml b/tmtc/.idea/runConfigurations/tmtccli.xml new file mode 100644 index 0000000..21356bd --- /dev/null +++ b/tmtc/.idea/runConfigurations/tmtccli.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/tmtc/config/hook.py b/tmtc/config/hook.py new file mode 100644 index 0000000..46ee7ef --- /dev/null +++ b/tmtc/config/hook.py @@ -0,0 +1,11 @@ +from common_tmtc.config.hook_implementation import CommonFsfwHookBase +from tmtccmd.tc.definitions import TcQueueT + + +class FsfwHookBase(CommonFsfwHookBase): + def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT): + from common_tmtc.pus_tc.tc_packing import common_service_queue_user + + common_service_queue_user( + service=service, op_code=op_code, tc_queue=service_queue + ) diff --git a/tmtc/tmtc_client_cli.py b/tmtc/tmtc_client_cli.py deleted file mode 100755 index d22134a..0000000 --- a/tmtc/tmtc_client_cli.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/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 deleted file mode 100644 index cde216e..0000000 --- a/tmtc/tmtc_client_gui.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/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() diff --git a/tmtc/tmtc_conf.json b/tmtc/tmtc_conf.json new file mode 100644 index 0000000..e7f7ff1 --- /dev/null +++ b/tmtc/tmtc_conf.json @@ -0,0 +1,6 @@ +{ + "com_if": "udp", + "tcpip_udp_ip_addr": "169.254.1.38", + "tcpip_udp_port": 7, + "tcpip_udp_recv_max_size": 1500 +} \ No newline at end of file diff --git a/tmtc/tmtccli.py b/tmtc/tmtccli.py new file mode 100755 index 0000000..8bd32dc --- /dev/null +++ b/tmtc/tmtccli.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""TMTC commander for FSFW Example""" +from common_tmtc.tmtcc import ( + tmtcc_post_args, + tmtcc_pre_args, + create_default_args_parser, + add_default_tmtccmd_args, + parse_default_input_arguments, +) +from config.hook import FsfwHookBase + + +def main(): + tmtcc_pre_args() + hook_obj = FsfwHookBase(json_cfg_path="tmtc_conf.json") + arg_parser = create_default_args_parser() + add_default_tmtccmd_args(arg_parser) + args = parse_default_input_arguments(arg_parser, hook_obj) + tmtcc_post_args(hook_obj=hook_obj, use_gui=False, args=args) + + +if __name__ == "__main__": + main() diff --git a/tmtc/tmtcgui.py b/tmtc/tmtcgui.py new file mode 100644 index 0000000..cd4934b --- /dev/null +++ b/tmtc/tmtcgui.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +"""TMTC commander for the FSFW Example""" +from common_tmtc.tmtcc import tmtcc_post_args, tmtcc_pre_args + + +def main(): + hook_obj = tmtcc_pre_args() + tmtcc_post_args(hook_obj=hook_obj, use_gui=True, args=None) + + +if __name__ == "__main__": + main()