From b8cd3d4aabc71ea40053e33f464109ba5c4e8c6f Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 13 May 2020 19:43:47 -0400 Subject: [PATCH] Fix #449, Make Linux+VxWorks BSPs generic These adaptor layers can be used on a variety of boards. Renaming the directory reflects that. Note - not renaming pc-rtems at this time, as that still has some non-generic aspects to it. --- .../CMakeLists.txt | 12 ++++----- .../build_options.cmake | 2 +- .../src/bsp_console.c | 4 +-- .../src/bsp_start.c | 8 +++--- .../src/generic_linux_bsp_internal.h} | 14 +++++----- src/bsp/generic-vxworks/CMakeLists.txt | 14 ++++++++++ .../build_options.cmake | 4 +-- .../src/bsp_console.c | 2 +- .../src/bsp_start.c | 2 +- .../src/generic_vxworks_bsp_internal.h} | 10 +++---- src/bsp/mcp750-vxworks/CMakeLists.txt | 27 ------------------- src/bsp/mcp750-vxworks/src/bsp.mak | 21 --------------- 12 files changed, 42 insertions(+), 78 deletions(-) rename src/bsp/{pc-linux => generic-linux}/CMakeLists.txt (73%) rename src/bsp/{pc-linux => generic-linux}/build_options.cmake (95%) rename src/bsp/{pc-linux => generic-linux}/src/bsp_console.c (97%) rename src/bsp/{pc-linux => generic-linux}/src/bsp_start.c (95%) rename src/bsp/{pc-linux/src/pclinux_bsp_internal.h => generic-linux/src/generic_linux_bsp_internal.h} (70%) create mode 100644 src/bsp/generic-vxworks/CMakeLists.txt rename src/bsp/{mcp750-vxworks => generic-vxworks}/build_options.cmake (59%) rename src/bsp/{mcp750-vxworks => generic-vxworks}/src/bsp_console.c (97%) rename src/bsp/{mcp750-vxworks => generic-vxworks}/src/bsp_start.c (97%) rename src/bsp/{mcp750-vxworks/src/mcp750_bsp_internal.h => generic-vxworks/src/generic_vxworks_bsp_internal.h} (72%) delete mode 100644 src/bsp/mcp750-vxworks/CMakeLists.txt delete mode 100644 src/bsp/mcp750-vxworks/src/bsp.mak diff --git a/src/bsp/pc-linux/CMakeLists.txt b/src/bsp/generic-linux/CMakeLists.txt similarity index 73% rename from src/bsp/pc-linux/CMakeLists.txt rename to src/bsp/generic-linux/CMakeLists.txt index 40b0aaca7..180e73840 100644 --- a/src/bsp/pc-linux/CMakeLists.txt +++ b/src/bsp/generic-linux/CMakeLists.txt @@ -1,14 +1,12 @@ ###################################################################### # -# CMAKE build recipe for PC-LINUX Board Support Package (BSP) +# CMAKE build recipe for LINUX Board Support Package (BSP) # ###################################################################### -# NOTE: Although this is traditionally called "pc-linux", it is generic -# enough to be applied to non-PC systems running embedded Linux, such -# as Raspberry Pi, BeagleBoard, Zync, or custom hardware. - -add_library(osal_pc-linux_impl OBJECT +# This basic implementation library should be generic enough to use +# on any Linux-based processor board, as well as a standard development PC. +add_library(osal_generic-linux_impl OBJECT src/bsp_start.c src/bsp_console.c ) @@ -23,7 +21,7 @@ add_library(osal_pc-linux_impl OBJECT # # See http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html # for a more detailed description of the feature test macros and available values -target_compile_definitions(osal_pc-linux_impl PUBLIC +target_compile_definitions(osal_generic-linux_impl PUBLIC _XOPEN_SOURCE=600 ) diff --git a/src/bsp/pc-linux/build_options.cmake b/src/bsp/generic-linux/build_options.cmake similarity index 95% rename from src/bsp/pc-linux/build_options.cmake rename to src/bsp/generic-linux/build_options.cmake index bf1d3c356..dcffd5a57 100644 --- a/src/bsp/pc-linux/build_options.cmake +++ b/src/bsp/generic-linux/build_options.cmake @@ -1,6 +1,6 @@ ########################################################################## # -# Build options for "pc-linux" BSP +# Build options for "generic-linux" BSP # ########################################################################## diff --git a/src/bsp/pc-linux/src/bsp_console.c b/src/bsp/generic-linux/src/bsp_console.c similarity index 97% rename from src/bsp/pc-linux/src/bsp_console.c rename to src/bsp/generic-linux/src/bsp_console.c index 61c1d620d..deaa340d3 100644 --- a/src/bsp/pc-linux/src/bsp_console.c +++ b/src/bsp/generic-linux/src/bsp_console.c @@ -20,7 +20,7 @@ #include #include -#include "pclinux_bsp_internal.h" +#include "generic_linux_bsp_internal.h" #include "bsp-impl.h" /*---------------------------------------------------------------- @@ -88,7 +88,7 @@ void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits) { char param[32]; - if (OS_BSP_PcLinuxGlobal.EnableTermControl) + if (OS_BSP_GenericLinuxGlobal.EnableTermControl) { if (ModeBits == OS_BSP_CONSOLEMODE_NORMAL) { diff --git a/src/bsp/pc-linux/src/bsp_start.c b/src/bsp/generic-linux/src/bsp_start.c similarity index 95% rename from src/bsp/pc-linux/src/bsp_start.c rename to src/bsp/generic-linux/src/bsp_start.c index a67be73fd..4f01c8846 100644 --- a/src/bsp/pc-linux/src/bsp_start.c +++ b/src/bsp/generic-linux/src/bsp_start.c @@ -25,9 +25,9 @@ #include #include -#include "pclinux_bsp_internal.h" +#include "generic_linux_bsp_internal.h" -OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal; +OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal; /* --------------------------------------------------------- OS_BSP_Initialize() @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) * Initially clear the global objects */ memset(&OS_BSP_Global, 0, sizeof(OS_BSP_Global)); - memset(&OS_BSP_PcLinuxGlobal, 0, sizeof(OS_BSP_PcLinuxGlobal)); + memset(&OS_BSP_GenericLinuxGlobal, 0, sizeof(OS_BSP_GenericLinuxGlobal)); /* * Save the argc/argv arguments for future use. @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) */ if (getenv("TERM") != NULL) { - OS_BSP_PcLinuxGlobal.EnableTermControl = isatty(STDOUT_FILENO); + OS_BSP_GenericLinuxGlobal.EnableTermControl = isatty(STDOUT_FILENO); } /* diff --git a/src/bsp/pc-linux/src/pclinux_bsp_internal.h b/src/bsp/generic-linux/src/generic_linux_bsp_internal.h similarity index 70% rename from src/bsp/pc-linux/src/pclinux_bsp_internal.h rename to src/bsp/generic-linux/src/generic_linux_bsp_internal.h index 460df5c98..826c46896 100644 --- a/src/bsp/pc-linux/src/pclinux_bsp_internal.h +++ b/src/bsp/generic-linux/src/generic_linux_bsp_internal.h @@ -1,5 +1,5 @@ /****************************************************************************** -** File: pclinux_bsp_internal.h +** File: generic_linux_bsp_internal.h ** ** ** This is governed by the NASA Open Source Agreement and may be used, @@ -11,12 +11,12 @@ ** ** ** Purpose: -** Header file for internal data to the PC-LINUX BSP +** Header file for internal data to the LINUX BSP ** ******************************************************************************/ -#ifndef _PCLINUX_BSP_INTERNAL_H_ -#define _PCLINUX_BSP_INTERNAL_H_ +#ifndef GENERIC_LINUX_BSP_INTERNAL_H_ +#define GENERIC_LINUX_BSP_INTERNAL_H_ #include "osapi.h" #include "bsp-impl.h" @@ -27,11 +27,11 @@ typedef struct { bool EnableTermControl; /**< Will be set "true" when invoked from a TTY device, false otherwise */ -} OS_BSP_PcLinuxGlobalData_t; +} OS_BSP_GenericLinuxGlobalData_t; /* * Global Data object */ -extern OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal; +extern OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal; -#endif /* _PCLINUX_BSP_INTERNAL_H_ */ +#endif /* GENERIC_LINUX_BSP_INTERNAL_H_ */ diff --git a/src/bsp/generic-vxworks/CMakeLists.txt b/src/bsp/generic-vxworks/CMakeLists.txt new file mode 100644 index 000000000..8e638b930 --- /dev/null +++ b/src/bsp/generic-vxworks/CMakeLists.txt @@ -0,0 +1,14 @@ +###################################################################### +# +# CMAKE build recipe for Generic VxWorks Board Support Package (BSP) +# +###################################################################### + +add_library(osal_generic-vxworks_impl OBJECT + src/bsp_start.c + src/bsp_console.c +) + +# This BSP only works with "vxworks" OS layer. +# Confirming this reduces risk of accidental misconfiguration +set(OSAL_EXPECTED_OSTYPE "vxworks" PARENT_SCOPE) diff --git a/src/bsp/mcp750-vxworks/build_options.cmake b/src/bsp/generic-vxworks/build_options.cmake similarity index 59% rename from src/bsp/mcp750-vxworks/build_options.cmake rename to src/bsp/generic-vxworks/build_options.cmake index 3e3c71751..5ba936aba 100644 --- a/src/bsp/mcp750-vxworks/build_options.cmake +++ b/src/bsp/generic-vxworks/build_options.cmake @@ -1,8 +1,8 @@ ########################################################################## # -# Build options for "mcp750-vxworks" BSP +# Build options for "generic-vxworks" BSP # ########################################################################## -# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point +# The "-u" switch is required to ensure that the linker pulls in the OS_BSPMain entry point target_link_libraries(osal_bsp -uOS_BSPMain) diff --git a/src/bsp/mcp750-vxworks/src/bsp_console.c b/src/bsp/generic-vxworks/src/bsp_console.c similarity index 97% rename from src/bsp/mcp750-vxworks/src/bsp_console.c rename to src/bsp/generic-vxworks/src/bsp_console.c index 710b1a007..504bedc4c 100644 --- a/src/bsp/mcp750-vxworks/src/bsp_console.c +++ b/src/bsp/generic-vxworks/src/bsp_console.c @@ -19,7 +19,7 @@ #include #include -#include "mcp750_bsp_internal.h" +#include "generic_vxworks_bsp_internal.h" #include "bsp-impl.h" /**************************************************************************************** diff --git a/src/bsp/mcp750-vxworks/src/bsp_start.c b/src/bsp/generic-vxworks/src/bsp_start.c similarity index 97% rename from src/bsp/mcp750-vxworks/src/bsp_start.c rename to src/bsp/generic-vxworks/src/bsp_start.c index 4669e7a8b..68e342a5f 100644 --- a/src/bsp/mcp750-vxworks/src/bsp_start.c +++ b/src/bsp/generic-vxworks/src/bsp_start.c @@ -22,7 +22,7 @@ #include #include -#include "mcp750_bsp_internal.h" +#include "generic_vxworks_bsp_internal.h" /* --------------------------------------------------------- OS_BSP_Shutdown_Impl() diff --git a/src/bsp/mcp750-vxworks/src/mcp750_bsp_internal.h b/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h similarity index 72% rename from src/bsp/mcp750-vxworks/src/mcp750_bsp_internal.h rename to src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h index 7b6d84363..461b725c6 100644 --- a/src/bsp/mcp750-vxworks/src/mcp750_bsp_internal.h +++ b/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h @@ -1,5 +1,5 @@ /****************************************************************************** -** File: mcp750_bsp_internal.h +** File: generic_vxworks_bsp_internal.h ** ** ** This is governed by the NASA Open Source Agreement and may be used, @@ -11,12 +11,12 @@ ** ** ** Purpose: -** Header file for internal data to the MCP750 BSP +** Header file for internal data to the VxWorks BSP ** ******************************************************************************/ -#ifndef _MCP750_BSP_INTERNAL_H_ -#define _MCP750_BSP_INTERNAL_H_ +#ifndef GENERIC_VXWORKS_BSP_INTERNAL_H_ +#define GENERIC_VXWORKS_BSP_INTERNAL_H_ /* ** OSAL includes @@ -24,4 +24,4 @@ #include "osapi.h" #include "bsp-impl.h" -#endif /* _MCP750_BSP_INTERNAL_H_ */ +#endif /* GENERIC_VXWORKS_BSP_INTERNAL_H_ */ diff --git a/src/bsp/mcp750-vxworks/CMakeLists.txt b/src/bsp/mcp750-vxworks/CMakeLists.txt deleted file mode 100644 index a73a2d25d..000000000 --- a/src/bsp/mcp750-vxworks/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -###################################################################### -# -# CMAKE build recipe for MCP750 Board Support Package (BSP) -# -###################################################################### - -add_library(osal_mcp750-vxworks_impl OBJECT - src/bsp_start.c - src/bsp_console.c -) - -target_include_directories(osal_mcp750-vxworks_impl PUBLIC - $ENV{WIND_BASE}/target/h - $ENV{WIND_BASE}/target/h/wrn/coreip - $ENV{WIND_BASE}/target/config/mcp750 -) - -# NOTE: the __PPC__ and MCP750 macros are referenced in some system headers. -# therefore all code compiled for this platform should always define these symbols. -target_compile_definitions(osal_mcp750-vxworks_impl PUBLIC - "__PPC__" - "MCP750" -) - -# This BSP only works with "vxworks" OS layer. -# Confirming this reduces risk of accidental misconfiguration -set(OSAL_EXPECTED_OSTYPE "vxworks" PARENT_SCOPE) diff --git a/src/bsp/mcp750-vxworks/src/bsp.mak b/src/bsp/mcp750-vxworks/src/bsp.mak deleted file mode 100644 index f1ebaf8cd..000000000 --- a/src/bsp/mcp750-vxworks/src/bsp.mak +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# File: bsp.mak -# -# Purpose: -# Compile Board Support Package routines -# -# History: -# -############################################################################### - -# Subsystem produced by this makefile. -TARGET = bsp.o - -#============================================================================== -# Object files required to build subsystem. -OBJS = bsp_start.o bsp_voltab.o - -#============================================================================== -# Source files required to build subsystem; used to generate dependencies. -SOURCES = bsp_start.c bsp_voltab.c -