diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-07 00:16:45 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-07 00:16:45 +0000 |
commit | ef97b18a89f4ec015d30e3e7ef84596269d4dcab (patch) | |
tree | ab276ae0c6614a4e43e56f30b821a573ed716eaa /misc | |
parent | 2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-examples-ef97b18a89f4ec015d30e3e7ef84596269d4dcab.tar.bz2 |
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile: Add new program to demonstrate use of BSP command line
arguments.
* bspcmdline/.cvsignore, bspcmdline/Makefile, bspcmdline/README,
bspcmdline/test.c: New files.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/ChangeLog | 7 | ||||
-rw-r--r-- | misc/Makefile | 2 | ||||
-rw-r--r-- | misc/bspcmdline/.cvsignore | 1 | ||||
-rw-r--r-- | misc/bspcmdline/Makefile | 27 | ||||
-rw-r--r-- | misc/bspcmdline/README | 7 | ||||
-rw-r--r-- | misc/bspcmdline/test.c | 84 |
6 files changed, 127 insertions, 1 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index e5cc333..f9fcbc3 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,5 +1,12 @@ 2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> + * Makefile: Add new program to demonstrate use of BSP command line + arguments. + * bspcmdline/.cvsignore, bspcmdline/Makefile, bspcmdline/README, + bspcmdline/test.c: New files. + +2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> + * minimum/test.c: Remove warning. 2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> diff --git a/misc/Makefile b/misc/Makefile index 5b748cb..5702915 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -6,4 +6,4 @@ include $(RTEMS_MAKEFILE_PATH)/Makefile.inc include $(RTEMS_CUSTOM) include $(RTEMS_ROOT)/make/directory.cfg -SUBDIRS=minimum +SUBDIRS=minimum bspcmdline diff --git a/misc/bspcmdline/.cvsignore b/misc/bspcmdline/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/misc/bspcmdline/.cvsignore @@ -0,0 +1 @@ +o-optimize diff --git a/misc/bspcmdline/Makefile b/misc/bspcmdline/Makefile new file mode 100644 index 0000000..f7c0b7e --- /dev/null +++ b/misc/bspcmdline/Makefile @@ -0,0 +1,27 @@ +# +# $Id$ +# + +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/bspcmdline.exe + +# optional managers required +MANAGERS=all + +# C source names +CSRCS = test.c +COBJS = $(CSRCS:%.c=${ARCH}/%.o) + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(PROJECT_ROOT)/make/leaf.cfg + +OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) + +all: ${ARCH} $(PGM) + +$(PGM): $(OBJS) + $(make-exe) diff --git a/misc/bspcmdline/README b/misc/bspcmdline/README new file mode 100644 index 0000000..14b3c8e --- /dev/null +++ b/misc/bspcmdline/README @@ -0,0 +1,7 @@ +# +# $Id$ +# + +Some BSPs are invoked from environments which can provide boot +arguments. This program accesses the boot string provided +by the BSP. diff --git a/misc/bspcmdline/test.c b/misc/bspcmdline/test.c new file mode 100644 index 0000000..5d47f3d --- /dev/null +++ b/misc/bspcmdline/test.c @@ -0,0 +1,84 @@ +/* + * Demonstrate accessing Boot Command Line provided by BSP + * + * $Id$ + */ + +#include <bsp.h> +#include <rtems/bspcmdline.h> + +#include <stdlib.h> +#include <stdio.h> + +void print_arg( + const char *param +) +{ + const char *p; + char value[80]; + size_t length; + + printf( "\nLooking for param=(%s)\n", param ); + + length = sizeof(value); + p = rtems_bsp_cmdline_get_param( param, value, length ); + if ( !p ) { + printf( "Did not locate param=(%s)\n", param ); + return; + } + + p = rtems_bsp_cmdline_get_param_rhs( param, value, length ); + if ( !p ) { + printf( "param=(%s) has no right hand side\n", param ); + } else { + printf( "param=(%s) has right hand side of %s\n", param, p ); + } + +} + +rtems_task Init( + rtems_task_argument ignored +) +{ + const char *bspcmdline; + + printf( "\n\n*** BSP Command Demonstration ***\n" ); + + /* + * Let's see if this BSP provided one at all + */ + bspcmdline = rtems_bsp_cmdline_get(); + if ( !bspcmdline ) { + puts( "BSP does not have a boot command line" ); + goto demo_over; + } + + printf( "BSP has a boot command line:\n" "%s\n", bspcmdline ); + + /* + * The PC386 has some defined arguments. Did we see any of those? + */ + print_arg( "--console" ); + print_arg( "--ide" ); + print_arg( "--ide-show" ); + + +demo_over: + printf( "*** END OF BSP Command Line Demonstration ***\n" ); + exit( 0 ); +} + +/* configuration information */ + +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> + +/* end of file */ |