Skip to content

Commit 3604387

Browse files
authored
Merge pull request #482 from nasa/integration-candidate
Integration Candidate 2020-05-20
2 parents 3597aaf + ffe100d commit 3604387

File tree

69 files changed

+1721
-870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1721
-870
lines changed

CMakeLists.txt

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
#
3131
# This also exports the following variables:
3232
#
33-
# OSAL_BSP_STAGING_INSTALL_DIR : the location of the staging directory
34-
# for the selected OSAL BSP. This can be used in
35-
# post-build rules or "install()" commands to stage
36-
# binary or data files for execution.
37-
#
3833
# UT_COVERAGE_COMPILE_FLAGS : Compiler flags that must be used to
3934
# instrument code for coverage testing
4035
# UT_COVERAGE_LINK_FLAGS : Linker flags that must be used to
@@ -48,6 +43,15 @@
4843
cmake_minimum_required(VERSION 2.8.12)
4944
project(OSAL C)
5045

46+
# The "OSAL_EXT_SOURCE_DIR" cache variable may be set to a path
47+
# on the host containing extra OS/BSP implementations which are not
48+
# part of the open source release.
49+
# CAUTION: The API between the OSAL and the low level implementation and/or BSP
50+
# is not stabilized, and may change with every OSAL release. No attempt is made
51+
# to provide backward compatibility with to external sources.
52+
set(OSAL_EXT_SOURCE_DIR "$ENV{OSAL_EXT_SOURCE_DIR}"
53+
CACHE PATH "External source directory to check for additional OS/BSP implementations")
54+
5155
# Read the default compile-time configuration, and update with
5256
# any mission/project specific options in the OSAL_CONFIGURATION_FILE
5357
include("${OSAL_SOURCE_DIR}/default_config.cmake")
@@ -104,15 +108,20 @@ add_subdirectory(ut_assert)
104108
# OSAL_SYSTEM_BSPTYPE indicate which of the BSP packages
105109
# to build. These is required and must be defined. Confirm that this exists
106110
# and error out now if it does not.
107-
if (NOT DEFINED OSAL_SYSTEM_BSPTYPE OR
108-
NOT IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
109-
# It is an error if the indicated BSPTYPE does not correspond to a subdirectory
110-
# If this is not caught here then a more obfuscated error will occur later.
111-
message("Error: \"${OSAL_SYSTEM_BSPTYPE}\" is not a valid BSP type")
111+
if (NOT DEFINED OSAL_SYSTEM_BSPTYPE)
112112
message(FATAL_ERROR "OSAL_SYSTEM_BSPTYPE must be set to the appropriate BSP")
113113
endif ()
114+
if (OSAL_EXT_SOURCE_DIR AND IS_DIRECTORY "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_BSPTYPE}")
115+
set(OSAL_BSP_SOURCE_DIR "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_BSPTYPE}")
116+
elseif(IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
117+
set(OSAL_BSP_SOURCE_DIR "${OSAL_SOURCE_DIR}/src/bsp/${OSAL_SYSTEM_BSPTYPE}")
118+
else()
119+
# It is an error if the indicated BSPTYPE does not correspond to a subdirectory
120+
# If this is not caught here then a more obfuscated error will occur later.
121+
message(FATAL_ERROR "Error: No source directory found for \"${OSAL_SYSTEM_BSPTYPE}\" BSP type")
122+
endif()
114123

115-
message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE}")
124+
message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE} at ${OSAL_BSP_SOURCE_DIR}")
116125

117126

118127
# The BSP library is a separate target from OSAL and can be used
@@ -121,7 +130,7 @@ message(STATUS "BSP Selection: ${OSAL_SYSTEM_BSPTYPE}")
121130
#
122131
# The Implementation-Specific BSP subdirectory should define
123132
# an OBJECT target named "osal_${OSAL_SYSTEM_BSPTYPE}_impl"
124-
add_subdirectory(src/bsp/${OSAL_SYSTEM_BSPTYPE} ${OSAL_SYSTEM_BSPTYPE}_impl)
133+
add_subdirectory(${OSAL_BSP_SOURCE_DIR} ${OSAL_SYSTEM_BSPTYPE}_impl)
125134
target_include_directories(osal_${OSAL_SYSTEM_BSPTYPE}_impl PRIVATE
126135
${OSAL_SOURCE_DIR}/src/bsp/shared/inc
127136
)
@@ -161,13 +170,22 @@ if (OSAL_BSP_INCLUDE_DIRECTORIES)
161170
include_directories(${OSAL_BSP_INCLUDE_DIRECTORIES})
162171
endif (OSAL_BSP_INCLUDE_DIRECTORIES)
163172

173+
set(BSP_SRCLIST
174+
src/bsp/shared/src/osapi-bsp.c
175+
src/bsp/shared/src/bsp_default_app_run.c
176+
src/bsp/shared/src/bsp_default_app_startup.c
177+
src/bsp/shared/src/bsp_default_symtab.c
178+
)
179+
180+
if (NOT OMIT_DEPRECATED)
181+
list(APPEND BSP_SRCLIST
182+
src/bsp/shared/src/bsp_default_voltab.c
183+
)
184+
endif (NOT OMIT_DEPRECATED)
164185

165186
# Define the external "osal_bsp" static library target
166187
add_library(osal_bsp STATIC
167-
src/bsp/shared/src/osapi-bsp.c
168-
src/bsp/shared/src/bsp_default_app_run.c
169-
src/bsp/shared/src/bsp_default_app_startup.c
170-
src/bsp/shared/src/bsp_default_symtab.c
188+
${BSP_SRCLIST}
171189
$<TARGET_OBJECTS:osal_${OSAL_SYSTEM_BSPTYPE}_impl>
172190
)
173191

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

188206
# OSAL_SYSTEM_OSTYPE indicates which of the OS packages
189207
# to build. If not defined, this may be inferred by the BSP type.
190-
if (NOT DEFINED OSAL_SYSTEM_OSTYPE OR
191-
NOT IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
192-
# It is an error if the indicated OSTYPE does not correspond to a subdirectory
193-
# If this is not caught here then a more obfuscated error will occur later.
194-
message("Error: \"${OSAL_SYSTEM_OSTYPE}\" is not a valid OS type")
208+
if (NOT DEFINED OSAL_SYSTEM_OSTYPE)
195209
message(FATAL_ERROR "OSAL_SYSTEM_OSTYPE must be set to the appropriate OS")
196210
endif ()
211+
if (OSAL_EXT_SOURCE_DIR AND IS_DIRECTORY "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_OSTYPE}")
212+
set(OSAL_OS_SOURCE_DIR "${OSAL_EXT_SOURCE_DIR}/${OSAL_SYSTEM_OSTYPE}")
213+
elseif(IS_DIRECTORY "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
214+
set(OSAL_OS_SOURCE_DIR "${OSAL_SOURCE_DIR}/src/os/${OSAL_SYSTEM_OSTYPE}")
215+
else()
216+
# It is an error if the indicated OSTYPE does not correspond to a subdirectory
217+
# If this is not caught here then a more obfuscated error will occur later.
218+
message(FATAL_ERROR "Error: No source directory found for \"${OSAL_SYSTEM_OSTYPE}\" OS type")
219+
endif()
197220

198-
message(STATUS "OSAL Selection: ${OSAL_SYSTEM_OSTYPE}")
221+
222+
message(STATUS "OSAL Selection: ${OSAL_SYSTEM_OSTYPE} at ${OSAL_OS_SOURCE_DIR}")
199223

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

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

296320
#
297321
# UNIT TEST SUPPORT
@@ -337,10 +361,6 @@ endif (ENABLE_UNIT_TESTS)
337361
# This is conditional to avoid warnings in a standalone build.
338362
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
339363
if (HAS_PARENT)
340-
# export the "OSAL_BSP_STAGING_INSTALL_DIR" to the parent build, so this can be
341-
# used in "install" commands as necessary for the files needed at runtime
342-
set(OSAL_BSP_STAGING_INSTALL_DIR "${OSAL_BSP_STAGING_INSTALL_DIR}" PARENT_SCOPE)
343-
344364
# Export the UT coverage compiler/linker flags to the parent build.
345365
# These flags are based on the target system type and should be used
346366
# when building code intended for coverage analysis.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ This distribution contains:
1616

1717
## Version History
1818

19+
### Development Build: 5.0.18
20+
21+
- Add functional tests for `OS_IdentifyObject`, `OS_ConvertToArrayIndex` and `OS_ForEachObject` functions.
22+
- Fix doxygen warnings
23+
- 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.
24+
- 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.
25+
- For RTEMS, will not shutdown the kernel if test abort occurs.
26+
- Unit tests work on RTEMS without BSP preallocating ramdisks
27+
- If `OSAL_EXT_SOURCE_DIR` cache variable is set, this location will be checked first for a BSP/OS implementation layer.
28+
- 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.
29+
- 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.
30+
- 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.
31+
- 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.
32+
- Adds the mutex to protect the timer callback `timecb` resource table.
33+
- See <https://github.com/nasa/osal/pull/482>
34+
1935
### Development Build: 5.0.17
2036

2137
- `OS_QueueCreate()` will return an error code if the depth parameter is larger than the configured `OS_MAX_QUEUE_DEPTH`.

osconfig.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,12 @@
248248
*/
249249
#define OS_MAX_CONSOLES 1
250250

251+
/**
252+
* \brief The system-specific file extension used on loadable module files
253+
*
254+
* Fixed value based on system selection, not user configurable.
255+
*/
256+
#define OS_MODULE_FILE_EXTENSION "@CMAKE_SHARED_LIBRARY_SUFFIX@"
257+
251258

252259
#endif /* INCLUDE_OSCONFIG_H_ */

src/bsp/mcp750-vxworks/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
add_library(osal_mcp750-vxworks_impl OBJECT
88
src/bsp_start.c
9-
src/bsp_voltab.c
109
src/bsp_console.c
1110
)
1211

src/bsp/mcp750-vxworks/build_options.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
#
55
##########################################################################
66

7-
# This indicates where to stage target binaries created during the build
8-
set(OSAL_BSP_STAGING_INSTALL_DIR "CF:0")
9-
107
# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point
118
target_link_libraries(osal_bsp -uOS_BSPMain)

src/bsp/mcp750-vxworks/src/bsp_start.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424

2525
#include "mcp750_bsp_internal.h"
2626

27+
/* ---------------------------------------------------------
28+
OS_BSP_Shutdown_Impl()
29+
30+
Helper function to abort the running task
31+
--------------------------------------------------------- */
32+
void OS_BSP_Shutdown_Impl(void)
33+
{
34+
abort();
35+
}
36+
37+
2738
/******************************************************************************
2839
** Function: OS_BSPMain()
2940
**

src/bsp/mcp750-vxworks/src/bsp_voltab.c

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/bsp/pc-linux/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
add_library(osal_pc-linux_impl OBJECT
1212
src/bsp_start.c
13-
src/bsp_voltab.c
1413
src/bsp_console.c
1514
)
1615

src/bsp/pc-linux/build_options.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,3 @@ if (NOT CMAKE_CROSSCOMPILING)
2121
set(UT_COVERAGE_COMPILE_FLAGS -pg --coverage)
2222
set(UT_COVERAGE_LINK_FLAGS -pg --coverage)
2323
endif()
24-
25-
# This indicates where to stage target binaries created during the build
26-
# It should reflect the _real_ location of the persistent storage path used by
27-
# the BSP which is intended to be used for runtime modules or files.
28-
set(OSAL_BSP_STAGING_INSTALL_DIR "eeprom1")

src/bsp/pc-linux/src/bsp_start.c

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,9 @@ OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal;
3838
--------------------------------------------------------- */
3939
void OS_BSP_Initialize(void)
4040
{
41-
mode_t mode;
42-
uint32 i;
43-
struct stat statbuf;
4441
FILE *fp;
4542
char buffer[32];
4643

47-
/*
48-
** Create local directories for "disk" mount points
49-
** See bsp_voltab for the values
50-
**
51-
** NOTE - the voltab table is poorly designed here; values of "0" are valid
52-
** and will translate into an entry that is actually used. In particular the
53-
** "free" flag has to be actually initialized to TRUE to say its NOT valid.
54-
** So in the case of an entry that has been zeroed out (i.e. bss section) it
55-
** will be treated as a valid entry.
56-
**
57-
** Checking that the DeviceName starts with a leading slash '/' is a workaround
58-
** for this, and may be the only way to detect an entry that is uninitialized.
59-
*/
60-
mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO;
61-
for (i = 0; i < NUM_TABLE_ENTRIES; ++i)
62-
{
63-
if (OS_VolumeTable[i].VolumeType == FS_BASED &&
64-
OS_VolumeTable[i].PhysDevName[0] != 0 &&
65-
OS_VolumeTable[i].DeviceName[0] == '/')
66-
67-
{
68-
if (stat(OS_VolumeTable[i].PhysDevName, &statbuf) < 0)
69-
{
70-
BSP_DEBUG("Creating mount point: %s\n", OS_VolumeTable[i].PhysDevName);
71-
mkdir(OS_VolumeTable[i].PhysDevName, mode);
72-
}
73-
}
74-
}
75-
7644
/*
7745
* If not running as root, check /proc/sys/fs/mqueue/msg_max
7846
*
@@ -132,6 +100,17 @@ int OS_BSP_GetReturnStatus(void)
132100
return retcode;
133101
}
134102

103+
/* ---------------------------------------------------------
104+
OS_BSP_Shutdown_Impl()
105+
106+
Helper function to abort the running task
107+
--------------------------------------------------------- */
108+
void OS_BSP_Shutdown_Impl(void)
109+
{
110+
abort();
111+
}
112+
113+
135114
/******************************************************************************
136115
** Function: main()
137116
**

0 commit comments

Comments
 (0)