Skip to content

Commit

Permalink
Merge pull request #273 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
psp Integration Candidate: 2021-03-23
  • Loading branch information
astrogeco authored Mar 22, 2021
2 parents 0f39a13 + b123498 commit 73366d4
Show file tree
Hide file tree
Showing 109 changed files with 249 additions and 155 deletions.
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,39 @@ target_include_directories(psp_module_api INTERFACE
$<TARGET_PROPERTY:osal,INTERFACE_INCLUDE_DIRECTORIES> # use headers from OSAL
)

# Translate the CFE_PSP_TARGETNAME to a set of additional modules to build
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_module_list.cmake" PSP_TARGET_MODULE_LIST REGEX "^[a-zA-Z]")

# The PSP is currently built in two parts, consisting of a fully platform-specific
# module combined with a shared component which is built for multiple targets.
# The PSP is currently built in modular parts, consisting of a platform-specific
# module(s) combined with a shared component which is built for multiple targets.
# The "shared" component is compiled using headers from the platform-specific module
# so it is still ultimately a platform-specific binary, and it all gets wrapped into
# a single PSP static library target.
add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl)
add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared)

# Generate a list of PSP modules along with a pointer to its API structure/entry point
set(GENERATED_EXTERNS)
set(GENERATED_KEYVALS)
foreach(PSPMOD ${PSP_TARGET_MODULE_LIST})
add_subdirectory(fsw/modules/${PSPMOD} ${PSPMOD}-${CFE_PSP_TARGETNAME}-impl)
list(APPEND GENERATED_EXTERNS "extern CFE_PSP_ModuleApi_t CFE_PSP_${PSPMOD}_API;\n")
list(APPEND GENERATED_KEYVALS "{ .Name = \"${PSPMOD}\", .Api = &CFE_PSP_${PSPMOD}_API },\n")
endforeach()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/module_list.c.in ${CMAKE_CURRENT_BINARY_DIR}/${CFE_PSP_TARGETNAME}_module_list.c @ONLY)

add_library(psp-${CFE_PSP_TARGETNAME} STATIC
${CMAKE_CURRENT_BINARY_DIR}/${CFE_PSP_TARGETNAME}_module_list.c
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-shared>
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-impl>
)
target_link_libraries(psp-${CFE_PSP_TARGETNAME} PUBLIC
${PSP_TARGET_MODULE_LIST}
)
target_link_libraries(psp-${CFE_PSP_TARGETNAME} PRIVATE
psp_module_api
)

target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE
fsw/inc
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing Guide

Please see our [top-level contributing guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md) for more information on how to contribute.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ This is a collection of APIs abstracting platform specific functionality to be l

## Version History

### Development Build: v1.5.0-rc1+dev90

- Addresses the issue of incompatible/non-portable code blobs in the "shared" directory. It uses the same modular init pattern as is used elsewhere in cFE: CMake generates a list of "base" modules correlating with the selected PSP (i.e. pc-linux, mcp750-vxworks, etc) and these modules are then initialized (in order) before the rest of PSP runs. The "direct write" EEPROM is not used unconditionally. Instead the proper eeprom implementation module is selected based on which PSP is selected. MCP750 uses direct write, pc-linux uses an mmap file, and pc-rtems uses a stub (not implemented).
- Replaces " used on non-system header #includes with <>
- Adds a contributing guide that links to the main cFS contributing guide.
- See <https://github.com/nasa/PSP/pull/273>


### Development Build: v1.5.0-rc1+dev82

- HOTFIX 20210312, updates to work with older CMake
Expand Down
12 changes: 12 additions & 0 deletions cmake/module_list.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* This file is generated via CMake - do not edit in place */
#include "cfe_psp_module.h"

@GENERATED_EXTERNS@

CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[] =
{
@GENERATED_KEYVALS@
{ NULL }
};

/* END OF FILE */
4 changes: 2 additions & 2 deletions fsw/inc/cfe_psp_configdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#define CFE_PSP_CONFIG_H_

/* osapi.h is required for the definition of OS_VolumeInto_t */
#include <osapi.h>
#include "osapi.h"
/* cfe_psp.h is required for the definition of CFE_PSP_MemTable_t */
#include <cfe_psp.h>
#include "cfe_psp.h"

/*
** PSP software version record
Expand Down
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 @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 82
#define CFE_PSP_IMPL_BUILD_NUMBER 90
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
4 changes: 4 additions & 0 deletions fsw/mcp750-vxworks/psp_module_list.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a list of modules that is included as a fixed/base set
# when this PSP is selected. They must exist under fsw/modules

eeprom_direct
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/src/cfe_psp_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include "cfe_psp_exceptionstorage_api.h"
#include "cfe_psp_memory.h"

#include <target_config.h>
#include "target_config.h"

/*
**
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include "cfe_psp.h"
#include "cfe_psp_memory.h"

#include <target_config.h>
#include "target_config.h"

/*
** External Declarations
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ IMPORT void sysPciWrite32(UINT32, UINT32);
* the dynamically generated configuration object. This allows a single build
* of the PSP to be completely CFE-independent.
*/
#include <target_config.h>
#include "target_config.h"

#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain)
#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile)
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/src/cfe_psp_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include "cfe_psp.h"
#include "cfe_psp_memory.h"

#include <target_config.h>
#include "target_config.h"

#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId)
#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName)
Expand Down
3 changes: 3 additions & 0 deletions fsw/modules/eeprom_direct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Create the module
add_psp_module(eeprom_direct cfe_psp_eeprom_direct.c)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
#include <stdio.h>

#include "cfe_psp.h"
#include "cfe_psp_module.h"

CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_direct);

void eeprom_direct_Init(uint32 PspModuleId)
{
/* Inform the user that this module is in use */
printf("CFE_PSP: Using DIRECT memory mapped EEPROM implementation\n");
}

/*
** global memory
Expand Down
6 changes: 5 additions & 1 deletion fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ void eeprom_mmap_file_Init(uint32 PspModuleId)
cpuaddr eeprom_address;
uint32 eeprom_size;

/* Inform the user that this module is in use */
printf("CFE_PSP: Using MMAP simulated EEPROM implementation\n");

/*
** Create the simulated EEPROM segment by mapping a memory segment to a file.
** Since the file will be saved, the "EEPROM" contents will be preserved.
Expand All @@ -187,7 +190,8 @@ void eeprom_mmap_file_Init(uint32 PspModuleId)
/*
** Install the 2nd memory range as the mapped file ( EEPROM )
*/
Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, 0);
Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD,
CFE_PSP_MEM_ATTR_READWRITE);
OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n",
(unsigned long)eeprom_address, (unsigned int)eeprom_size, Status);
}
Expand Down
3 changes: 2 additions & 1 deletion fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_stub);

void eeprom_stub_Init(uint32 PspModuleId)
{
/* Nothing to init */
/* Inform the user that this module is in use */
printf("CFE_PSP: Using STUB EEPROM implementation\n");
}

int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value)
Expand Down
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 @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 82
#define CFE_PSP_IMPL_BUILD_NUMBER 90
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
4 changes: 4 additions & 0 deletions fsw/pc-linux/psp_module_list.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a list of modules that is included as a fixed/base set
# when this PSP is selected. They must exist under fsw/modules

eeprom_mmap_file
2 changes: 1 addition & 1 deletion fsw/pc-linux/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#define CFE_PSP_RESET_KEY_FILE ".resetkeyfile"
#define CFE_PSP_RESERVED_KEY_FILE ".reservedkeyfile"

#include <target_config.h>
#include "target_config.h"

/*
* Define the PSP-supported capacities to be the maximum allowed,
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-linux/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* the dynamically generated configuration object. This allows a single build
* of the PSP to be completely CFE-independent.
*/
#include <target_config.h>
#include "target_config.h"
#include "cfe_psp_module.h"

#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain)
Expand Down
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 @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 82
#define CFE_PSP_IMPL_BUILD_NUMBER 90
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
4 changes: 4 additions & 0 deletions fsw/pc-rtems/psp_module_list.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a list of modules that is included as a fixed/base set
# when this PSP is selected. They must exist under fsw/modules

eeprom_stub
2 changes: 1 addition & 1 deletion fsw/pc-rtems/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/*
** Macro Definitions
*/
#include <target_config.h>
#include "target_config.h"

/*
* Define the PSP-supported capacities to be the maximum allowed,
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-rtems/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
* the dynamically generated configuration object. This allows a single build
* of the PSP to be completely CFE-independent.
*/
#include <target_config.h>
#include "target_config.h"

#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain)
#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile)
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-rtems/src/cfe_psp_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* the dynamically generated configuration object. This allows a single build
* of the PSP to be completely CFE-independent.
*/
#include <target_config.h>
#include "target_config.h"

#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId)
#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName)
Expand Down
1 change: 0 additions & 1 deletion fsw/shared/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# Build the shared implementation as a library
add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT
src/cfe_psp_configdata.c
src/cfe_psp_eeprom.c
src/cfe_psp_exceptionstorage.c
src/cfe_psp_memrange.c
src/cfe_psp_memutils.c
Expand Down
2 changes: 1 addition & 1 deletion fsw/shared/inc/cfe_psp_exceptionstorage_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#ifndef CFE_PSP_EXCEPTIONSTORAGE_API_H_
#define CFE_PSP_EXCEPTIONSTORAGE_API_H_

#include <cfe_psp.h>
#include "cfe_psp.h"

/*
* Abstract types for exception storage.
Expand Down
4 changes: 2 additions & 2 deletions fsw/shared/inc/cfe_psp_exceptionstorage_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#ifndef CFE_PSP_EXCEPTIONSTORAGE_TYPES_H_
#define CFE_PSP_EXCEPTIONSTORAGE_TYPES_H_

#include <cfe_psp.h>
#include <cfe_psp_config.h>
#include "cfe_psp.h"
#include "cfe_psp_config.h"

/*
* The "MetaData" stores ephemeral exception information
Expand Down
11 changes: 9 additions & 2 deletions fsw/shared/inc/cfe_psp_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#ifndef CFE_PSP_MODULE_H_
#define CFE_PSP_MODULE_H_

#include <cfe_psp.h>
#include <target_config.h>
#include "cfe_psp.h"
#include "target_config.h"

typedef enum
{
Expand Down Expand Up @@ -111,4 +111,11 @@ int32 CFE_PSP_Module_FindByName(const char *ModuleName, uint32 *PspModuleId);
*/
int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API);

/**
* \brief A list of fixed/base modules associated with the PSP
*
* This list should be generated by the build system based on the user-selected PSP
*/
extern CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[];

#endif /* CFE_PSP_MODULE_H_ */
8 changes: 4 additions & 4 deletions fsw/shared/src/cfe_psp_configdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* Author: [email protected]
*/

#include <cfe_psp.h>
#include <cfe_psp_config.h>
#include <psp_version.h>
#include <cfe_psp_configdata.h>
#include "cfe_psp.h"
#include "cfe_psp_config.h"
#include "psp_version.h"
#include "cfe_psp_configdata.h"

/**
* Instantiation of the PSP/HW configuration data
Expand Down
2 changes: 1 addition & 1 deletion fsw/shared/src/cfe_psp_exceptionstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "cfe_psp_exceptionstorage_api.h"
#include "cfe_psp_memory.h"

#include <target_config.h>
#include "target_config.h"

/*
** Constants
Expand Down
24 changes: 19 additions & 5 deletions fsw/shared/src/cfe_psp_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <stdio.h>
#include <string.h>
#include <osapi.h>
#include "osapi.h"

#include "cfe_psp_configdata.h"
#include "cfe_psp_module.h"
Expand All @@ -47,19 +47,19 @@
static uint32 CFE_PSP_ModuleCount = 0;

/***************************************************
* Function Name: CFE_PSP_ModuleInit
* Function Name: CFE_PSP_ModuleInitList
*
* See prototype for full description
* Helper function to initalize a list of modules (not externally called)
*/
void CFE_PSP_ModuleInit(void)
void CFE_PSP_ModuleInitList(CFE_StaticModuleLoadEntry_t *ListPtr)
{
CFE_StaticModuleLoadEntry_t *Entry;
CFE_PSP_ModuleApi_t * ApiPtr;

/*
* Call the init function for all statically linked modules
*/
Entry = GLOBAL_CONFIGDATA.PspModuleList;
Entry = ListPtr;
if (Entry != NULL)
{
while (Entry->Name != NULL)
Expand All @@ -75,6 +75,20 @@ void CFE_PSP_ModuleInit(void)
}
}

/***************************************************
* Function Name: CFE_PSP_ModuleInit
*
* See prototype for full description
*/
void CFE_PSP_ModuleInit(void)
{
/* First initialize the fixed set of modules for this PSP */
CFE_PSP_ModuleInitList(CFE_PSP_BASE_MODULE_LIST);

/* Then initialize any user-selected extension modules */
CFE_PSP_ModuleInitList(GLOBAL_CONFIGDATA.PspModuleList);
}

/***************************************************
* Function Name: CFE_PSP_Module_GetAPIEntry
*
Expand Down
4 changes: 2 additions & 2 deletions fsw/shared/src/cfe_psp_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* Defines API that obtains the values of the various version identifiers
*/

#include <cfe_psp.h>
#include <cfe_psp_configdata.h>
#include "cfe_psp.h"
#include "cfe_psp_configdata.h"

/*----------------------------------------------------------------
*
Expand Down
Loading

0 comments on commit 73366d4

Please sign in to comment.