Skip to content

Commit

Permalink
Merge pull request #1260 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
osal Integration candidate: Caelum-rc4+dev10
  • Loading branch information
astrogeco authored May 31, 2022
2 parents acb88ca + ac3a31c commit 2864b25
Show file tree
Hide file tree
Showing 52 changed files with 288 additions and 174 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Version History

### Development Build: v6.0.0-rc4+dev83

- Resolve UT uninit vars static analysis warnings
- Remove redundant checks in UT
- Resolve UT uninit vars static analysis warnings
- Add RTEMS 6 Support
- See https://github.com/nasa/osal/pull/1260 and <https://github.com/nasa/cFS/pull/492>

### Development Build: v6.0.0-rc4+dev74

- Update codeql workflows for reusable update
Expand Down
9 changes: 8 additions & 1 deletion src/bsp/pc-rtems/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@

# Link the RTEMS BSP with the "rtemscpu" system library
target_link_libraries(osal_bsp
rtemscpu
rtemscpu
)

# Add the networking library for RTEMS 6+
if(CMAKE_SYSTEM_VERSION GREATER 5)
target_link_libraries(osal_bsp
networking
)
endif(CMAKE_SYSTEM_VERSION GREATER 5)
13 changes: 9 additions & 4 deletions src/bsp/pc-rtems/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <ctype.h>
#include <bsp.h>
#include <rtems.h>
#include <rtems/mkrootfs.h>
#include <rtems/bdbuf.h>
#include <rtems/blkdev.h>
#include <rtems/diskdevs.h>
Expand All @@ -47,6 +46,10 @@
#include <rtems/shell.h>
#include <rtems/rtl/dlfcn-shell.h>

#if defined(OS_RTEMS_4_DEPRECATED) || defined(OS_RTEMS_5)
#include <rtems/mkrootfs.h>
#endif

#include "pcrtems_bsp_internal.h"

/*
Expand Down Expand Up @@ -178,6 +181,7 @@ void OS_BSP_Setup(void)
BSP_DEBUG("rtems_semaphore_create: %s\n", rtems_status_text(status));
}

#if defined(OS_RTEMS_4_DEPRECATED) || defined(OS_RTEMS_5)
/*
** Create the RTEMS Root file system
*/
Expand All @@ -186,6 +190,7 @@ void OS_BSP_Setup(void)
{
printf("Creating Root file system failed: %s\n", rtems_status_text(status));
}
#endif

/*
* Create the mountpoint for the general purpose file system
Expand Down Expand Up @@ -413,10 +418,10 @@ rtems_task Init(rtems_task_argument ignored)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4)
#define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 4
#ifdef _RTEMS_5_
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#else
#ifdef OS_RTEMS_4_DEPRECATED
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#else
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#endif

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
Expand Down
6 changes: 3 additions & 3 deletions src/bsp/pc-rtems/src/pcrtems_bsp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
/*
* Handle the differences between RTEMS 5 and 4.11 copyright notice
*/
#ifdef _RTEMS_5_
#define OSAL_BSP_COPYRIGHT_NOTICE rtems_get_copyright_notice()
#else
#ifdef OS_RTEMS_4_DEPRECATED
#define OSAL_BSP_COPYRIGHT_NOTICE _Copyright_Notice
#else
#define OSAL_BSP_COPYRIGHT_NOTICE rtems_get_copyright_notice()
#endif

/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 74
#define OS_BUILD_NUMBER 83
#define OS_BUILD_BASELINE "v6.0.0-rc4"

/*
Expand Down
17 changes: 9 additions & 8 deletions src/os/rtems/inc/os-rtems.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,22 @@
DEFINES
***************************************************************************************/
/*
* Handle the data structure and API name changes between RTEMS 4.11 and RTEMS 5.1
* Handle the data structure and API name changes between RTEMS 4.11 and RTEMS 5.1+
*/
#ifdef _RTEMS_5_
#define OSAL_HEAP_INFO_BLOCK Heap_Information_block
#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec
#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_symbol
#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_iterate

#else
#ifdef OS_RTEMS_4_DEPRECATED

#define OSAL_HEAP_INFO_BLOCK region_information_block
#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec_t
#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_name
#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_interate

#else

#define OSAL_HEAP_INFO_BLOCK Heap_Information_block
#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec
#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_symbol
#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_iterate

#endif

/****************************************************************************************
Expand Down
4 changes: 3 additions & 1 deletion src/os/rtems/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ int32 OS_FileSysStartVolume_Impl(const OS_object_token_t *token)
*/
if (return_code == OS_SUCCESS && local->system_mountpt[0] == 0)
{
snprintf(local->system_mountpt, sizeof(local->system_mountpt), "/%s", local->volume_name);
local->system_mountpt[0] = '/';
local->system_mountpt[sizeof(local->system_mountpt) - 1] = 0;
strncpy(&local->system_mountpt[1], local->volume_name, sizeof(local->system_mountpt) - 2);
OS_DEBUG("OSAL: using mount point %s for %s\n", local->system_mountpt, local->volume_name);
}

Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
TYPEDEFS
***************************************************************************************/

#ifndef _RTEMS_5_
#ifdef OS_RTEMS_4_DEPRECATED

typedef rtems_rtl_obj_t rtems_rtl_obj; /* Alias for RTEMS 4.11 */

Expand Down
8 changes: 8 additions & 0 deletions src/tests/bin-sem-flush-test/bin-sem-flush-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ void task_1(void)
OS_bin_sem_prop_t bin_sem_prop;
int counter = 0;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

OS_printf("Starting task 1\n");

OS_printf("TASK 1: Waiting on the semaphore\n");
Expand Down Expand Up @@ -96,6 +98,8 @@ void task_2(void)
OS_bin_sem_prop_t bin_sem_prop;
int counter = 0;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

task_2_failures = 0;
OS_printf("Starting task 2\n");

Expand Down Expand Up @@ -134,6 +138,8 @@ void task_3(void)
OS_bin_sem_prop_t bin_sem_prop;
int counter = 0;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

OS_printf("Starting task 3\n");

OS_printf("TASK 3: Waiting on the semaphore\n");
Expand Down Expand Up @@ -189,6 +195,8 @@ void BinSemFlushSetup(void)
uint32 status;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

/* Note that UT assert is not multi-thread safe,
* so each thread must use a separate error counter
* and then we will assert that these remain zero
Expand Down
14 changes: 11 additions & 3 deletions src/tests/bin-sem-test/bin-sem-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ int counter = 0;
*/
void TimerFunction(osal_id_t local_timer_id)
{
int32 status;
int32 status;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

timer_counter++;

Expand All @@ -79,7 +82,6 @@ void TimerFunction(osal_id_t local_timer_id)
}

{
OS_bin_sem_prop_t bin_sem_prop;
status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
if (status != OS_SUCCESS)
{
Expand All @@ -102,6 +104,8 @@ void task_1(void)
OS_bin_sem_prop_t bin_sem_prop;
int printf_counter = 0;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

OS_printf("Starting task 1\n");

OS_printf("Delay for 1 second before starting\n");
Expand Down Expand Up @@ -153,6 +157,8 @@ void BinSemCheck(void)
uint32 status;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

/* Delete the task, which should be pending in OS_BinSemTake() */
status = OS_TaskDelete(task_1_id);
UtAssert_True(status == OS_SUCCESS, "OS_TaskDelete Rc=%d", (int)status);
Expand Down Expand Up @@ -196,9 +202,11 @@ void UtTest_Setup(void)
void BinSemSetup(void)
{
uint32 status;
uint32 accuracy;
uint32 accuracy = 0;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

/* separate task failure counter because ut-assert is not reentrant */
task_1_failures = 0;
timer_failures = 0;
Expand Down
12 changes: 9 additions & 3 deletions src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ int counter = 0;
*/
void TimerFunction(osal_id_t local_timer_id)
{
int32 status;
int32 status;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

timer_counter++;

Expand All @@ -75,7 +78,6 @@ void TimerFunction(osal_id_t local_timer_id)
}

{
OS_bin_sem_prop_t bin_sem_prop;
status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
if (status != OS_SUCCESS)
{
Expand All @@ -97,6 +99,8 @@ void task_1(void)
uint32 status;
OS_bin_sem_prop_t bin_sem_prop;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

OS_printf("Starting task 1\n");

OS_printf("Delay for 1 second before starting\n");
Expand Down Expand Up @@ -192,7 +196,9 @@ void BinSemTimeoutSetup(void)
{
uint32 status;
OS_bin_sem_prop_t bin_sem_prop;
uint32 accuracy;
uint32 accuracy = 0;

memset(&bin_sem_prop, 0, sizeof(bin_sem_prop));

task_1_timeouts = 0;
task_1_work = 0;
Expand Down
26 changes: 15 additions & 11 deletions src/tests/file-api-test/file-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void TestCreatRemove(void)
char maxfilename[OS_MAX_PATH_LEN];
char longfilename[OS_MAX_PATH_LEN + 10];
int32 status;
osal_id_t fd;
osal_id_t fd = OS_OBJECT_ID_UNDEFINED;
int i;

/* Short file name */
Expand Down Expand Up @@ -199,7 +199,7 @@ void TestOpenClose(void)
{
char filename[OS_MAX_PATH_LEN];
int32 status;
osal_id_t fd;
osal_id_t fd = OS_OBJECT_ID_UNDEFINED;

strncpy(filename, "/drive0/Filename1", sizeof(filename) - 1);
filename[sizeof(filename) - 1] = 0;
Expand Down Expand Up @@ -251,7 +251,7 @@ void TestChmod(void)
{
char filename[OS_MAX_PATH_LEN];
int32 status;
osal_id_t fd;
osal_id_t fd = OS_OBJECT_ID_UNDEFINED;

/*Make a file to test on. Start in Read only mode */
strncpy(filename, "/drive0/Filename1", sizeof(filename) - 1);
Expand Down Expand Up @@ -324,7 +324,9 @@ void TestReadWriteLseek(void)
size_t offset;
size_t size;
int32 status;
osal_id_t fd;
osal_id_t fd = OS_OBJECT_ID_UNDEFINED;

memset(newbuffer, 0, sizeof(newbuffer));

strncpy(filename, "/drive0/Filename1", sizeof(filename) - 1);
filename[sizeof(filename) - 1] = 0;
Expand Down Expand Up @@ -446,11 +448,13 @@ void TestMkRmDirFreeBytes(void)
char buffer2[OS_MAX_PATH_LEN];
char copybuffer1[OS_MAX_PATH_LEN];
char copybuffer2[OS_MAX_PATH_LEN];
osal_id_t fd1;
osal_id_t fd2;
osal_id_t fd1 = OS_OBJECT_ID_UNDEFINED;
osal_id_t fd2 = OS_OBJECT_ID_UNDEFINED;
size_t size;
OS_statvfs_t statbuf;

memset(&statbuf, 0, sizeof(statbuf));

/* make the directory names for testing, as well as the filenames and the buffers
* to put in the files */
strcpy(dir1, "/drive0/DIRECTORY_ONE");
Expand Down Expand Up @@ -561,9 +565,9 @@ void TestOpenReadCloseDir(void)
char buffer1[OS_MAX_PATH_LEN];
char buffer2[OS_MAX_PATH_LEN];
size_t size;
osal_id_t fd1;
osal_id_t fd2;
osal_id_t dirh;
osal_id_t fd1 = OS_OBJECT_ID_UNDEFINED;
osal_id_t fd2 = OS_OBJECT_ID_UNDEFINED;
osal_id_t dirh = OS_OBJECT_ID_UNDEFINED;
os_dirent_t dirent;

/* make the directory names for testing, as well as the filenames and the buffers
Expand Down Expand Up @@ -768,7 +772,7 @@ void TestRename(void)
char midname1[OS_MAX_PATH_LEN];
char newfilename1[OS_MAX_PATH_LEN];

osal_id_t fd1;
osal_id_t fd1 = OS_OBJECT_ID_UNDEFINED;
size_t size;

/* make the directory names for testing, as well as the filenames and the buffers
Expand Down Expand Up @@ -854,7 +858,7 @@ void TestStat(void)
char dir1slash[OS_MAX_PATH_LEN];
char buffer1[OS_MAX_PATH_LEN];
os_fstat_t StatBuff;
osal_id_t fd1;
osal_id_t fd1 = OS_OBJECT_ID_UNDEFINED;
size_t size;

strcpy(dir1, "/drive0/DirectoryName");
Expand Down
Loading

0 comments on commit 2864b25

Please sign in to comment.