Skip to content

Commit

Permalink
Merge pull request #2 from nasa-itc/nos3#88-cfs-upgrade
Browse files Browse the repository at this point in the history
nos3#88 - cFS Upgrade
  • Loading branch information
jlucas9 authored Aug 1, 2023
2 parents 6fceb13 + 949cbe3 commit 07c3ce7
Show file tree
Hide file tree
Showing 9 changed files with 1,594 additions and 0 deletions.
36 changes: 36 additions & 0 deletions fsw/nos-linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
######################################################################
#
# CMAKE build recipe for pc-linux PSP component
#
######################################################################

# This contains the fully platform-specific code to
# run CFE on this target.

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

# The _GNU_SOURCE directive is required to call non-posix APIs
# that are specific to the Linux/glibc environment.
# Code outside the pc-linux PSP should _not_ depend on this.
target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE
_GNU_SOURCE
$<TARGET_PROPERTY:psp_module_api,INTERFACE_COMPILE_DEFINITIONS>
)

target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE
inc
${NOSENGINE_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../../apps/hwlib/sim/inc
${CMAKE_CURRENT_SOURCE_DIR}/../../../osal/src/os/nos/inc
$<TARGET_PROPERTY:psp_module_api,INTERFACE_INCLUDE_DIRECTORIES>
)
Empty file added fsw/nos-linux/doc/.gitignore
Empty file.
148 changes: 148 additions & 0 deletions fsw/nos-linux/inc/cfe_psp_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
************************************************************************/

#ifndef CFE_PSP_CONFIG_H
#define CFE_PSP_CONFIG_H

#include "common_types.h"

#include <signal.h>
#include <time.h>
#include <pthread.h>

/*
** This define sets the number of memory ranges that are defined in the memory range definition
** table.
*/
#define CFE_PSP_MEM_TABLE_SIZE 10

/**
* This define sets the maximum number of exceptions
* that can be stored.
*
* It must always be a power of two.
*/
#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4
#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16

/*
* A random 32-bit value that is used as the "validity flag"
* of the PC-Linux boot record structure. This is simply
* a value that is unlikely to occur unless specifically set.
*/
#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984)
#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID)

/*
* The amount of time to wait for an orderly shutdown
* in the event of a call to CFE_PSP_Restart()
*
* If this expires, then an abnormal exit/abort() is triggered.
*/
#define CFE_PSP_RESTART_DELAY 10000

/* use the "USR1" signal to wake the idle thread when an exception occurs */
#define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1

/*
* The tick period that will be configured in the RTOS for the simulated
* time base, in microseconds. This in turn is used to drive the 1hz clock
* and other functions.
*
* To minimize jitter in the resulting callbacks, it should be an even
* divisor of 1000000 usec.
*
* Note - 10ms/100Hz is chosen to also allow this same timebase to be
* used to drive the CFS SCH minor frame callbacks in its default config.
*/
#define CFE_PSP_SOFT_TIMEBASE_PERIOD 10000

/*
** Global variables
*/

/*
** Typedef for the header structure on the reserved memory block
**
** Note that the structure below reserves memory sizes defined
** at compile time directly from cfe_platform_cfg.h above.
** A future enhancement should reserve blocks based on the runtime
** size in GLOBAL_CONFIGDATA.
*/
typedef struct
{
uint32 ValidityFlag;
uint32 NextResetType;
} CFE_PSP_ReservedMemoryBootRecord_t;

/*
* The state of the PSP "idle task"
*
* This is the main/initial thread that runs early init,
* it is NOT an OSAL task.
*
* Once initialized, this thread goes idle and waits for
* asynchronous events to occur, and resumes with an orderly
* shutdown if requested.
*/
typedef struct
{
pthread_t ThreadID;
volatile bool ShutdownReq;
} CFE_PSP_IdleTaskState_t;

/**
* \brief The data type used by the underlying OS to represent a thread ID.
*/
typedef pthread_t CFE_PSP_Exception_SysTaskId_t;

/**
* \brief Exception context data which is relevant for offline/post-mortem diagnosis.
*
* This may be stored in a persistent exception log file for later analysis.
*/
typedef struct
{
struct timespec event_time;
siginfo_t si;

/*
* Note this is a variably-filled array based on the number of addresses
* reported by the library. It should be last.
*/
void *bt_addrs[CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE];
} CFE_PSP_Exception_ContextDataEntry_t;

/*
** Watchdog minimum and maximum values ( in milliseconds )
*/
#define CFE_PSP_WATCHDOG_MIN (0)
#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF)

/*
** Number of EEPROM banks on this platform
*/
#define CFE_PSP_NUM_EEPROM_BANKS 1

/*
* Information about the "idle task" --
* this is used by exception handling to wake it when an event occurs
*/
extern CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState;

#endif
70 changes: 70 additions & 0 deletions fsw/nos-linux/inc/psp_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
************************************************************************/

/*! @file
* @brief Purpose:
* @details Provide version identifiers for the cFE Platform Support Packages (PSP).
* See @ref cfsversions for version and build number and description
*/
#ifndef PSP_VERSION_H
#define PSP_VERSION_H

/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 67
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4"

/*
* Version Macros, see \ref cfsversions for definitions.
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief Major version number */
#define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief Minor version number */
#define CFE_PSP_IMPL_REVISION 99 /*!< @brief Revision version number. Value of 99 indicates a development version.*/

/*!
* @brief Mission revision.
*
* Reserved for mission use to denote patches/customizations as needed.
* Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for
* cFS open-source development use (pending resolution of nasa/cFS#440)
*/
#define CFE_PSP_IMPL_MISSION_REV 0xFF

#define CFE_PSP_IMPL_CODENAME "Draco"

/*
* Tools to construct version string
*/
#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */
#define CFE_PSP_IMPL_STR(x) \
CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */

/*! @brief DEVELOPMENT Build Version Number.
* @details Baseline git tag + Number of commits since baseline. @n
* See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER)

/*! @brief DEVELOPMENT Build Version String.
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest
* official version. @n See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION_STRING \
" PSP NOS3 BUILD " CFE_PSP_IMPL_VERSION
#endif
18 changes: 18 additions & 0 deletions fsw/nos-linux/make/build_options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##########################################################################
#
# 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_")

set(CFE_PSP_EXPECTED_OSAL_BSPTYPE "nos-linux")

8 changes: 8 additions & 0 deletions fsw/nos-linux/psp_module_list.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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_notimpl
port_notimpl
ram_notimpl
#soft_timebase
#timebase_posix_clock
Loading

0 comments on commit 07c3ce7

Please sign in to comment.