-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1457 from nasa/integration-candidate
osal Integration candidate: Equuleus-rc1+dev9
- Loading branch information
Showing
18 changed files
with
1,108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
###################################################################### | ||
# | ||
# CMAKE build recipe for GENERIC-RTEMS Board Support Package (BSP) | ||
# | ||
###################################################################### | ||
|
||
# Basic set of files | ||
set(OS_BSP_SRCLIST | ||
src/bsp_console.c | ||
src/bsp_init.c | ||
src/bsp_start.c | ||
) | ||
|
||
# Source select file system setup implementation | ||
if (RTEMS_INCLUDE_TARFS) | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_tarfs_setupfs.c | ||
) | ||
else () | ||
# NOTE: rtems config needs to define supporting configuration (FILESYSTEM and DRIVERs) | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_mount_setupfs.c | ||
) | ||
endif () | ||
|
||
# Link rtemscpu to osal public api if not dynamic loading | ||
if (NOT RTEMS_DYNAMIC_LOAD) | ||
target_link_libraries(osal_public_api INTERFACE | ||
rtemscpu | ||
) | ||
endif () | ||
|
||
if (RTEMS_NO_SHELL) | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_no_shell.c | ||
) | ||
else () | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_shell.c | ||
) | ||
endif () | ||
|
||
if (RTEMS_NO_CMDLINE) | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_no_cmdline.c | ||
) | ||
else () | ||
list(APPEND OS_BSP_SRCLIST | ||
src/bsp_cmdline.c | ||
) | ||
endif () | ||
|
||
add_library(osal_generic-rtems_impl OBJECT | ||
${OS_BSP_SRCLIST} | ||
) | ||
|
||
# This definition is needed for the gethostname call | ||
# By defining this, it avoids the need to use the -std=gnu99 | ||
# instead of the preferred -std=c99 GCC switch | ||
target_compile_definitions(osal_public_api INTERFACE | ||
_BSD_SOURCE | ||
) | ||
|
||
set_property(TARGET osal_generic-rtems_impl PROPERTY OSAL_EXPECTED_OSTYPE "rtems") | ||
|
||
# The list of header files that control configuration | ||
set(BSP_RTEMS_CONFIG_FILE_LIST | ||
bsp_rtems_cfg.h | ||
) | ||
|
||
# Create wrappers around all the config header files | ||
# This makes them individually overridable by the missions, without modifying | ||
# the distribution default copies | ||
foreach(BSP_RTEMS_CFGFILE ${BSP_RTEMS_CONFIG_FILE_LIST}) | ||
get_filename_component(CFGKEY "${BSP_RTEMS_CFGFILE}" NAME_WE) | ||
if (DEFINED BSP_RTEMS_CFGFILE_SRC_${CFGKEY}) | ||
set(DEFAULT_SOURCE GENERATED_FILE "${BSP_RTEMS_CFGFILE_SRC_${CFGKEY}}") | ||
else() | ||
set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${BSP_RTEMS_CFGFILE}") | ||
endif() | ||
generate_config_includefile( | ||
FILE_NAME "${BSP_RTEMS_CFGFILE}" | ||
${DEFAULT_SOURCE} | ||
) | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/************************************************************************ | ||
* 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 | ||
* Default RTEMS OS Configuration definitions | ||
* | ||
* @note | ||
* This file may be overridden/superseded by mission-provided definitions | ||
* by overriding this header. | ||
*/ | ||
#ifndef BSP_RTEMS_CFG_H | ||
#define BSP_RTEMS_CFG_H | ||
|
||
#include "osconfig.h" | ||
|
||
#define TASK_INTLEVEL 0 | ||
#define CONFIGURE_INIT | ||
#define CONFIGURE_INIT_TASK_ATTRIBUTES \ | ||
(RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL)) | ||
#define CONFIGURE_INIT_TASK_STACK_SIZE (20 * 1024) | ||
#define CONFIGURE_INIT_TASK_PRIORITY 10 | ||
|
||
/* | ||
* Note that these resources are shared with RTEMS itself (e.g. the init task, the shell) | ||
* so they should be allocated slightly higher than the user limits in osconfig.h | ||
* | ||
* Many RTEMS services use tasks internally, including the idle task, BSWP, ATA driver, | ||
* low level console I/O, the shell, TCP/IP network stack, and DHCP (if enabled). | ||
* Many of these also use semaphores for synchronization. | ||
* | ||
* Budgeting for additional: | ||
* 8 internal tasks | ||
* 2 internal timers | ||
* 4 internal queues | ||
* 16 internal semaphores | ||
* | ||
*/ | ||
#define CONFIGURE_MAXIMUM_TASKS (OS_MAX_TASKS + 8) | ||
#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2) | ||
#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16) | ||
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4) | ||
#define CONFIGURE_MAXIMUM_DRIVERS 10 | ||
#define CONFIGURE_MAXIMUM_POSIX_KEYS 4 | ||
#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 | ||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | ||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | ||
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM | ||
#define CONFIGURE_FILESYSTEM_RFS | ||
#define CONFIGURE_FILESYSTEM_IMFS | ||
#define CONFIGURE_FILESYSTEM_DOSFS | ||
#define CONFIGURE_FILESYSTEM_DEVFS | ||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK | ||
#define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER | ||
#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER | ||
|
||
#define CONFIGURE_EXECUTIVE_RAM_SIZE (8 * 1024 * 1024) | ||
#define CONFIGURE_MICROSECONDS_PER_TICK 10000 | ||
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY 9 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/************************************************************************ | ||
* 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 | ||
* | ||
* OSAL BSP command line implementation | ||
*/ | ||
|
||
/* | ||
** Include Files | ||
*/ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
#include <ctype.h> | ||
#include <bsp.h> | ||
#include <rtems.h> | ||
|
||
#include "pcrtems_bsp_internal.h" | ||
|
||
/* | ||
* BSP compile-time tuning | ||
*/ | ||
#define RTEMS_MAX_USER_OPTIONS 4 | ||
#define RTEMS_MAX_CMDLINE 256 | ||
|
||
void OS_BSP_CmdLine(void) | ||
{ | ||
char userargbuffer[RTEMS_MAX_CMDLINE]; | ||
const char *cmdlinestr; | ||
const char *cmdp; | ||
char * cmdi, *cmdo; | ||
|
||
cmdlinestr = bsp_cmdline(); | ||
|
||
/* | ||
* Parse command line string (passed in from bootloader) | ||
* | ||
* Known arguments are handled here, and unknown args are | ||
* saved for the UT application. | ||
* | ||
* Batch mode is intended for non-interactive execution. | ||
* | ||
* It does two things: | ||
* - do not start the shell task | ||
* - when tests are complete, shutdown the executive | ||
* | ||
* The BSP should be configured with these options to | ||
* make this most useful: | ||
* USE_COM1_AS_CONSOLE=1 | ||
* BSP_PRESS_KEY_FOR_RESET=0 | ||
* BSP_RESET_BOARD_AT_EXIT=1 | ||
* | ||
* This way all the test output will be sent to COM1 | ||
* and then immediately resets the CPU when done. | ||
* | ||
* When running under QEMU the "-no-reboot" flag is | ||
* also useful to shutdown QEMU rather than resetting. | ||
*/ | ||
if (cmdlinestr != NULL) | ||
{ | ||
printf(" Bootloader Command Line: %s\n", cmdlinestr); | ||
|
||
cmdp = cmdlinestr; | ||
cmdo = NULL; | ||
cmdi = NULL; | ||
|
||
while (1) | ||
{ | ||
if (isgraph((int)*cmdp)) | ||
{ | ||
if (cmdo == NULL) | ||
{ | ||
cmdo = userargbuffer; | ||
} | ||
else | ||
{ | ||
++cmdo; | ||
} | ||
if (cmdi == NULL) | ||
{ | ||
cmdi = cmdo; | ||
} | ||
*cmdo = *cmdp; | ||
} | ||
else if (cmdi != NULL) | ||
{ | ||
++cmdo; | ||
*cmdo = 0; | ||
if (strcmp(cmdi, "--batch-mode") == 0) | ||
{ | ||
OS_BSP_PcRtemsGlobal.BatchMode = true; | ||
} | ||
else if (OS_BSP_Global.ArgC < RTEMS_MAX_USER_OPTIONS) | ||
{ | ||
/* save other args for app */ | ||
OS_BSP_Global.ArgV[OS_BSP_Global.ArgC] = cmdi; | ||
++OS_BSP_Global.ArgC; | ||
} | ||
cmdi = NULL; | ||
} | ||
|
||
if (*cmdp == 0) | ||
{ | ||
break; | ||
} | ||
|
||
++cmdp; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/************************************************************************ | ||
* 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 | ||
* | ||
* Purpose: | ||
* Header file for bsp cmdline | ||
*/ | ||
|
||
#ifndef BSP_CMDLINE_H | ||
#define BSP_CMDLINE_H | ||
|
||
void OS_BSP_CmdLine(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/************************************************************************ | ||
* 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 | ||
* | ||
* OSAL BSP debug console abstraction | ||
*/ | ||
|
||
#include <string.h> | ||
#include <unistd.h> | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
|
||
#include "pcrtems_bsp_internal.h" | ||
#include "bsp-impl.h" | ||
|
||
/**************************************************************************************** | ||
BSP CONSOLE IMPLEMENTATION FUNCTIONS | ||
****************************************************************************************/ | ||
|
||
/*---------------------------------------------------------------- | ||
OS_BSP_ConsoleOutput_Impl | ||
See full description in header | ||
------------------------------------------------------------------*/ | ||
void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen) | ||
{ | ||
/* writes the raw data directly to STDOUT_FILENO (unbuffered) */ | ||
write(STDOUT_FILENO, Str, DataLen); | ||
} | ||
|
||
/*---------------------------------------------------------------- | ||
OS_BSP_ConsoleSetMode_Impl() definition | ||
See full description in header | ||
------------------------------------------------------------------*/ | ||
void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits) | ||
{ | ||
/* no-op on RTEMS */ | ||
} |
Oops, something went wrong.