From fd39b8a831b77de617f45ab3cf75e2a58fcc6a03 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 26 Feb 2024 14:23:09 +0000 Subject: [PATCH] Fix #375, Progress on pc-rtems generic target support --- fsw/pc-rtems/src/cfe_psp_start.c | 21 +++++++++++++++++ unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h | 2 ++ .../ut-stubs/override_inc/drvmgr/drvmgr.h | 23 +++++++++++++++++++ .../override_inc/drvmgr/drvmgr_confdefs.h | 23 +++++++++++++++++++ .../ut-stubs/override_inc/rtems/confdefs.h | 23 +++++++++++++++++++ .../override_inc/rtems/rtems_bsdnet.h | 2 ++ .../ut-stubs/src/rtems-bsdnet-stubs.c | 12 +++++++++- 7 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr_confdefs.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/rtems/confdefs.h diff --git a/fsw/pc-rtems/src/cfe_psp_start.c b/fsw/pc-rtems/src/cfe_psp_start.c index f60db23f..1444b252 100644 --- a/fsw/pc-rtems/src/cfe_psp_start.c +++ b/fsw/pc-rtems/src/cfe_psp_start.c @@ -99,6 +99,27 @@ struct rtems_bsdnet_config rtems_bsdnet_config = { /* * Network configuration */ +/* TODO move to a separate file */ +#include +#include + +#include "bsp_rtems_cfg.h" + +#include + +/* Configure Driver manager */ +#if defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3) /* if --drvmgr was given to configure */ + /* Add Timer and UART Driver for this example */ + #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER + #endif + #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART + #endif +#endif +#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH /* TODO make dependent on OSAL NETWORK config */ + +#include /* Set default IP and MAC if not defined */ #ifndef CONFIG_ETH_IP diff --git a/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h index 4dd65ea3..0b4866dd 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h @@ -27,5 +27,7 @@ extern int PCS_rtems_fxp_attach(struct PCS_rtems_bsdnet_ifconfig *, int) extern void PCS_rtems_bsdnet_do_dhcp_failsafe(void); extern int PCS_rtems_bsdnet_initialize_network(void); extern const char *PCS_rtems_status_text(PCS_rtems_status_code); +extern void PCS_rtems_bsdnet_show_inet_routes(void); +extern void PCS_rtems_bsdnet_show_if_stats(void); #endif diff --git a/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr.h b/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr.h new file mode 100644 index 00000000..6372a4fb --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr.h @@ -0,0 +1,23 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * 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 http://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. + ************************************************************************/ + +/* PSP coverage stub replacement for drvmgr.h */ +#ifndef OVERRIDE_DRVMGR_H +#define OVERRIDE_DRVMGR_H + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr_confdefs.h b/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr_confdefs.h new file mode 100644 index 00000000..a834df81 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/drvmgr/drvmgr_confdefs.h @@ -0,0 +1,23 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * 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 http://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. + ************************************************************************/ + +/* PSP coverage stub replacement for drvmgr_confdefs.h */ +#ifndef OVERRIDE_DRVMGR_CONFDEFS_H +#define OVERRIDE_DRVMGR_CONFDEFS_H + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/confdefs.h b/unit-test-coverage/ut-stubs/override_inc/rtems/confdefs.h new file mode 100644 index 00000000..03f3ef75 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/confdefs.h @@ -0,0 +1,23 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * 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 http://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. + ************************************************************************/ + +/* PSP coverage stub replacement for confdefs.h */ +#ifndef OVERRIDE_CONFDEFS_H +#define OVERRIDE_CONFDEFS_H + +#endif diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h index c0dda61b..07ec4fb2 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h @@ -26,5 +26,7 @@ #define rtems_bsdnet_do_dhcp_failsafe PCS_rtems_bsdnet_do_dhcp_failsafe #define rtems_bsdnet_initialize_network PCS_rtems_bsdnet_initialize_network #define rtems_fxp_attach PCS_rtems_fxp_attach +#define rtems_bsdnet_show_inet_routes PCS_rtems_bsdnet_show_inet_routes +#define rtems_bsdnet_show_if_stats PCS_rtems_bsdnet_show_if_stats #endif diff --git a/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c b/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c index 57499c4f..59104636 100644 --- a/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c +++ b/unit-test-coverage/ut-stubs/src/rtems-bsdnet-stubs.c @@ -50,4 +50,14 @@ int PCS_rtems_bsdnet_initialize_network(void) int PCS_rtems_fxp_attach(struct PCS_rtems_bsdnet_ifconfig *config, int attaching) { return UT_DEFAULT_IMPL(PCS_rtems_fxp_attach); -} \ No newline at end of file +} + +void PCS_rtems_bsdnet_show_inet_routes(void) +{ + UT_DEFAULT_IMPL(PCS_rtems_bsdnet_show_inet_routes); +} + +void PCS_rtems_bsdnet_show_if_stats(void) +{ + UT_DEFAULT_IMPL(PCS_rtems_bsdnet_show_if_stats); +}