summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-14 20:50:46 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-14 20:50:46 +0000
commit0e24b0de612ad596103e4e01d250f0be12278783 (patch)
tree6ddb2ebc5c6cc9b94cc88baa085901046a345861 /apps
parent9264b754565c550afad96d4ef5ad1a76e6e8c233 (diff)
downloadnuttx-0e24b0de612ad596103e4e01d250f0be12278783.tar.gz
nuttx-0e24b0de612ad596103e4e01d250f0be12278783.tar.bz2
nuttx-0e24b0de612ad596103e4e01d250f0be12278783.zip
Add apps/poweroff lpc17 hardware handshake
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3380 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/ChangeLog.txt9
-rwxr-xr-xapps/Make.defs41
-rw-r--r--apps/Makefile38
-rw-r--r--apps/hello/Makefile4
-rw-r--r--apps/hello/README.txt5
-rw-r--r--apps/poweroff/Makefile103
-rw-r--r--apps/poweroff/README.txt5
-rw-r--r--apps/poweroff/poweroff.c42
8 files changed, 235 insertions, 12 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 399e4c852..9d64b5c74 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -5,6 +5,9 @@
5.20 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
- * README cosmetics
- * hello world minor changes
- * Makefile cosmetics (I am slowly adding the Darjeeling JVM) \ No newline at end of file
+ * README.txt -- README cosmetics
+ * hello/ -- hello world minor changes
+ * Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM)
+ * Make.defs -- New file adds common make definitions for applications.
+ * hello/Makefile -- Now uses new Make.defs definitions. Added README.txt.
+ * apps/poweroff -- New application to turn off board power. \ No newline at end of file
diff --git a/apps/Make.defs b/apps/Make.defs
new file mode 100755
index 000000000..bc71c98a0
--- /dev/null
+++ b/apps/Make.defs
@@ -0,0 +1,41 @@
+############################################################################
+# apps/Make.defs
+# Common make definitions provided to all applications
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+define REGISTER
+ @echo "Register: $1"
+ @echo "{ .name = $1, .priority = $2, .stacksize = $3, .main = $4 }," >> ../exec_nuttapp_list.h
+ @echo "EXTERN int $4(int argc, char *argv[]);" >> ../exec_nuttapp_proto.h
+endef
diff --git a/apps/Makefile b/apps/Makefile
index 40cae5a40..6622932a0 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -49,23 +49,44 @@ BUILTIN_APPS_DIR =
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
-# Individual application: HELLO
+# BUILTIN_APPS is the list of all configured built-in directories/built action
+
+BUILTIN_APPS =
ifeq ($(CONFIG_BUILTIN_APPS_HELLO),y)
-BUILTIN_APPS_DIR += hello
-BUILTIN_APPS_BUILT += hello/.built_always
+BUILTIN_APPS += hello/.built_always
endif
ifeq ($(CONFIG_BUILTIN_APPS_POWEROFF),y)
-BUILTIN_APPS_DIR += poweroff
-BUILTIN_APPS_BUILT += poweroff/.built_always
+BUILTIN_APPS += poweroff/.built_always
endif
ifeq ($(CONFIG_BUILTIN_APPS_JVM),y)
-BUILTIN_APPS_DIR += jvm
-BUILTIN_APPS_BUILT += jvm/.built_always
+BUILTIN_APPS += jvm/.built_always
endif
+# AVAILABLE_APPS is the list of currently available application directories
+
+AVAILABLE_APPS =
+
+define ADD_AVAILABLE
+AVAILABLE_APPS += ${shell DIR=`echo $1 | cut -d'/' -f1`; if [ -r $$DIR/Makefile ]; then echo "$1"; fi}
+endef
+
+define BUILTIN_ADD_APP
+BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'/' -f1}
+endef
+
+define BUILTIN_ADD_BUILT
+BUILTIN_APPS_BUILT += ${shell echo $1 | cut -d'/' -f2}
+endef
+
+# Create the list of applications to build
+
+$(foreach BUILTIN, $(BUILTIN_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN))))
+$(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP))))
+$(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT))))
+
# end of application list
endif
@@ -122,5 +143,8 @@ clean:
distclean: clean
@rm -f Make.dep .depend
+ @rm -f exec_nuttapp_list.h
+ @rm -f exec_nuttapp_proto.h
-include Make.dep
+
diff --git a/apps/hello/Makefile b/apps/hello/Makefile
index f4267cd4d..b1e13fc71 100644
--- a/apps/hello/Makefile
+++ b/apps/hello/Makefile
@@ -38,6 +38,7 @@
# sourcing the Make.defs!
-include $(TOPDIR)/Make.defs
+include ../Make.defs
ifeq ($(WINTOOL),y)
INCDIROPT = -w
@@ -86,9 +87,8 @@ $(BIN): $(OBJS)
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(call REGISTER, $(APPNAME), $(PRIORITY), $(STACKSIZE), $(APPNAME)_main)
@touch $@
- echo "{ .name = \""$(APPNAME)"\", .priority = "$(PRIORITY)", .stacksize = "$(STACKSIZE)", .main = "$(APPNAME)"_main }," >> ../exec_nuttapp_list.h
- echo "EXTERN int "$(APPNAME)"_main(int argc, char *argv[]);" >> ../exec_nuttapp_proto.h
# Register application
depend: .depend
diff --git a/apps/hello/README.txt b/apps/hello/README.txt
new file mode 100644
index 000000000..531c4d193
--- /dev/null
+++ b/apps/hello/README.txt
@@ -0,0 +1,5 @@
+
+This application provides Hello Builtin Application skeleton
+
+ Source: NuttX
+ Date: 13. March 2011
diff --git a/apps/poweroff/Makefile b/apps/poweroff/Makefile
new file mode 100644
index 000000000..ceecadcd4
--- /dev/null
+++ b/apps/poweroff/Makefile
@@ -0,0 +1,103 @@
+############################################################################
+# Makefile
+#
+# Copyright (C) 2011 Uros Platise. All rights reserved.
+# Author: Uros Platise <uros.platise@isotel.eu>
+# Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# TODO, this makefile should run make under the app dirs, instead of
+# sourcing the Make.defs!
+
+-include $(TOPDIR)/Make.defs
+include ../Make.defs
+
+ifeq ($(WINTOOL),y)
+INCDIROPT = -w
+endif
+
+# Hello Application
+# TODO: appname can be automatically extracted from the directory name
+
+APPNAME = poweroff
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 768
+
+ASRCS =
+CSRCS = poweroff.c
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+BIN = ../libapps$(LIBEXT)
+
+ROOTDEPPATH = --dep-path .
+
+# Common build
+
+VPATH =
+
+all: .built
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(BIN): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+ @touch .built
+
+.built: $(BIN)
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) \
+ $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(call REGISTER, $(APPNAME), $(PRIORITY), $(STACKSIZE), $(APPNAME)_main)
+ @touch $@
+
+# Register application
+depend: .depend
+
+clean:
+ @rm -f $(BIN) *.o *~ .*.swp .built
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/apps/poweroff/README.txt b/apps/poweroff/README.txt
new file mode 100644
index 000000000..e02180e5a
--- /dev/null
+++ b/apps/poweroff/README.txt
@@ -0,0 +1,5 @@
+
+This application provides poweroff command
+
+ Source: NuttX
+ Date: 13. March 2011
diff --git a/apps/poweroff/poweroff.c b/apps/poweroff/poweroff.c
new file mode 100644
index 000000000..f8b56e0d8
--- /dev/null
+++ b/apps/poweroff/poweroff.c
@@ -0,0 +1,42 @@
+/****************************************************************************
+ * poweroff/poweroff.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ * Author: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#include <arch/board/power.h>
+
+int poweroff_main(int argc, char *argv[])
+{
+ board_power_off();
+ return 0;
+}