Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #375, rename pc-rtems to generic-rtems #1

Open
wants to merge 5 commits into
base: fix375-generic_rtems
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/icbundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
sed -ir "s|#define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/pc-linux/inc/psp_version.h

buildnumber_entry=$'#define CFE_PSP_IMPL_BUILD_NUMBER '${rev_num}
sed -ir "s|#define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/pc-rtems/inc/psp_version.h
sed -ir "s|#define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/generic-rtems/inc/psp_version.h
- name: Commit and Push Updates to IC Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -76,6 +76,6 @@ jobs:
git add CHANGELOG.md
git add fsw/mcp750-vxworks/inc/psp_version.h
git add fsw/pc-linux/inc/psp_version.h
git add fsw/pc-rtems/inc/psp_version.h
git add fsw/generic-rtems/inc/psp_version.h
git commit -m "Updating documentation and version numbers for v1.6.0-rc4+dev${rev_num}"
git push -v origin integration-candidate
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
######################################################################
#
# CMAKE build recipe for pc-rtems PSP component
# CMAKE build recipe for generic-rtems PSP component
#
######################################################################

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

# Build the pc-rtems implementation as a library
# Build the generic-rtems implementation as a library
add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
src/cfe_psp_exception.c
src/cfe_psp_memory.c
Expand Down
14 changes: 7 additions & 7 deletions fsw/pc-rtems/README.txt → fsw/generic-rtems/README.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ABOUT THE PC-RTEMS CFE PSP
ABOUT THE GENERIC-RTEMS CFE PSP
==========================
Note: These instructions are for RTEMS 4.11

The "pc-rtems" PSP layer is intended to be an easy way to prove out the basic functionality
The "generic-rtems" PSP layer is intended to be an easy way to prove out the basic functionality
of CFE running on RTEMS without actually requiring a real hardware target with RTEMS support.

It is based on:
Expand Down Expand Up @@ -80,13 +80,13 @@ like this if not already present (prior to the "project()" function):
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH})


II. Mission setup modifications to use PC-RTEMS PSP
II. Mission setup modifications to use GENERIC-RTEMS PSP

Use a CMake toolchain file to build CFE for RTEMS. This goes under the mission's "_defs" top-level directory.
This example below may be edited and tuned to the mission-specific needs.

Specifically this file should be called "toolchain-<ARCHNAME>.cmake" where <ARCHNAME> can be anything such as
"cpu3" or "i686-pc-rtems".
"cpu3" or "i686-generic-rtems".

Then in the "targets.cmake" file set the "TGT<N>_PLATFORM" variable to be the same ARCHNAME and the toolchain
file will be picked up and used by the build system.
Expand All @@ -102,7 +102,7 @@ file will be picked up and used by the build system.
# Note that to use this, the "RTEMS" platform module may need to be added
# to the system-wide CMake installation as a default CMake does not yet
# recognize RTEMS as a system name. An example of this is distributed with
# the pc-rtems PSP.
# the generic-rtems PSP.

# Basic cross system configuration
set(CMAKE_SYSTEM_NAME RTEMS)
Expand Down Expand Up @@ -151,8 +151,8 @@ SET(CMAKE_PREFIX_PATH /)

# these settings are specific to cFE/OSAL and determines which
# abstraction layers are built when using this toolchain
SET(CFE_SYSTEM_PSPNAME pc-rtems)
SET(OSAL_SYSTEM_BSPTYPE pc-rtems)
SET(CFE_SYSTEM_PSPNAME generic-rtems)
SET(OSAL_SYSTEM_BSPTYPE generic-rtems)
SET(OSAL_SYSTEM_OSTYPE rtems)

# Info regarding the RELOCADDR:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ABOUT THE PC-RTEMS CFE PSP for RTEMS 5
ABOUT THE GENERIC-RTEMS CFE PSP for RTEMS 5
========================================

Note: These instructions are for RTEMS 5

The "pc-rtems" PSP layer is intended to be an easy way to prove out the basic functionality
The "generic-rtems" PSP layer is intended to be an easy way to prove out the basic functionality
of CFE running on RTEMS without actually requiring a real hardware target with RTEMS support.

It is based on:
Expand Down Expand Up @@ -78,13 +78,13 @@ like this if not already present (prior to the "project()" function):
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH})


II. Mission setup modifications to use PC-RTEMS PSP
II. Mission setup modifications to use GENERIC-RTEMS PSP

Use a CMake toolchain file to build CFE for RTEMS. This goes under the mission's "_defs" top-level directory.
This example below may be edited and tuned to the mission-specific needs.

Specifically this file should be called "toolchain-<ARCHNAME>.cmake" where <ARCHNAME> can be anything such as
"cpu3" or "i686-pc-rtems".
"cpu3" or "i686-generic-rtems".

Then in the "targets.cmake" file set the "TGT<N>_PLATFORM" variable to be the same ARCHNAME and the toolchain
file will be picked up and used by the build system.
Expand All @@ -99,7 +99,7 @@ file will be picked up and used by the build system.
# Note that to use this, the "RTEMS" platform module may need to be added
# to the system-wide CMake installation as a default CMake does not yet
# recognize RTEMS as a system name. An example of this is distributed with
# the pc-rtems PSP.
# the generic-rtems PSP.

# Basic cross system configuration
set(CMAKE_SYSTEM_NAME RTEMS)
Expand Down Expand Up @@ -153,8 +153,8 @@ SET(CMAKE_PREFIX_PATH /)

# these settings are specific to cFE/OSAL and determines which
# abstraction layers are built when using this toolchain
SET(CFE_SYSTEM_PSPNAME pc-rtems)
SET(OSAL_SYSTEM_BSPTYPE pc-rtems)
SET(CFE_SYSTEM_PSPNAME generic-rtems)
SET(OSAL_SYSTEM_BSPTYPE generic-rtems)
SET(OSAL_SYSTEM_OSTYPE rtems)

# This is for RTEMS 5 specific ifdefs needed by the OSAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*/
typedef struct
{
/* not currently used in PC-RTEMS */
/* not currently used in GENERIC-RTEMS */
uint32 reserved;
} CFE_PSP_ReservedMemoryBootRecord_t;

Expand All @@ -68,7 +68,7 @@ typedef rtems_id CFE_PSP_Exception_SysTaskId_t;
*
* This may be stored in a persistent exception log file for later analysis.
*
* On PC-RTEMS, this is reserved for future use. Exception handling is not
* On GENERIC-RTEMS, this is reserved for future use. Exception handling is not
* currently implemented.
*/
typedef struct
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
##########################################################################
#
# Build options for "pc-rtems" PSP
# Build options for "generic-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")
set(INSTALL_SUBDIR "nonvol")

# Some upper-level code may be gated on _RTEMS_OS_ being defined
# This is for compatibility with older build scripts which defined this symbol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef struct
*/
CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0};

CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock;
CFE_PSP_MemoryBlock_t GenericRtems_ReservedMemBlock;

/*
*********************************************************************************
Expand Down Expand Up @@ -330,16 +330,16 @@ void CFE_PSP_SetupReservedMemoryMap(void)

OS_printf("Size of BSP reserved memory = %u bytes\n", (unsigned int)RequiredSize);

PcRtems_ReservedMemBlock.BlockPtr = malloc(RequiredSize);
GenericRtems_ReservedMemBlock.BlockPtr = malloc(RequiredSize);

if (PcRtems_ReservedMemBlock.BlockPtr == NULL)
if (GenericRtems_ReservedMemBlock.BlockPtr == NULL)
{
OS_printf("CFE_PSP: Error: Cannot malloc BSP reserved memory!\n");
abort();
}

PcRtems_ReservedMemBlock.BlockSize = RequiredSize;
ReservedMemoryAddr = (cpuaddr)PcRtems_ReservedMemBlock.BlockPtr;
GenericRtems_ReservedMemBlock.BlockSize = RequiredSize;
ReservedMemoryAddr = (cpuaddr)GenericRtems_ReservedMemBlock.BlockPtr;

OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", (unsigned int)RequiredSize,
(unsigned long)ReservedMemoryAddr);
Expand Down Expand Up @@ -396,7 +396,7 @@ void CFE_PSP_SetupReservedMemoryMap(void)
int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType)
{
OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n");
memset(PcRtems_ReservedMemBlock.BlockPtr, 0, PcRtems_ReservedMemBlock.BlockSize);
memset(GenericRtems_ReservedMemBlock.BlockPtr, 0, GenericRtems_ReservedMemBlock.BlockSize);
return CFE_PSP_SUCCESS;
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
#include <errno.h>
#include <rtems.h>
#include <rtems/rtems_bsdnet.h>
#include <rtems/rtems_dhcp_failsafe.h>
#include <bsp.h>
/* TODO Only needed for network setup, move? */
//#include <rtems/rtems_dhcp_failsafe.h>
//#include <bsp.h>

extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching);

Expand Down Expand Up @@ -63,6 +64,8 @@ extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching)

rtems_id RtemsTimerId;

/* TODO in pc but not in generic... might be the only unique stuff? */
#if 0
static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61};
static char net_name_str[] = "fxp1";
static char ip_addr_str[] = "10.0.2.17";
Expand All @@ -78,9 +81,72 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
/* more options can follow */
};


struct rtems_bsdnet_config rtems_bsdnet_config = {
.ifconfig = &netdriver_config, .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/
};
#endif

#if RTEMS_INCLUDE_TARFS /* TODO Is there a better networking-related define we can use here? */

#include <grlib/network_interface_add.h>

/* TODO Remove these pragmas and fix warnings generated */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#pragma GCC diagnostic ignored "-Woverflow"

/*
* Network configuration
*/
/* TODO move to a separate file */
#include <rtems.h>
#include <bsp.h>

#include "bsp_rtems_cfg.h"

#include <drvmgr/drvmgr.h>

/* Configure Driver manager */
#if defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3) /* if --drvmgr was given to configure */
/* Add Timer and UART Driver for this example */
#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
#endif
#endif
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH /* TODO make dependent on OSAL NETWORK config */

#include <drvmgr/drvmgr_confdefs.h>

/* Set default IP and MAC if not defined */
#ifndef CONFIG_ETH_IP
#define CONFIG_ETH_IP "192.168.1.67"
#endif
#ifndef CONFIG_ETH_MAC
#define CONFIG_ETH_MAC {0x00, 0x80, 0x7F, 0x22, 0x61, 0x7A}
#endif

/* Table used by network interfaces that register themselves using the
* network_interface_add routine. From this table the IP address, netmask
* and Ethernet MAC address of an interface is taken.
*
* The network_interface_add routine puts the interface into the
* rtems_bsnet_config.ifconfig list.
*
* Set IP Address and Netmask to NULL to select BOOTP.
*/
struct ethernet_config interface_configs[] =
{
{ CONFIG_ETH_IP, "255.255.255.0", CONFIG_ETH_MAC}
};
#define INTERFACE_CONFIG_CNT (sizeof(interface_configs)/sizeof(struct ethernet_config) - 1)

#pragma GCC diagnostic pop

#endif

/*
** 1 HZ Timer "ISR"
Expand Down Expand Up @@ -112,6 +178,10 @@ int timer_count = 0;
*/
int CFE_PSP_Setup(void)
{

/* Only initialize the network if not using the rki2 */
#if RTEMS_INCLUDE_TARFS /* TODO Is there a better networking-related define? */

rtems_status_code status;

/*
Expand All @@ -123,6 +193,15 @@ int CFE_PSP_Setup(void)
{
printf("Network init not successful: %s / %s (continuing)\n", rtems_status_text(status), strerror(errno));
}
else
{
printf("Network initialized\n\n");
}
rtems_bsdnet_show_inet_routes();
printf("\n");
rtems_bsdnet_show_if_stats();
printf("\n");
#endif

return RTEMS_SUCCESSFUL;
}
Expand Down Expand Up @@ -200,7 +279,9 @@ void CFE_PSP_Main(void)
/*
** Set up the virtual FS mapping for the "/cf" directory
*/
Status = OS_FileSysAddFixedMap(&fs_id, "/mnt/eeprom", "/cf");
/* TODO maybe make this into a config... or just switch to nonvol */
// Status = OS_FileSysAddFixedMap(&fs_id, "/mnt/eeprom", "/cf");
Status = OS_FileSysAddFixedMap(&fs_id, "/nonvol", "/cf");
if (Status != OS_SUCCESS)
{
/* Print for informational purposes --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Track the overall "reserved memory block" at the start of RAM.
* This single large block is then subdivided into separate areas for CFE use.
*/
extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock;
extern CFE_PSP_MemoryBlock_t GenericRtems_ReservedMemBlock;

/*----------------------------------------------------------------
*
Expand All @@ -73,7 +73,7 @@ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock;
*-----------------------------------------------------------------*/
void CFE_PSP_Restart(uint32 resetType)
{
CFE_PSP_FlushCaches(1, PcRtems_ReservedMemBlock.BlockPtr, PcRtems_ReservedMemBlock.BlockSize);
CFE_PSP_FlushCaches(1, GenericRtems_ReservedMemBlock.BlockPtr, GenericRtems_ReservedMemBlock.BlockSize);
OS_printf("%s is not implemented on this platform ( yet ! )\n", __func__);
exit(EXIT_FAILURE);
}
Expand Down
2 changes: 1 addition & 1 deletion unit-test-coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

project(PSPCOVERAGE C)

set(PSPCOVERAGE_TARGETS mcp750-vxworks pc-rtems CACHE STRING "PSP target(s) to build coverage tests for (default=all)")
set(PSPCOVERAGE_TARGETS mcp750-vxworks generic-rtems CACHE STRING "PSP target(s) to build coverage tests for (default=all)")

# Check that coverage has been implemented for this PSPTYPE
foreach(PSPTYPE ${PSPCOVERAGE_TARGETS})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
######################################################################
#
# CMake build recipe for pc-rtems PSP white-box coverage tests
# CMake build recipe for generic-rtems PSP white-box coverage tests
#
######################################################################

include_directories(${CFEPSP_SOURCE_DIR}/fsw/pc-rtems/inc)
include_directories(${CFEPSP_SOURCE_DIR}/fsw/generic-rtems/inc)
include_directories(${PSPCOVERAGE_SOURCE_DIR}/shared/inc)

# Target names use a "ut" prefix to avoid confusion with the FSW targets
Expand All @@ -29,7 +29,7 @@ add_executable(coverage-${CFE_PSP_TARGETNAME}-testrunner
src/coveragetest-cfe-psp-start.c
src/coveragetest-cfe-psp-support.c
src/coveragetest-cfe-psp-watchdog.c
src/coveragetest-psp-pc-rtems.c
src/coveragetest-psp-generic-rtems.c
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-shared>
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-impl>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
************************************************************************/

#include "coveragetest-psp-pc-rtems.h"
#include "coveragetest-psp-generic-rtems.h"

#include "cfe_psp.h"
#include "PCS_stdlib.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
************************************************************************/

#include "coveragetest-psp-pc-rtems.h"
#include "coveragetest-psp-generic-rtems.h"

#include "cfe_psp.h"
#include "PCS_stdlib.h"
Expand Down
Loading