Skip to content

Commit

Permalink
Merge pull request #153 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-04-08
  • Loading branch information
astrogeco authored Apr 20, 2020
2 parents 12e2607 + c7e4ce4 commit 27063c0
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 269 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ if (NOT CFE_SYSTEM_PSPNAME)
message(FATAL_ERROR "CFE_SYSTEM_PSPNAME is not defined - do not know which to build")
endif()

if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fsw/${CFE_SYSTEM_PSPNAME})
message(FATAL_ERROR "PSP ${CFE_SYSTEM_PSPNAME} is not implemented")
endif()

add_definitions(-D_CFE_PSP_)
include_directories(fsw/${CFE_SYSTEM_PSPNAME}/inc)

include_directories(fsw/shared)

# Use all source files under the shared code directory (always)
# as well as all the files for the selected PSP
set(PSPFILES)
aux_source_directory(fsw/shared PSPFILES)
aux_source_directory(fsw/${CFE_SYSTEM_PSPNAME}/src PSPFILES)

add_library(psp-${CFE_SYSTEM_PSPNAME} STATIC ${PSPFILES})
# Build the PSP implementation which lies in a system-specific subdirectory
include_directories(fsw/${CFE_SYSTEM_PSPNAME}/inc)
add_subdirectory(fsw/${CFE_SYSTEM_PSPNAME} ${CFE_SYSTEM_PSPNAME})

# Build the "common" parts as a library
add_library(psp-${CFE_SYSTEM_PSPNAME} STATIC
fsw/shared/cfe_psp_configdata.c
fsw/shared/cfe_psp_eeprom.c
fsw/shared/cfe_psp_memrange.c
fsw/shared/cfe_psp_memutils.c
fsw/shared/cfe_psp_module.c
fsw/shared/cfe_psp_port.c
fsw/shared/cfe_psp_ram.c
$<TARGET_OBJECTS:psp-${CFE_SYSTEM_PSPNAME}-impl>)

if (ENABLE_UNIT_TESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/fsw/ut-stubs)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This is a collection of APIs abstracting platform specific functionality to be l

## Version Notes

- 1.4.9 DEVELOPMENT
- RTEMS builds successfully without errors
- Build script uses a proper CMakeLists.txt instead of the aux_source directory
- Minor updates (see https://github.com/nasa/PSP/pull/153)
- 1.4.8 DEVELOPMENT
- Minor updates (see https://github.com/nasa/PSP/pull/151)
- 1.4.7 DEVELOPMENT
Expand Down
56 changes: 33 additions & 23 deletions cmake/Modules/Platform/RTEMS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Note - RTEMS does not support "shared libs" in the traditional sense,
# but it does have a loader that does static linking at runtime.
# This property is set true which allows one to use the CMake shared library logic
# But the code is otherwise built as static -- no PIC flags
# But the code is otherwise built as static -- no PIC flags
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
set(CMAKE_EXECUTABLE_SUFFIX ".exe")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".obj")
Expand All @@ -24,6 +24,20 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
set(CMAKE_SHARED_MODULE_C_FLAGS "")
set(CMAKE_SHARED_MODULE_CXX_FLAGS "")

# Set the CMAKE_EXE_EXPORTS_C_FLAG which is for executables
# using dynamic loading/linking
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")


# Include the system specs directly within the COMPILE_OBJECT definitions
# This way it does not need to be done via CMAKE_C_FLAGS and it simplifies
# the process in general.
set(RTEMS_SYS_SPECS_FLAGS "-B${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib -specs bsp_specs -qrtems")

# Basic command templates for compiling C and C++ code
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_CXX_FLAGS} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")


# This creates a simple relocatable object file, not a shared library
set(CMAKE_SHARED_OBJECT_LINKER_FLAGS -r)
Expand All @@ -32,47 +46,43 @@ set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})
set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE})
set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE})

# Additional link flags for entry point and relocation address
# RTEMS uses "Init" rather than "main" as its entry point
# This flag ensures that the Init symbol is not dropped at link time.
set(RTEMS_SYS_LINKFLAGS "-u Init")
if (RTEMS_RELOCADDR)
set(RTEMS_SYS_LINKFLAGS "${RTEMS_SYS_LINKFLAGS} -Wl,-Ttext,${RTEMS_RELOCADDR}")
endif (RTEMS_RELOCADDR)

# The link procedure to support dynamic loading using the RTEMS dlopen()
# First create a "prelink" executable using a typical link procedure
# Then run "rtems-syms" and re-link the output into a final executable
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> <FLAGS> -o <TARGET>-prelink <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>"
"<CMAKE_C_COMPILER> ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} <FLAGS> ${RTEMS_SYS_LINKFLAGS} -o <TARGET>-prelink <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>"
"${RTEMS_TOOLS_PREFIX}/bin/rtems-syms -v -e -c ${RTEMS_BSP_C_FLAGS} -C <CMAKE_C_COMPILER> -o <TARGET>-dl-sym.o <TARGET>-prelink"
"<CMAKE_C_COMPILER> <FLAGS> -o <TARGET> <TARGET>-dl-sym.o <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
"<CMAKE_C_COMPILER> ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} <FLAGS> ${RTEMS_SYS_LINKFLAGS} -o <TARGET> <TARGET>-dl-sym.o <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")

set(RTEMS_TARGET_PATH
set(RTEMS_TARGET_PATH
"${RTEMS_BSP_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}")
set(RTEMS_TOOLS_PATH

set(RTEMS_TOOLS_PATH
"${RTEMS_TOOLS_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}")

set(CMAKE_FIND_ROOT_PATH
"${RTEMS_TARGET_PATH}/${RTEMS_BSP}"
"${RTEMS_TARGET_PATH}/${RTEMS_BSP}"
"${RTEMS_TOOLS_PATH}")
set(CMAKE_SYSTEM_PREFIX_PATH

set(CMAKE_SYSTEM_PREFIX_PATH
${CMAKE_FIND_ROOT_PATH})

set(CMAKE_SYSTEM_INCLUDE_PATH
"${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib/include"
"${RTEMS_TOOLS_PATH}/include")

set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_SYSTEM_INCLUDE_PATH})
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_SYSTEM_INCLUDE_PATH})
set(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib")
set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES})

set(CMAKE_C_FLAGS_INIT
"-B${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib -specs bsp_specs -qrtems ${RTEMS_BSP_C_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT
"-B${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib -specs bsp_specs -qrtems ${RTEMS_BSP_CXX_FLAGS}")

# RTEMS uses "Init" rather than "main" as its entry point
# This flag ensures that the Init symbol is not dropped at link time.
set(CMAKE_EXE_LINKER_FLAGS_INIT "-u Init")
if (RTEMS_RELOCADDR)
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} -Wl,-Ttext,${RTEMS_RELOCADDR}")
endif (RTEMS_RELOCADDR)

set(RTEMS TRUE)
set(UNIX TRUE)
13 changes: 13 additions & 0 deletions fsw/mcp750-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Build the mcp750-vxworks implementation as a library
add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT
src/cfe_psp_exception.c
src/cfe_psp_memory.c
src/cfe_psp_memtab.c
src/cfe_psp_ssr.c
src/cfe_psp_start.c
src/cfe_psp_support.c
src/cfe_psp_timer.c
src/cfe_psp_voltab.c
src/cfe_psp_watchdog.c)

2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 1
#define CFE_PSP_IMPL_MINOR_VERSION 4
#define CFE_PSP_IMPL_REVISION 8
#define CFE_PSP_IMPL_REVISION 9
#define CFE_PSP_IMPL_MISSION_REV 0

#endif /* _psp_version_ */
17 changes: 11 additions & 6 deletions fsw/mcp750-vxworks/make/build_options.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
##########################################################################
#
# Build options for "mcp750-vxworks" PSP
# This file specifies any global-scope compiler options when using this PSP
#
##########################################################################

# This indicates where to install target binaries created during the build
# Note - this should be phased out in favor of the staging dir from OSAL BSP
set(INSTALL_SUBDIR "cf")

# Additional preprocessor macro definitions to identify this platform
# Some upper-level code may be gated on _VXWORKS_OS_ being defined
# This is for compatibility with older build scripts which defined this symbol,
# but no CFE/OSAL framework code depends on this symbol.
add_definitions("-D_VXWORKS_OS_")
add_definitions("-D__PPC__")
add_definitions("-DMCP750")

include_directories($ENV{WIND_BASE}/target/h)
include_directories($ENV{WIND_BASE}/target/h/wrn/coreip)
include_directories($ENV{WIND_BASE}/target/config/mcp750)
25 changes: 21 additions & 4 deletions fsw/mcp750-vxworks/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,18 @@ IMPORT void sysPciWrite32 (UINT32, UINT32);


/******************************************************************************
** Function: CFE_PSP_Main()
** Function: OS_Application_Startup()
**
** Purpose:
** vxWorks/BSP Application entry point.
** Application startup entry point from OSAL BSP.
**
** Arguments:
** (none)
**
** Return:
** (none)
*/

void CFE_PSP_Main( void )
void OS_Application_Startup(void)
{
int TicksPerSecond;
uint32 reset_type;
Expand Down Expand Up @@ -216,6 +215,24 @@ void CFE_PSP_Main( void )
*/
CFE_PSP_MAIN_FUNCTION(reset_type,reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE);

}

/******************************************************************************
** Function: OS_Application_Run()
**
** Purpose:
** Idle Loop entry point from OSAL BSP.
**
** Arguments:
** (none)
**
** Return:
** (none)
*/
void OS_Application_Run(void)
{
int TicksPerSecond;

/*
** Main loop for default task and simulated 1hz
*/
Expand Down
13 changes: 13 additions & 0 deletions fsw/pc-linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Build the pc-linux implementation as a library
add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT
src/cfe_psp_exception.c
src/cfe_psp_memory.c
src/cfe_psp_memtab.c
src/cfe_psp_ssr.c
src/cfe_psp_start.c
src/cfe_psp_support.c
src/cfe_psp_timer.c
src/cfe_psp_voltab.c
src/cfe_psp_watchdog.c)

2 changes: 1 addition & 1 deletion fsw/pc-linux/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 1
#define CFE_PSP_IMPL_MINOR_VERSION 4
#define CFE_PSP_IMPL_REVISION 8
#define CFE_PSP_IMPL_REVISION 9
#define CFE_PSP_IMPL_MISSION_REV 0

#endif /* _psp_version_ */
10 changes: 10 additions & 0 deletions fsw/pc-linux/make/build_options.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
##########################################################################
#
# Build options for "pc-linux" PSP
# This file specifies any global-scope compiler options when using this PSP
#
##########################################################################

# This indicates where to install target binaries created during the build
# Note - this should be phased out in favor of the staging dir from OSAL BSP
set(INSTALL_SUBDIR "cf")

# Some upper-level code may be gated on _LINUX_OS_ being defined
# This is for compatibility with older build scripts which defined this symbol,
# but no CFE/OSAL framework code depends on this symbol.
add_definitions("-D_LINUX_OS_")

13 changes: 9 additions & 4 deletions fsw/pc-linux/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static const struct option longOpts[] = {
** Return:
** (none)
*/
int main(int argc, char *argv[])
void OS_Application_Startup(void)
{
uint32 reset_type;
uint32 reset_subtype;
Expand All @@ -166,6 +166,8 @@ int main(int argc, char *argv[])
int opt = 0;
int longIndex = 0;
int32 Status;
char * const * argv;
int argc;

/*
** Initialize the CommandData struct
Expand All @@ -176,6 +178,8 @@ int main(int argc, char *argv[])
** Process the arguments with getopt_long(), then
** start the cFE
*/
argc = OS_BSP_GetArgC();
argv = OS_BSP_GetArgV();
opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
while( opt != -1 )
{
Expand Down Expand Up @@ -356,6 +360,10 @@ int main(int argc, char *argv[])
CFE_PSP_SetupLocal1Hz();
}

}

void OS_Application_Run(void)
{
/*
** Let the main thread sleep.
**
Expand All @@ -377,9 +385,6 @@ int main(int argc, char *argv[])
OS_printf(" with a Poweron Reset ( --reset PO ). \n");

OS_DeleteAllObjects();


return(0);
}

/******************************************************************************
Expand Down
13 changes: 13 additions & 0 deletions fsw/pc-rtems/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Build the pc-rtems implementation as a library
add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT
src/cfe_psp_exception.c
src/cfe_psp_memory.c
src/cfe_psp_memtab.c
src/cfe_psp_ssr.c
src/cfe_psp_start.c
src/cfe_psp_support.c
src/cfe_psp_timer.c
src/cfe_psp_voltab.c
src/cfe_psp_watchdog.c)

2 changes: 1 addition & 1 deletion fsw/pc-rtems/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 1
#define CFE_PSP_IMPL_MINOR_VERSION 4
#define CFE_PSP_IMPL_REVISION 8
#define CFE_PSP_IMPL_REVISION 9
#define CFE_PSP_IMPL_MISSION_REV 0

#endif /* _psp_version_ */
14 changes: 14 additions & 0 deletions fsw/pc-rtems/make/build_options.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
##########################################################################
#
# Build options for "pc-rtems" PSP
# This file specifies any global-scope compiler options when using this PSP
#
##########################################################################

# This indicates where to install target binaries created during the build
# Note - this should be phased out in favor of the staging dir from OSAL BSP
set(INSTALL_SUBDIR "eeprom")

# Some upper-level code may be gated on _RTEMS_OS_ being defined
# This is for compatibility with older build scripts which defined this symbol,
# but no CFE/OSAL framework code depends on this symbol.
add_definitions("-D_RTEMS_OS_")


Loading

0 comments on commit 27063c0

Please sign in to comment.