summaryrefslogtreecommitdiffstats
path: root/uboot
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-06 21:25:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-06 21:25:57 +0000
commit9c54f28b70f0fd5919c22920cf8546e65d4632fa (patch)
tree7b46de3b519b350eb0577418f8c23edb06c06542 /uboot
parent2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-examples-9c54f28b70f0fd5919c22920cf8546e65d4632fa.tar.bz2
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog, Makefile, uboot_getenv/Makefile, uboot_getenv/README, uboot_getenv/test.c: New files.
Diffstat (limited to 'uboot')
-rw-r--r--uboot/ChangeLog5
-rw-r--r--uboot/Makefile9
-rw-r--r--uboot/uboot_getenv/Makefile28
-rw-r--r--uboot/uboot_getenv/README7
-rw-r--r--uboot/uboot_getenv/test.c56
5 files changed, 105 insertions, 0 deletions
diff --git a/uboot/ChangeLog b/uboot/ChangeLog
new file mode 100644
index 0000000..a760f9d
--- /dev/null
+++ b/uboot/ChangeLog
@@ -0,0 +1,5 @@
+2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * ChangeLog, Makefile, uboot_getenv/Makefile, uboot_getenv/README,
+ uboot_getenv/test.c: New files.
+
diff --git a/uboot/Makefile b/uboot/Makefile
new file mode 100644
index 0000000..f60c254
--- /dev/null
+++ b/uboot/Makefile
@@ -0,0 +1,9 @@
+#
+# $Id$
+#
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(RTEMS_ROOT)/make/directory.cfg
+
+SUBDIRS = uboot_getenv
diff --git a/uboot/uboot_getenv/Makefile b/uboot/uboot_getenv/Makefile
new file mode 100644
index 0000000..0dd6b16
--- /dev/null
+++ b/uboot/uboot_getenv/Makefile
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+
+#
+# RTEMS_MAKEFILE_PATH is typically set in an environment variable
+#
+
+EXEC=uboot_getenv.exe
+PGM=${ARCH}/$(EXEC)
+
+# 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/uboot/uboot_getenv/README b/uboot/uboot_getenv/README
new file mode 100644
index 0000000..7b230c5
--- /dev/null
+++ b/uboot/uboot_getenv/README
@@ -0,0 +1,7 @@
+#
+# README for U-Boot getenv() demo
+#
+
+Some boards on which RTEMS runs have U-Boot. If the BSP supports
+it, then you may obtain environment variables which U-Boot has stored
+in Flash.
diff --git a/uboot/uboot_getenv/test.c b/uboot/uboot_getenv/test.c
new file mode 100644
index 0000000..44ce0ec
--- /dev/null
+++ b/uboot/uboot_getenv/test.c
@@ -0,0 +1,56 @@
+/*
+ * Simple test program -- simplified version of sample test hello.
+ */
+
+#include <bsp.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#if defined(HAS_UBOOT)
+ void test_getenv(
+ const char *name
+ )
+ {
+ const char *bsp_uboot_getenv(
+ const char *name
+ );
+ const char *rhs = bsp_uboot_getenv( name );
+
+ printf( "%s=%s\n", name, ((rhs) ? rhs : NULL));
+ }
+#endif
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ puts( "\n\n*** U-Boot Get Environment Variable Test ***" );
+ #if defined(HAS_UBOOT)
+ test_getenv( "ipaddr" );
+ test_getenv( "baudrate" );
+ test_getenv( "bootcmd" );
+ test_getenv( "badname" );
+ #else
+ puts( "This BSP does not have U-Boot." );
+ #endif
+ puts( "*** END of U-Boot Get Environment Variable Test ***" );
+
+ 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 */