Skip to content

Commit

Permalink
Merge pull request #1257 from acudmore/fix-1256-add-rtems-6-support
Browse files Browse the repository at this point in the history
Fix #1256, add rtems 6 support
  • Loading branch information
astrogeco committed May 31, 2022
2 parents acb88ca + cae3e49 commit 85dec4c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
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
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

0 comments on commit 85dec4c

Please sign in to comment.