apps/ update from Uros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3392 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
abd406383f
commit
7bf5ad220a
34
Makefile
34
Makefile
@ -47,25 +47,17 @@ endif
|
|||||||
BUILTIN_APPS_BUILT =
|
BUILTIN_APPS_BUILT =
|
||||||
BUILTIN_APPS_DIR =
|
BUILTIN_APPS_DIR =
|
||||||
|
|
||||||
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
|
ifeq ($(CONFIG_BUILTIN_APPS),y)
|
||||||
|
|
||||||
# BUILTIN_APPS is the list of all configured built-in directories/built action
|
# CONFIGURED_APPS is the list of all configured built-in directories/built action
|
||||||
|
# It is created by the configured appconfig file (a copy of which appears in this
|
||||||
|
# directoy as .config)
|
||||||
|
|
||||||
BUILTIN_APPS =
|
CONFIGURED_APPS =
|
||||||
|
-include .config
|
||||||
|
|
||||||
ifeq ($(CONFIG_BUILTIN_APPS_HELLO),y)
|
# AVAILABLE_APPS is the list of currently available application directories. It
|
||||||
BUILTIN_APPS += hello/.built_always
|
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent apps
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_BUILTIN_APPS_POWEROFF),y)
|
|
||||||
BUILTIN_APPS += poweroff/.built_always
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_BUILTIN_APPS_JVM),y)
|
|
||||||
BUILTIN_APPS += jvm/.built_always
|
|
||||||
endif
|
|
||||||
|
|
||||||
# AVAILABLE_APPS is the list of currently available application directories
|
|
||||||
|
|
||||||
AVAILABLE_APPS =
|
AVAILABLE_APPS =
|
||||||
|
|
||||||
@ -78,12 +70,14 @@ BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'/' -f1}
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define BUILTIN_ADD_BUILT
|
define BUILTIN_ADD_BUILT
|
||||||
BUILTIN_APPS_BUILT += ${shell echo $1 | cut -d'/' -f2}
|
BUILTIN_APPS_BUILT += $1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Create the list of applications to build
|
# (1) Create the list of available applications (AVAILABLE_APPS), (2) Add each
|
||||||
|
# available app to the list of to build (BUILTIN_APPS_DIR), and (3) Add the
|
||||||
|
# "built" indication for each app (BUILTIN_APPS_BUILT).
|
||||||
|
|
||||||
$(foreach BUILTIN, $(BUILTIN_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN))))
|
$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN))))
|
||||||
$(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP))))
|
$(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP))))
|
||||||
$(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT))))
|
$(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT))))
|
||||||
|
|
||||||
@ -91,7 +85,6 @@ $(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT))))
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ROOTDEPPATH = --dep-path .
|
ROOTDEPPATH = --dep-path .
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = exec_nuttapp.c
|
CSRCS = exec_nuttapp.c
|
||||||
@ -142,6 +135,7 @@ clean:
|
|||||||
$(call CLEAN)
|
$(call CLEAN)
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
|
@rm -r .config
|
||||||
@rm -f Make.dep .depend
|
@rm -f Make.dep .depend
|
||||||
@rm -f exec_nuttapp_list.h
|
@rm -f exec_nuttapp_list.h
|
||||||
@rm -f exec_nuttapp_proto.h
|
@rm -f exec_nuttapp_proto.h
|
||||||
|
34
README.txt
34
README.txt
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
Application Folder
|
Application Folder
|
||||||
==================
|
==================
|
||||||
|
|
||||||
@ -6,27 +5,42 @@ This folder provides various applications found in sub-directories.
|
|||||||
|
|
||||||
Application entry points with their requirements are gathered together in
|
Application entry points with their requirements are gathered together in
|
||||||
in two files:
|
in two files:
|
||||||
|
|
||||||
- exec_nuttapp_proto.h Entry points, prototype function
|
- exec_nuttapp_proto.h Entry points, prototype function
|
||||||
- exec_nuttapp_list.h Application specific information and requirements
|
- exec_nuttapp_list.h Application specific information and requirements
|
||||||
|
|
||||||
Information is collected during the make .depend process.
|
Information is collected during the make .depend process.
|
||||||
|
|
||||||
To execute an application function:
|
To execute an application function:
|
||||||
exec_nuttapp() is defined in the include/nuttx/nuttapp.h
|
|
||||||
|
exec_nuttapp() is defined in the nuttx/include/apps/apps.h
|
||||||
|
|
||||||
NuttShell provides transparent method of invoking the command, when the
|
NuttShell provides transparent method of invoking the command, when the
|
||||||
following option is enabled:
|
following option is enabled:
|
||||||
|
|
||||||
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
|
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
|
||||||
|
|
||||||
To select which application to be included in the build process set your
|
in the NuttX configuration.
|
||||||
preferences in the nuttx/.config file as:
|
|
||||||
|
A special configuration file is used to configure which applications
|
||||||
|
are to be included in the build. This file is configs/<board>/<configuration>/appconfig.
|
||||||
|
The existence of the appconfig file in the board configuration directory
|
||||||
|
is sufficient to enable building of applications.
|
||||||
|
|
||||||
|
The appconfig file is copied into the apps/ directory as .config when
|
||||||
|
NuttX is configured. .config is included in the toplevel apps/Makefile.
|
||||||
|
As a minimum, this configuration file must define files to add to the
|
||||||
|
CONFIGURED_APPS list like:
|
||||||
|
|
||||||
|
CONFIGURED_APPS += hello/.built_always poweroff/.built_always jvm/.built_always
|
||||||
|
|
||||||
|
The form of each entry is <dir>/<dependency> when:
|
||||||
|
|
||||||
|
<dir> is the name of a subdirectory in the apps directory, and
|
||||||
|
|
||||||
|
<dependency> is a make dependency. This will be "touch"-ed each time
|
||||||
|
that the sub-directory is rebuilt.
|
||||||
|
|
||||||
To include applications under the nuttx apps directory:
|
|
||||||
CONFIG_BUILTIN_APPS_NUTTX=y/n
|
|
||||||
|
|
||||||
where each application can be controlled as:
|
|
||||||
CONFIG_BUILTIN_APPS_<NAME>=y/n
|
|
||||||
|
|
||||||
When the user defines an option:
|
When the user defines an option:
|
||||||
CONFIG_BUILTIN_APP_START=<application name>
|
CONFIG_BUILTIN_APP_START=<application name>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/nuttapp.h>
|
#include <apps/apps.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
103
free/Makefile
Normal file
103
free/Makefile
Normal file
@ -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 = free
|
||||||
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
|
STACKSIZE = 768
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = free.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
|
6
free/README.txt
Normal file
6
free/README.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
This application provides UNIX style memory free information.
|
||||||
|
|
||||||
|
Source: NuttX
|
||||||
|
Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
Date: 17. March 2011
|
93
free/free.c
Normal file
93
free/free.c
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* free/free.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: cmd_free
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int free_main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
struct mallinfo mem;
|
||||||
|
|
||||||
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
|
mem = mallinfo();
|
||||||
|
#else
|
||||||
|
(void)mallinfo(&mem);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf(" total used free largest\n");
|
||||||
|
printf("Mem: %11d%11d%11d%11d\n",
|
||||||
|
mem.arena, mem.uordblks, mem.fordblks, mem.mxordblk);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
103
ramtron/Makefile
Normal file
103
ramtron/Makefile
Normal file
@ -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 = ramtron
|
||||||
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
|
STACKSIZE = 1024
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = ramtron.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
|
7
ramtron/README.txt
Normal file
7
ramtron/README.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
This application provides RAMTRON tool/lib to start, stop or to perform
|
||||||
|
RAMTRON custom operations.
|
||||||
|
|
||||||
|
Source: NuttX
|
||||||
|
Author: Uros Platise
|
||||||
|
Date: 18. March 2011
|
97
ramtron/ramtron.c
Normal file
97
ramtron/ramtron.c
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* ramtron/ramtron.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/spi.h>
|
||||||
|
#include <nuttx/mtd.h>
|
||||||
|
|
||||||
|
|
||||||
|
int ramtron_start(int spino)
|
||||||
|
{
|
||||||
|
FAR struct spi_dev_s *spi;
|
||||||
|
FAR struct mtd_dev_s *mtd;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
/* Get the SPI port */
|
||||||
|
|
||||||
|
spi = up_spiinitialize(spino);
|
||||||
|
if (!spi)
|
||||||
|
{
|
||||||
|
printf("RAMTRON: Failed to initialize SPI%d\n", spino);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
printf("RAMTRON: Initialized SPI%d\n", spino);
|
||||||
|
|
||||||
|
mtd = (struct mtd_dev_s *)ramtron_initialize(spi);
|
||||||
|
if (!mtd)
|
||||||
|
{
|
||||||
|
printf("RAMTRON: Device not found\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
printf("RAMTRON: FM25V10 of size 128 kB\n");
|
||||||
|
//printf("RAMTRON: %s of size %d B\n", ramtron_getpart(mtd), ramtron_getsize(mtd) );
|
||||||
|
|
||||||
|
retval = ftl_initialize(0, NULL, mtd);
|
||||||
|
printf("RAMTRON: FTL Initialized (returns with %d)\n", retval);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ramtron_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int spino;
|
||||||
|
|
||||||
|
if (argc == 3) {
|
||||||
|
spino = atoi(argv[2]);
|
||||||
|
|
||||||
|
if (!strcmp(argv[1], "start")) {
|
||||||
|
return ramtron_start(spino);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: write protect
|
||||||
|
printf("%s: <start> <spino>\n", argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
103
sdcard/Makefile
Normal file
103
sdcard/Makefile
Normal file
@ -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 = sdcard
|
||||||
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
|
STACKSIZE = 1024
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = sdcard.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
|
7
sdcard/README.txt
Normal file
7
sdcard/README.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
This application provides SDcard tool/lib to start, stop, eject or insert
|
||||||
|
a memory card.
|
||||||
|
|
||||||
|
Source: NuttX
|
||||||
|
Author: Uros Platise
|
||||||
|
Date: 18. March 2011
|
110
sdcard/sdcard.c
Normal file
110
sdcard/sdcard.c
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* sdcard/sdcard.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SDIO
|
||||||
|
# include <nuttx/sdio.h>
|
||||||
|
# include <nuttx/mmcsd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Create device device for the SDIO-based MMC/SD block driver */
|
||||||
|
|
||||||
|
int sdcard_start(int slotno)
|
||||||
|
{
|
||||||
|
FAR struct sdio_dev_s *sdio;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* First, get an instance of the SDIO interface */
|
||||||
|
|
||||||
|
sdio = sdio_initialize(slotno);
|
||||||
|
if (!sdio)
|
||||||
|
{
|
||||||
|
printf("SDIO: Failed to initialize slot %d\n", slotno);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
printf("SDIO: Initialized slot %d\n", slotno);
|
||||||
|
|
||||||
|
/* Now bind the SPI interface to the MMC/SD driver */
|
||||||
|
|
||||||
|
ret = mmcsd_slotinitialize(slotno, sdio);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
printf("SDIO: Failed to bind to the MMC/SD driver: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
printf("SDIO: Successfully bound to the MMC/SD driver\n");
|
||||||
|
|
||||||
|
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||||
|
* see if the VSN board supports a GPIO to detect if there is a card in
|
||||||
|
* the slot.
|
||||||
|
*/
|
||||||
|
sdio_mediachange(sdio, true);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int sdcard_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int slotno;
|
||||||
|
|
||||||
|
if (argc == 3) {
|
||||||
|
slotno = atoi(argv[2]);
|
||||||
|
|
||||||
|
if (!strcmp(argv[1], "start")) {
|
||||||
|
return sdcard_start(slotno);
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[1], "stop")) {
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[1], "insert")) {
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[1], "eject")) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s: <start" /*|stop|insert|eject*/ "> <slotno>\n", argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user