Skip to content

Commit

Permalink
Merge pull request nasa#482 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate 2020-05-20
  • Loading branch information
astrogeco authored May 29, 2020
2 parents 3597aaf + ffe100d commit 3604387
Show file tree
Hide file tree
Showing 69 changed files with 1,721 additions and 870 deletions.
78 changes: 49 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
#
# This also exports the following variables:
#
# OSAL_BSP_STAGING_INSTALL_DIR : the location of the staging directory
# for the selected OSAL BSP. This can be used in
# post-build rules or "install()" commands to stage
# binary or data files for execution.
#
# UT_COVERAGE_COMPILE_FLAGS : Compiler flags that must be used to
# instrument code for coverage testing
# UT_COVERAGE_LINK_FLAGS : Linker flags that must be used to
Expand All @@ -48,6 +43,15 @@
cmake_minimum_required(VERSION 2.8.12)
project(OSAL C)

# The "OSAL_EXT_SOURCE_DIR" cache variable may be set to a path
# on the host containing extra OS/BSP implementations which are not
# part of the open source release.
# CAUTION: The API between the OSAL and the low level implementation and/or BSP
# is not stabilized, and may change with every OSAL release. No attempt is made
# to provide backward compatibility with to external sources.
set(OSAL_EXT_SOURCE_DIR "$ENV{OSAL_EXT_SOURCE_DIR}"
CACHE PATH "External source directory to check for additional OS/BSP implementations")

# Read the default compile-time configuration, and update with
# any mission/project specific options in the OSAL_CONFIGURATION_FILE
include("${OSAL_SOURCE_DIR}/default_config.cmake")
Expand Down Expand Up @@ -104,15 +108,20 @@ add_subdirectory(ut_assert)
# OSAL_SYSTEM_BSPTYPE indicate which of the BSP packages
# to build. These is required and must be defined. Confirm that this exists
# and error out now if it does not.
if (NOT DEFINED OSAL_SYSTEM_BSPTYPE OR
NOT IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
# It is an error if the indicated BSPTYPE does not correspond to a subdirectory
# If this is not caught here then a more obfuscated error will occur later.
message("Error: \"${OSAL_SYSTEM_BSPTYPE}\" is not a valid BSP type")
if (NOT DEFINED OSAL_SYSTEM_BSPTYPE)
message(FATAL_ERROR "OSAL_SYSTEM_BSPTYPE must be set to the appropriate BSP")
endif ()
if (OSAL_EXT_SOURCE_DIR AND IS_DIRECTORY "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_BSPTYPE}")
set(OSAL_BSP_SOURCE_DIR "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_BSPTYPE}")
elseif(IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
set(OSAL_BSP_SOURCE_DIR "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
else()
# It is an error if the indicated BSPTYPE does not correspond to a subdirectory
# If this is not caught here then a more obfuscated error will occur later.
message(FATAL_ERROR "Error: No source directory found for \"${OSAL_SYSTEM_BSPTYPE}\" BSP type")
endif()

message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE}")
message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE} at ${OSAL_BSP_SOURCE_DIR}")


# The BSP library is a separate target from OSAL and can be used
Expand All @@ -121,7 +130,7 @@ message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE}")
#
# The Implementation-Specific BSP subdirectory should define
# an OBJECT target named "osal_${OSAL_SYSTEM_BSPTYPE}_impl"
add_subdirectory(src/bsp/${OSAL_SYSTEM_BSPTYPE} ${OSAL_SYSTEM_BSPTYPE}_impl)
add_subdirectory(${OSAL_BSP_SOURCE_DIR} ${OSAL_SYSTEM_BSPTYPE}_impl)
target_include_directories(osal_${OSAL_SYSTEM_BSPTYPE}_impl PRIVATE
${OSAL_SOURCE_DIR}/src/bsp/shared/inc
)
Expand Down Expand Up @@ -161,13 +170,22 @@ if (OSAL_BSP_INCLUDE_DIRECTORIES)
include_directories(${OSAL_BSP_INCLUDE_DIRECTORIES})
endif (OSAL_BSP_INCLUDE_DIRECTORIES)

set(BSP_SRCLIST
src/bsp/shared/src/osapi-bsp.c
src/bsp/shared/src/bsp_default_app_run.c
src/bsp/shared/src/bsp_default_app_startup.c
src/bsp/shared/src/bsp_default_symtab.c
)

if (NOT OMIT_DEPRECATED)
list(APPEND BSP_SRCLIST
src/bsp/shared/src/bsp_default_voltab.c
)
endif (NOT OMIT_DEPRECATED)

# Define the external "osal_bsp" static library target
add_library(osal_bsp STATIC
src/bsp/shared/src/osapi-bsp.c
src/bsp/shared/src/bsp_default_app_run.c
src/bsp/shared/src/bsp_default_app_startup.c
src/bsp/shared/src/bsp_default_symtab.c
${BSP_SRCLIST}
$<TARGET_OBJECTS:osal_${OSAL_SYSTEM_BSPTYPE}_impl>
)

Expand All @@ -187,19 +205,25 @@ target_include_directories(osal_bsp PRIVATE

# OSAL_SYSTEM_OSTYPE indicates which of the OS packages
# to build. If not defined, this may be inferred by the BSP type.
if (NOT DEFINED OSAL_SYSTEM_OSTYPE OR
NOT IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
# It is an error if the indicated OSTYPE does not correspond to a subdirectory
# If this is not caught here then a more obfuscated error will occur later.
message("Error: \"${OSAL_SYSTEM_OSTYPE}\" is not a valid OS type")
if (NOT DEFINED OSAL_SYSTEM_OSTYPE)
message(FATAL_ERROR "OSAL_SYSTEM_OSTYPE must be set to the appropriate OS")
endif ()
if (OSAL_EXT_SOURCE_DIR AND IS_DIRECTORY "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_OSTYPE}")
set(OSAL_OS_SOURCE_DIR "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_OSTYPE}")
elseif(IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
set(OSAL_OS_SOURCE_DIR "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
else()
# It is an error if the indicated OSTYPE does not correspond to a subdirectory
# If this is not caught here then a more obfuscated error will occur later.
message(FATAL_ERROR "Error: No source directory found for \"${OSAL_SYSTEM_OSTYPE}\" OS type")
endif()

message(STATUS "OSAL Selection: ${OSAL_SYSTEM_OSTYPE}")

message(STATUS "OSAL Selection: ${OSAL_SYSTEM_OSTYPE} at ${OSAL_OS_SOURCE_DIR}")

# The implementation-specific OSAL subdirectory should define
# an OBJECT target named "osal_${OSAL_SYSTEM_OSTYPE}_impl"
add_subdirectory(src/os/${OSAL_SYSTEM_OSTYPE} ${OSAL_SYSTEM_OSTYPE}_impl)
add_subdirectory(${OSAL_OS_SOURCE_DIR} ${OSAL_SYSTEM_OSTYPE}_impl)

# The "shared" directory contains internal components which
# are referenced in implementation OSAL modules, but should _NOT_
Expand Down Expand Up @@ -290,8 +314,8 @@ endif(OSAL_BSP_INCLUDE_DIRECTORIES)
# fine-tune the library for this particular build. This is included
# AFTER The basic targets are defined, so it may set properties
# on the defined targets and/or use target-specific commands.
include("${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}/build_options.cmake" OPTIONAL)
include("${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}/build_options.cmake" OPTIONAL)
include("${OSAL_BSP_SOURCE_DIR}/build_options.cmake" OPTIONAL)
include("${OSAL_OS_SOURCE_DIR}/build_options.cmake" OPTIONAL)

#
# UNIT TEST SUPPORT
Expand Down Expand Up @@ -337,10 +361,6 @@ endif (ENABLE_UNIT_TESTS)
# This is conditional to avoid warnings in a standalone build.
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if (HAS_PARENT)
# export the "OSAL_BSP_STAGING_INSTALL_DIR" to the parent build, so this can be
# used in "install" commands as necessary for the files needed at runtime
set(OSAL_BSP_STAGING_INSTALL_DIR "${OSAL_BSP_STAGING_INSTALL_DIR}" PARENT_SCOPE)

# Export the UT coverage compiler/linker flags to the parent build.
# These flags are based on the target system type and should be used
# when building code intended for coverage analysis.
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ This distribution contains:

## Version History

### Development Build: 5.0.18

- Add functional tests for `OS_IdentifyObject`, `OS_ConvertToArrayIndex` and `OS_ForEachObject` functions.
- Fix doxygen warnings
- Unit test cases which use `OS_statfs` and run on an `RTEMS IMFS` volume will be skipped and categorized as "NA" due to `OS_ERR_NOT_IMPLEMENTED` response, rather than a failure.
- The device_name field was using the wrong length, it should be of `OS_FS_DEV_NAME_LEN` Also correct another length check on the local path name.
- For RTEMS, will not shutdown the kernel if test abort occurs.
- Unit tests work on RTEMS without BSP preallocating ramdisks
- If `OSAL_EXT_SOURCE_DIR` cache variable is set, this location will be checked first for a BSP/OS implementation layer.
- Implement `OS_GetResourceName()` and `OS_ForEachObjectOfType()`, which are new functions that allow for additional query capabilities. No impact to current behavior as the FSW does not currently use any of these new APIs.
- A functional test enhancement to `bin-sem-test` which replicates the specific conditions for the observed bug to occur. Deletes the task calling `OS_BinSemTake()` and then attempts to use the semaphore after this.
- Employ a `pthread` "cleanup handler" to handle the situation where a task is canceled during the `pthread_cond_wait()` call. This ensures that the `mutex` is unlocked as part of the cleanup, so other tasks may continue using the semaphore.
- Change all initial `mutex` locking to be a finite "timed" wait rather than an infinite wait. In all cases, the condition variable is only held for brief periods of time and should be readily available. If a task blocks for a long time, this considers the mutex "broken" and aborts, thereby avoiding deadlock. This is a "contingency" fix in that if an exception or signal or other unknown/unhandled async event occurs that leaves the mutex permanently locked.
- Adds the mutex to protect the timer callback `timecb` resource table.
- See <https://github.com/nasa/osal/pull/482>

### Development Build: 5.0.17

- `OS_QueueCreate()` will return an error code if the depth parameter is larger than the configured `OS_MAX_QUEUE_DEPTH`.
Expand Down
7 changes: 7 additions & 0 deletions osconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,12 @@
*/
#define OS_MAX_CONSOLES 1

/**
* \brief The system-specific file extension used on loadable module files
*
* Fixed value based on system selection, not user configurable.
*/
#define OS_MODULE_FILE_EXTENSION "@CMAKE_SHARED_LIBRARY_SUFFIX@"


#endif /* INCLUDE_OSCONFIG_H_ */
1 change: 0 additions & 1 deletion src/bsp/mcp750-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

add_library(osal_mcp750-vxworks_impl OBJECT
src/bsp_start.c
src/bsp_voltab.c
src/bsp_console.c
)

Expand Down
3 changes: 0 additions & 3 deletions src/bsp/mcp750-vxworks/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
#
##########################################################################

# This indicates where to stage target binaries created during the build
set(OSAL_BSP_STAGING_INSTALL_DIR "CF:0")

# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point
target_link_libraries(osal_bsp -uOS_BSPMain)
11 changes: 11 additions & 0 deletions src/bsp/mcp750-vxworks/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@

#include "mcp750_bsp_internal.h"

/* ---------------------------------------------------------
OS_BSP_Shutdown_Impl()
Helper function to abort the running task
--------------------------------------------------------- */
void OS_BSP_Shutdown_Impl(void)
{
abort();
}


/******************************************************************************
** Function: OS_BSPMain()
**
Expand Down
60 changes: 0 additions & 60 deletions src/bsp/mcp750-vxworks/src/bsp_voltab.c

This file was deleted.

1 change: 0 additions & 1 deletion src/bsp/pc-linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

add_library(osal_pc-linux_impl OBJECT
src/bsp_start.c
src/bsp_voltab.c
src/bsp_console.c
)

Expand Down
5 changes: 0 additions & 5 deletions src/bsp/pc-linux/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,3 @@ if (NOT CMAKE_CROSSCOMPILING)
set(UT_COVERAGE_COMPILE_FLAGS -pg --coverage)
set(UT_COVERAGE_LINK_FLAGS -pg --coverage)
endif()

# This indicates where to stage target binaries created during the build
# It should reflect the _real_ location of the persistent storage path used by
# the BSP which is intended to be used for runtime modules or files.
set(OSAL_BSP_STAGING_INSTALL_DIR "eeprom1")
43 changes: 11 additions & 32 deletions src/bsp/pc-linux/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,9 @@ OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal;
--------------------------------------------------------- */
void OS_BSP_Initialize(void)
{
mode_t mode;
uint32 i;
struct stat statbuf;
FILE *fp;
char buffer[32];

/*
** Create local directories for "disk" mount points
** See bsp_voltab for the values
**
** NOTE - the voltab table is poorly designed here; values of "0" are valid
** and will translate into an entry that is actually used. In particular the
** "free" flag has to be actually initialized to TRUE to say its NOT valid.
** So in the case of an entry that has been zeroed out (i.e. bss section) it
** will be treated as a valid entry.
**
** Checking that the DeviceName starts with a leading slash '/' is a workaround
** for this, and may be the only way to detect an entry that is uninitialized.
*/
mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO;
for (i = 0; i < NUM_TABLE_ENTRIES; ++i)
{
if (OS_VolumeTable[i].VolumeType == FS_BASED &&
OS_VolumeTable[i].PhysDevName[0] != 0 &&
OS_VolumeTable[i].DeviceName[0] == '/')

{
if (stat(OS_VolumeTable[i].PhysDevName, &statbuf) < 0)
{
BSP_DEBUG("Creating mount point: %s\n", OS_VolumeTable[i].PhysDevName);
mkdir(OS_VolumeTable[i].PhysDevName, mode);
}
}
}

/*
* If not running as root, check /proc/sys/fs/mqueue/msg_max
*
Expand Down Expand Up @@ -132,6 +100,17 @@ int OS_BSP_GetReturnStatus(void)
return retcode;
}

/* ---------------------------------------------------------
OS_BSP_Shutdown_Impl()
Helper function to abort the running task
--------------------------------------------------------- */
void OS_BSP_Shutdown_Impl(void)
{
abort();
}


/******************************************************************************
** Function: main()
**
Expand Down
Loading

0 comments on commit 3604387

Please sign in to comment.