Skip to content

Commit

Permalink
Fix #449, Make Linux+VxWorks BSPs generic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jphickey committed Jun 1, 2020
1 parent 3604387 commit 11a4899
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _functional_test: &functional_test
- cd build

# Prep and build
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=pc-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE ..
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=generic-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE ..
- make

# lcov capture pre-execution
Expand Down
Original file line number Diff line number Diff line change
@@ -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
)
Expand All @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##########################################################################
#
# Build options for "pc-linux" BSP
# Build options for "generic-linux" BSP
#
##########################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sys/types.h>
#include <sys/wait.h>

#include "pclinux_bsp_internal.h"
#include "generic_linux_bsp_internal.h"
#include "bsp-impl.h"

/*----------------------------------------------------------------
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include <sys/types.h>
#include <sys/stat.h>

#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()
Expand Down Expand Up @@ -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.
Expand All @@ -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);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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"
Expand All @@ -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_ */
14 changes: 14 additions & 0 deletions src/bsp/generic-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unistd.h>
#include <stdio.h>

#include "mcp750_bsp_internal.h"
#include "generic_vxworks_bsp_internal.h"
#include "bsp-impl.h"

/****************************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>

#include "mcp750_bsp_internal.h"
#include "generic_vxworks_bsp_internal.h"

/* ---------------------------------------------------------
OS_BSP_Shutdown_Impl()
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -11,17 +11,17 @@
**
**
** 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
*/
#include "osapi.h"
#include "bsp-impl.h"

#endif /* _MCP750_BSP_INTERNAL_H_ */
#endif /* GENERIC_VXWORKS_BSP_INTERNAL_H_ */
27 changes: 0 additions & 27 deletions src/bsp/mcp750-vxworks/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions src/bsp/mcp750-vxworks/src/bsp.mak

This file was deleted.

0 comments on commit 11a4899

Please sign in to comment.