-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1349, Break up pc-rtems to support generic configuration
- Loading branch information
Showing
10 changed files
with
570 additions
and
255 deletions.
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,131 @@ | ||
/************************************************************************ | ||
* 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 | ||
*/ | ||
/* TODO clean these */ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
#include <ctype.h> | ||
#include <bsp.h> | ||
#include <rtems.h> | ||
#include <rtems/bdbuf.h> | ||
#include <rtems/blkdev.h> | ||
#include <rtems/diskdevs.h> | ||
#include <rtems/bdpart.h> | ||
#include <rtems/error.h> | ||
#include <rtems/ramdisk.h> | ||
#include <rtems/dosfs.h> | ||
#include <rtems/fsmount.h> | ||
|
||
/* TODO remove or refactor? Still needs global */ | ||
#include "pcrtems_bsp_internal.h" | ||
|
||
void OS_BSP_CmdLine(void) | ||
{ | ||
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 = OS_BSP_PcRtemsGlobal.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
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,98 @@ | ||
/************************************************************************ | ||
* 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 | ||
* | ||
* RTEMS main entry point | ||
* Configures RTEMS and wraps OS_BSPMain for use in a stand alone executable | ||
*/ | ||
|
||
/* | ||
** Include Files | ||
*/ | ||
#include "bsp_start.h" | ||
#include "bsp-impl.h" | ||
#include <rtems.h> | ||
|
||
/* | ||
** A simple entry point to start from the loader | ||
*/ | ||
rtems_task Init(rtems_task_argument ignored) | ||
{ | ||
OS_BSPMain(); | ||
} | ||
|
||
/* configuration information */ | ||
|
||
/* | ||
** RTEMS OS Configuration definitions | ||
*/ | ||
#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 | ||
|
||
/* TODO figure out how to switch these if needed | ||
#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 | ||
|
||
#include <rtems/confdefs.h> |
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,36 @@ | ||
/************************************************************************ | ||
* 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 no shell implementation | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
/* TODO needs the global, but may want to split this up */ | ||
#include "pcrtems_bsp_internal.h" | ||
|
||
/* TODO add bsp_shell.h */ | ||
|
||
void OS_BSP_Shell(void) | ||
{ | ||
printf("RTEMS_NO_SHELL:TRUE, shell not implemented"); | ||
OS_BSP_PcRtemsGlobal.BatchMode = true; | ||
} |
Oops, something went wrong.