summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/Makefile10
-rw-r--r--nuttx/arch/README.txt18
-rw-r--r--nuttx/arch/c5471/Make.defs3
-rw-r--r--nuttx/arch/c5471/defconfig22
-rw-r--r--nuttx/arch/c5471/src/Makefile11
-rw-r--r--nuttx/arch/sim/Make.defs3
-rw-r--r--nuttx/arch/sim/defconfig24
-rw-r--r--nuttx/arch/sim/src/Makefile15
-rw-r--r--nuttx/examples/ostest/Makefile10
-rw-r--r--nuttx/examples/ostest/main.c8
-rw-r--r--nuttx/include/nuttx/compiler.h8
-rw-r--r--nuttx/include/sched.h30
-rw-r--r--nuttx/sched/Makefile23
-rw-r--r--nuttx/sched/mq_close.c2
-rw-r--r--nuttx/sched/mq_internal.h2
-rw-r--r--nuttx/sched/mq_open.c2
-rw-r--r--nuttx/sched/mq_send.c27
-rw-r--r--nuttx/sched/os_internal.h10
-rw-r--r--nuttx/sched/os_start.c54
-rw-r--r--nuttx/sched/sched_addprioritized.c2
-rw-r--r--nuttx/sched/task_create.c4
-rw-r--r--nuttx/sched/task_delete.c16
22 files changed, 223 insertions, 81 deletions
diff --git a/nuttx/Makefile b/nuttx/Makefile
index 19ff2478a..ba0441886 100644
--- a/nuttx/Makefile
+++ b/nuttx/Makefile
@@ -42,12 +42,11 @@ ARCH_SRC = $(ARCH_DIR)/src
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
-LINKOBJS = $(ARCH_SRC)/up_head$(OBJEXT)
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
-BIN = nuttx
+BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: clean context clean_context distclean
@@ -83,9 +82,6 @@ lib/liblib$(LIBEXT): context
$(ARCH_SRC)/libarch$(LIBEXT): context
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
-$(ARCH_SRC)/up_head$(OBJEXT): context
- $(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) up_head$(OBJEXT)
-
mm/libmm$(LIBEXT): context
$(MAKE) -C mm TOPDIR=$(TOPDIR) libmm$(LIBEXT)
@@ -98,8 +94,8 @@ drivers/libdrivers$(LIBEXT): context
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT): context
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) lib$(CONFIG_EXAMPLE)$(LIBEXT)
-$(BIN): context depend $(LINKOBJS) $(LINKLIBS)
- $(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKOBJS="$(LINKOBJS)" LINKLIBS="$(LINKLIBS)" $(BIN)
+$(BIN): context depend $(LINKLIBS)
+ $(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN)
depend:
@for dir in $(SUBDIRS) ; do \
diff --git a/nuttx/arch/README.txt b/nuttx/arch/README.txt
index bdc353cbb..e10393c9f 100644
--- a/nuttx/arch/README.txt
+++ b/nuttx/arch/README.txt
@@ -62,7 +62,7 @@ defconfig -- This is a configuration file similar to the Linux
General OS setup
- CONFIG_EXAMPLE - identifies the subdirectgory in examples
+ CONFIG_EXAMPLE - identifies the subdirectory in examples
that will be used in the build
CONFIG_DEBUG - enables built-in debug options
CONFIG_DEBUG_VERBOSE - enables verbose debug output
@@ -82,7 +82,21 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_DEV_CONSOLE - Set if architecture-specific logic
provides /dev/console. Enables stdout, stderr, stdin.
- Allow for artchitecture optimized implementations
+ The following can be used to disable categories of APIs supported
+ by the OS. If the compiler supports weak functions, then it
+ should not be necessary to disable functions unless you want to
+ restrict usage of those APIs.
+
+ There are certain dependency relationships in these features.
+
+ o mq_notify logic depends on signals to awaken tasks
+ waiting for queues to become full or empty.
+ o pthread_condtimedwait() depends on signals to wake
+ up waiting tasks.
+
+ CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE
+
+ Allow for architecture optimized implementations
The architecture can provide optimized versions of the
following to improve sysem performance
diff --git a/nuttx/arch/c5471/Make.defs b/nuttx/arch/c5471/Make.defs
index 359f4585e..32f62cd34 100644
--- a/nuttx/arch/c5471/Make.defs
+++ b/nuttx/arch/c5471/Make.defs
@@ -42,7 +42,7 @@ else
-fomit-frame-pointer
endif
-ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
@@ -62,6 +62,7 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
OBJEXT = .o
LIBEXT = .a
+EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
diff --git a/nuttx/arch/c5471/defconfig b/nuttx/arch/c5471/defconfig
index 449d1a2d2..731f1d85c 100644
--- a/nuttx/arch/c5471/defconfig
+++ b/nuttx/arch/c5471/defconfig
@@ -77,7 +77,7 @@ CONFIG_UART_MODEM_2STOP=0
#
# General OS setup
#
-# CONFIG_EXAMPLE - identifies the subdirectgory in examples
+# CONFIG_EXAMPLE - identifies the subdirectory in examples
# that will be used in the build
# CONFIG_DEBUG - enables built-in debug options
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
@@ -111,7 +111,25 @@ CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y
#
-# Allow for artchitecture optimized implementations
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+
+#
+# Allow for architecture optimized implementations
#
# The architecture can provide optimized versions of the
# following to improve sysem performance
diff --git a/nuttx/arch/c5471/src/Makefile b/nuttx/arch/c5471/src/Makefile
index 3c1e50010..97f3ae9a2 100644
--- a/nuttx/arch/c5471/src/Makefile
+++ b/nuttx/arch/c5471/src/Makefile
@@ -59,7 +59,7 @@ OBJS = $(AOBJS) $(COBJS)
LDFLAGS = $(ARCHSCRIPT)
EXTRA_LIBS =
-LINKOBJS =
+LINKOBJS = up_head$(OBJEXT)
LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
@@ -68,7 +68,7 @@ LIBGCC = ${shell $(CC) -print-libgcc-file-name}
all: up_head.o libarch$(LIBEXT)
-$(AOBJS) up_head.o: %.o: %.S
+$(AOBJS) $(LINKOBJS): %.o: %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
$(COBJS): %.o: %.c
@@ -80,10 +80,9 @@ libarch$(LIBEXT): $(OBJS)
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
done ; )
-nuttx:
- $(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
- $(addprefix $(TOPDIR)/,$(LINKOBJS)) \
- --start-group $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
+nuttx: $(LINKOBJS)
+ $(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
+ --start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC)
@$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
diff --git a/nuttx/arch/sim/Make.defs b/nuttx/arch/sim/Make.defs
index 3e4d0cf75..5fa97507d 100644
--- a/nuttx/arch/sim/Make.defs
+++ b/nuttx/arch/sim/Make.defs
@@ -41,7 +41,7 @@ else
ARCHOPTIMIZATION = -O2
endif
-ARCHCPUFLAGS =
+ARCHCPUFLAGS = -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
@@ -61,6 +61,7 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
OBJEXT = .o
LIBEXT = .a
+EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
diff --git a/nuttx/arch/sim/defconfig b/nuttx/arch/sim/defconfig
index 00a8e6e59..b20319e7a 100644
--- a/nuttx/arch/sim/defconfig
+++ b/nuttx/arch/sim/defconfig
@@ -44,7 +44,7 @@ CONFIG_ARCH_SIM=y
#
# General OS setup
#
-# CONFIG_EXAMPLE - identifies the subdirectgory in examples
+# CONFIG_EXAMPLE - identifies the subdirectory in examples
# that will be used in the build
# CONFIG_DEBUG - enables built-in debug options
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
@@ -73,12 +73,30 @@ CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=32
CONFIG_START_YEAR=2007
CONFIG_START_MONTH=2
-CONFIG_START_DAY=13
+CONFIG_START_DAY=27
CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y
#
-# Allow for artchitecture optimized implementations
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+
+#
+# Allow for architecture optimized implementations
#
# The architecture can provide optimized versions of the
# following to improve sysem performance
diff --git a/nuttx/arch/sim/src/Makefile b/nuttx/arch/sim/src/Makefile
index a3be44f35..5c7ed0d1f 100644
--- a/nuttx/arch/sim/src/Makefile
+++ b/nuttx/arch/sim/src/Makefile
@@ -51,10 +51,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
-LDFLAGS = $(ARCHSCRIPT)
-EXTRA_LIBS = -lc
+LDFLAGS = $(ARCHSCRIPT)
+EXTRA_LIBS = -lc
-LINKOBJS =
+LINKOBJS = up_head$(OBJEXT)
LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
@@ -64,7 +64,7 @@ all: up_head$(OBJEXT) libarch$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
-$(COBJS) up_head$(OBJEXT): %$(OBJEXT): %.c
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(CC) -c $(CFLAGS) $< -o $@
libarch$(LIBEXT): $(OBJS)
@@ -73,10 +73,9 @@ libarch$(LIBEXT): $(OBJS)
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
done ; )
-nuttx:
- $(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
- $(addprefix $(TOPDIR)/,$(LINKOBJS)) \
- -Wl,--start-group $(LDLIBS) $(EXTRA_LIBS) -Wl,--end-group
+nuttx: $(LINKOBJS)
+ $(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
+ -Wl,--start-group $(LDLIBS) -Wl,--end-group $(EXTRA_LIBS)
@$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
diff --git a/nuttx/examples/ostest/Makefile b/nuttx/examples/ostest/Makefile
index 22fbb2501..860bc7746 100644
--- a/nuttx/examples/ostest/Makefile
+++ b/nuttx/examples/ostest/Makefile
@@ -40,8 +40,14 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
-CSRCS = main.c dev_null.c mutex.c cancel.c sem.c cond.c \
- timedwait.c mqueue.c sighand.c
+CSRCS = main.c dev_null.c mutex.c cancel.c sem.c cond.c
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+CSRCS += timedwait.c sighand.c
+endif
+ifneq ($(CONFIG_DISABLE_MQUEUE),y)
+CSRCS += mqueue.c
+endif
+
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
diff --git a/nuttx/examples/ostest/main.c b/nuttx/examples/ostest/main.c
index ff1072176..06c6ad9f5 100644
--- a/nuttx/examples/ostest/main.c
+++ b/nuttx/examples/ostest/main.c
@@ -120,17 +120,25 @@ static int user_main(int argc, char *argv[])
cond_test();
+#ifndef CONFIG_DISABLE_SIGNALS
/* Verify pthreads and condition variable timed waits */
timedwait_test();
+#endif
+#ifndef CONFIG_DISABLE_MQUEUE
/* Verify pthreads and message queues */
mqueue_test();
+#endif
+#ifndef CONFIG_DISABLE_SIGNALS
/* Verify signal handlers */
sighand_test();
+#endif
+
+ printf("user_main: Exitting\n");
return 0;
}
diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h
index f15902171..1ba651503 100644
--- a/nuttx/include/nuttx/compiler.h
+++ b/nuttx/include/nuttx/compiler.h
@@ -73,6 +73,7 @@
# define FAR
# define NEAR
+# define DSEG
/* Select the large, 32-bit addressing model */
@@ -127,6 +128,12 @@
#define FAR __xdata
#define NEAR __data
+#if defined(SDCC_MODEL_SMALL)
+# define DSEG __data
+#else
+# define DSEG __xdata
+#endif
+
/* Select small, 16-bit address model */
# define CONFIG_SMALL_MEMORY 1
@@ -159,6 +166,7 @@
# define FAR
# define NEAR
+# define DSEG
# undef CONFIG_SMALL_MEMORY
# undef CONFIG_HAVE_INLINE
diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h
index 79d3b2f1d..feb1785e3 100644
--- a/nuttx/include/sched.h
+++ b/nuttx/include/sched.h
@@ -102,9 +102,13 @@ typedef enum tstate_e
TSTATE_TASK_INACTIVE = 4, /* BLOCKED - Initialized but not yet activated */
TSTATE_WAIT_SEM = 5, /* BLOCKED - Waiting for a semaphore */
+#ifndef CONFIG_DISABLE_MQUEUE
TSTATE_WAIT_SIG = 6, /* BLOCKED - Waiting for a signal */
- TSTATE_WAIT_MQNOTEMPTY = 7, /* BLOCKED - Waiting for a MQ to become not empty. */
- TSTATE_WAIT_MQNOTFULL = 8 /* BLOCKED - Waiting for a MQ to become not full. */
+#endif
+#ifndef CONFIG_DISABLE_MQUEUE
+ TSTATE_WAIT_MQNOTEMPTY, /* BLOCKED - Waiting for a MQ to become not empty. */
+ TSTATE_WAIT_MQNOTFULL /* BLOCKED - Waiting for a MQ to become not full. */
+#endif
};
typedef enum tstate_e tstate_t;
@@ -113,8 +117,22 @@ typedef enum tstate_e tstate_t;
#define FIRST_READY_TO_RUN_STATE TSTATE_TASK_READYTORUN
#define LAST_READY_TO_RUN_STATE TSTATE_TASK_RUNNING
#define FIRST_BLOCKED_STATE TSTATE_TASK_INACTIVE
-#define LAST_BLOCKED_STATE TSTATE_WAIT_MQNOTFULL
-#define NUM_TASK_STATES 9
+#ifndef CONFIG_DISABLE_MQUEUE
+# define LAST_BLOCKED_STATE TSTATE_WAIT_MQNOTFULL
+# ifndef CONFIG_DISABLE_SIGNALS
+# define NUM_TASK_STATES 9
+# else
+# define NUM_TASK_STATES 8
+# endif
+#else
+# ifndef CONFIG_DISABLE_SIGNALS
+# define LAST_BLOCKED_STATE TSTATE_WAIT_SIG
+# define NUM_TASK_STATES 7
+# else
+# define LAST_BLOCKED_STATE TSTATE_WAIT_SEM
+# define NUM_TASK_STATES 6
+# endif
+#endif
/* The following is the form of a thread start-up function */
@@ -192,6 +210,7 @@ struct _TCB
/* POSIX Signal Control Fields **************************************/
+#ifndef CONFIG_DISABLE_SIGNALS
sigset_t sigprocmask; /* Signals that are blocked */
sigset_t sigwaitmask; /* Waiting for pending signals */
sq_queue_t sigactionq; /* List of actions for signals */
@@ -199,11 +218,14 @@ struct _TCB
sq_queue_t sigpendactionq; /* List of pending signal actions */
sq_queue_t sigpostedq; /* List of posted signals */
siginfo_t sigunbinfo; /* Signal info when task unblocked */
+#endif
/* POSIX Named Message Queue Fields *********************************/
+#ifndef CONFIG_DISABLE_MQUEUE
sq_queue_t msgdesq; /* List of opened message queues */
FAR msgq_t *msgwaitq; /* Waiting for this message queue */
+#endif
/* Library related fields *******************************************/
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile
index ea4eb4067..fa69c60b5 100644
--- a/nuttx/sched/Makefile
+++ b/nuttx/sched/Makefile
@@ -67,9 +67,11 @@ SIGNAL_SRCS = sig_initialize.c \
sig_releasependingsignal.c sig_lowest.c sig_mqnotempty.c \
sig_cleanup.c sig_received.c sig_deliver.c
MQUEUE_SRCS = mq_open.c mq_close.c mq_unlink.c mq_send.c mq_receive.c \
- mq_notify.c mq_setattr.c mq_getattr.c \
- mq_initialize.c mq_descreate.c mq_findnamed.c \
- mq_msgfree.c mq_msgqfree.c
+ mq_setattr.c mq_getattr.c mq_initialize.c mq_descreate.c \
+ mq_findnamed.c mq_msgfree.c mq_msgqfree.c
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+MQUEUE_SRCS += mq_notify.c
+endif
PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
pthread_attrsetschedpolicy.c pthread_attrgetschedpolicy.c \
pthread_attrsetinheritsched.c pthread_attrgetinheritsched.c \
@@ -83,19 +85,28 @@ PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c \
pthread_condinit.c pthread_conddestroy.c \
pthread_condattrinit.c pthread_condattrdestroy.c \
- pthread_condwait.c pthread_condtimedwait.c \
- pthread_condsignal.c pthread_condbroadcast.c \
+ pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c \
pthread_cancel.c pthread_setcancelstate.c \
pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c pthread_keydelete.c \
pthread_initialize.c pthread_completejoin.c pthread_findjoininfo.c \
pthread_removejoininfo.c
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+PTHREAD_SRCS += pthread_condtimedwait.c
+endif
SEM_SRCS = sem_initialize.c sem_init.c sem_destroy.c\
sem_open.c sem_close.c sem_unlink.c \
sem_wait.c sem_trywait.c sem_post.c sem_getvalue.c \
sem_waitirq.c sem_findnamed.c
IRQ_SRCS = irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c
+
CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(SCHED_SRCS) $(WDOG_SRCS) $(TIME_SRCS) \
- $(SIGNAL_SRCS) $(MQUEUE_SRCS) $(PTHREAD_SRCS) $(SEM_SRCS) $(IRQ_SRCS)
+ $(PTHREAD_SRCS) $(SEM_SRCS) $(IRQ_SRCS)
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+CSRCS += $(SIGNAL_SRCS)
+endif
+ifneq ($(CONFIG_DISABLE_MQUEUE),y)
+CSRCS += $(MQUEUE_SRCS)
+endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
diff --git a/nuttx/sched/mq_close.c b/nuttx/sched/mq_close.c
index 6643cc5e9..15d2272a0 100644
--- a/nuttx/sched/mq_close.c
+++ b/nuttx/sched/mq_close.c
@@ -138,6 +138,7 @@ int mq_close(mqd_t mqdes)
* the message queue via this mqdes.
*/
+#ifndef CONFIG_DISABLE_SIGNALS
if (msgq->ntmqdes == mqdes)
{
msgq->ntpid = INVALID_PROCESS_ID;
@@ -145,6 +146,7 @@ int mq_close(mqd_t mqdes)
msgq->ntvalue.sival_int = 0;
msgq->ntmqdes = NULL;
}
+#endif
/* Decrement the connection count on the message queue. */
diff --git a/nuttx/sched/mq_internal.h b/nuttx/sched/mq_internal.h
index 4e55a9316..0ffdea53e 100644
--- a/nuttx/sched/mq_internal.h
+++ b/nuttx/sched/mq_internal.h
@@ -119,10 +119,12 @@ struct msgq_s
sint16 nwaitnotempty; /* Number tasks waiting for not empty */
ubyte maxmsgsize; /* Max size of message in message queue */
boolean unlinked; /* TRUE if the msg queue has been unlinked */
+#ifndef CONFIG_DISABLE_SIGNALS
FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */
pid_t ntpid; /* Notification: Receiving Task's PID */
int ntsigno; /* Notification: Signal number */
union sigval ntvalue; /* Notification: Signal value */
+#endif
char name[1]; /* Start of the queue name */
};
diff --git a/nuttx/sched/mq_open.c b/nuttx/sched/mq_open.c
index e3e239180..13c964e53 100644
--- a/nuttx/sched/mq_open.c
+++ b/nuttx/sched/mq_open.c
@@ -189,7 +189,9 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
}
msgq->nconnect = 1;
+#ifndef CONFIG_DISABLE_SIGNALS
msgq->ntpid = INVALID_PROCESS_ID;
+#endif
strcpy(msgq->name, mq_name);
/* Add the new message queue to the list of
diff --git a/nuttx/sched/mq_send.c b/nuttx/sched/mq_send.c
index aaf700a45..92400d9c4 100644
--- a/nuttx/sched/mq_send.c
+++ b/nuttx/sched/mq_send.c
@@ -37,17 +37,19 @@
* Included Files
************************************************************/
-#include <nuttx/compiler.h>
-#include <nuttx/kmalloc.h>
-#include <sys/types.h> /* uint32, etc. */
-#include <mqueue.h>
-#include <string.h>
-#include <sched.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include "os_internal.h"
-#include "sig_internal.h"
-#include "mq_internal.h"
+#include <nuttx/compiler.h>
+#include <nuttx/kmalloc.h>
+#include <sys/types.h> /* uint32, etc. */
+#include <mqueue.h>
+#include <string.h>
+#include <sched.h>
+#include <debug.h>
+#include <nuttx/arch.h>
+#include "os_internal.h"
+#ifndef CONFIG_DISABLE_SIGNALS
+# include "sig_internal.h"
+#endif
+#include "mq_internal.h"
/************************************************************
* Definitions
@@ -339,6 +341,7 @@ int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio)
* message queue
*/
+#ifndef CONFIG_DISABLE_SIGNALS
if (msgq->ntmqdes)
{
/* Remove the message notification data from the message queue. */
@@ -366,7 +369,7 @@ int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio)
sig_mqnotempty(pid, signo, sival_ptr);
#endif
}
-
+#endif
/* Check if any tasks are waiting for the MQ not empty event. */
saved_state = irqsave();
diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h
index 75807e930..d829783bd 100644
--- a/nuttx/sched/os_internal.h
+++ b/nuttx/sched/os_internal.h
@@ -135,7 +135,7 @@ typedef struct pidhash_s pidhash_t;
struct tasklist_s
{
- NEAR dq_queue_t *list; /* Pointer to the task list */
+ DSEG dq_queue_t *list; /* Pointer to the task list */
boolean prioritized; /* TRUE if the list is prioritized */
};
typedef struct tasklist_s tasklist_t;
@@ -177,19 +177,25 @@ extern dq_queue_t g_waitingforsemaphore;
/* This is the list of all tasks that are blocked waiting for a signal */
+#ifndef CONFIG_DISABLE_SIGNALS
extern dq_queue_t g_waitingforsignal;
+#endif
/* This is the list of all tasks that are blocked waiting for a message
* queue to become non-empty.
*/
+#ifndef CONFIG_DISABLE_MQUEUE
extern dq_queue_t g_waitingformqnotempty;
+#endif
/* This is the list of all tasks that are blocked waiting for a message
* queue to become non-full.
*/
+#ifndef CONFIG_DISABLE_MQUEUE
extern dq_queue_t g_waitingformqnotfull;
+#endif
/* This the list of all tasks that have been initialized, but not yet
* activated. NOTE: This is the only list that is not prioritized.
@@ -241,7 +247,7 @@ extern STATUS _task_init(FAR _TCB *tcb, const char *name, int priority,
extern boolean sched_addreadytorun(FAR _TCB *rtrtcb);
extern boolean sched_removereadytorun(FAR _TCB *rtrtcb);
extern boolean sched_addprioritized(FAR _TCB *newTcb,
- NEAR dq_queue_t *list);
+ DSEG dq_queue_t *list);
extern boolean sched_mergepending(void);
extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state);
extern void sched_removeblocked(FAR _TCB *btcb);
diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c
index 249134a98..d8106ed16 100644
--- a/nuttx/sched/os_start.c
+++ b/nuttx/sched/os_start.c
@@ -37,23 +37,25 @@
* Included Files
************************************************************/
-#include <sys/types.h>
-#include <debug.h>
-#include <string.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/compiler.h>
-#include <nuttx/fs.h>
-#include <nuttx/lib.h>
-#include <nuttx/os_external.h>
-#include "os_internal.h"
-#include "sig_internal.h"
-#include "wd_internal.h"
-#include "sem_internal.h"
-#include "mq_internal.h"
-#include "pthread_internal.h"
-#include "clock_internal.h"
-#include "irq_internal.h"
+#include <sys/types.h>
+#include <debug.h>
+#include <string.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/compiler.h>
+#include <nuttx/fs.h>
+#include <nuttx/lib.h>
+#include <nuttx/os_external.h>
+#include "os_internal.h"
+#include "sig_internal.h"
+#include "wd_internal.h"
+#include "sem_internal.h"
+#ifndef CONFIG_DISABLE_MQUEUE
+# include "mq_internal.h"
+#endif
+#include "pthread_internal.h"
+#include "clock_internal.h"
+#include "irq_internal.h"
/************************************************************
* Definitions
@@ -99,19 +101,25 @@ dq_queue_t g_waitingforsemaphore;
/* This is the list of all tasks that are blocked waiting for a signal */
+#ifndef CONFIG_DISABLE_SIGNALS
dq_queue_t g_waitingforsignal;
+#endif
/* This is the list of all tasks that are blocked waiting for a message
* queue to become non-empty.
*/
+#ifndef CONFIG_DISABLE_MQUEUE
dq_queue_t g_waitingformqnotempty;
+#endif
/* This is the list of all tasks that are blocked waiting for a message
* queue to become non-full.
*/
+#ifndef CONFIG_DISABLE_MQUEUE
dq_queue_t g_waitingformqnotfull;
+#endif
/* This the list of all tasks that have been initialized, but not yet
* activated. NOTE: This is the only list that is not prioritized.
@@ -156,9 +164,13 @@ const tasklist_t g_tasklisttable[NUM_TASK_STATES] =
{ &g_readytorun, TRUE }, /* TSTATE_TASK_RUNNING */
{ &g_inactivetasks, FALSE }, /* TSTATE_TASK_INACTIVE */
{ &g_waitingforsemaphore, TRUE }, /* TSTATE_WAIT_SEM */
+#ifndef CONFIG_DISABLE_MQUEUE
{ &g_waitingforsignal, FALSE }, /* TSTATE_WAIT_SIG */
+#endif
+#ifndef CONFIG_DISABLE_MQUEUE
{ &g_waitingformqnotempty, TRUE }, /* TSTATE_WAIT_MQNOTEMPTY */
{ &g_waitingformqnotfull, TRUE } /* TSTATE_WAIT_MQNOTFULL */
+#endif
};
/************************************************************
@@ -200,9 +212,13 @@ void os_start(void)
dq_init(&g_readytorun);
dq_init(&g_pendingtasks);
dq_init(&g_waitingforsemaphore);
+#ifndef CONFIG_DISABLE_MQUEUE
dq_init(&g_waitingforsignal);
+#endif
+#ifndef CONFIG_DISABLE_MQUEUE
dq_init(&g_waitingformqnotfull);
dq_init(&g_waitingformqnotempty);
+#endif
dq_init(&g_inactivetasks);
sq_init(&g_delayeddeallocations);
@@ -300,12 +316,14 @@ void os_start(void)
/* Initialize the signal facility (if in link) */
+#ifndef CONFIG_DISABLE_SIGNALS
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (sig_initialize != NULL)
#endif
{
sig_initialize();
}
+#endif
/* Initialize the semaphore facility. (if in link) */
@@ -318,12 +336,14 @@ void os_start(void)
/* Initialize the named message queue facility (if in link) */
+#ifndef CONFIG_DISABLE_MQUEUE
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (mq_initialize != NULL)
#endif
{
mq_initialize();
}
+#endif
/* Initialize the thread-specific data facility (if in link) */
diff --git a/nuttx/sched/sched_addprioritized.c b/nuttx/sched/sched_addprioritized.c
index 9b0c89e81..788b73263 100644
--- a/nuttx/sched/sched_addprioritized.c
+++ b/nuttx/sched/sched_addprioritized.c
@@ -91,7 +91,7 @@
* match the state associated with the list.
************************************************************/
-boolean sched_addprioritized(FAR _TCB *tcb, NEAR dq_queue_t *list)
+boolean sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list)
{
FAR _TCB *next;
FAR _TCB *prev;
diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c
index fe449b85f..daf42af2f 100644
--- a/nuttx/sched/task_create.c
+++ b/nuttx/sched/task_create.c
@@ -308,8 +308,10 @@ STATUS _task_init(FAR _TCB *tcb, const char *name, int priority,
/* Initialize other (non-zero) elements of the TCB */
+#ifndef CONFIG_DISABLE_SIGNALS
tcb->sigprocmask = ALL_SIGNAL_SET;
- tcb->task_state = TSTATE_TASK_INVALID;
+#endif
+ tcb->task_state = TSTATE_TASK_INVALID;
/* Initialize the processor-specific portion of the TCB */
diff --git a/nuttx/sched/task_delete.c b/nuttx/sched/task_delete.c
index 47d9a868f..f6f2827e1 100644
--- a/nuttx/sched/task_delete.c
+++ b/nuttx/sched/task_delete.c
@@ -37,13 +37,15 @@
* Included Files
************************************************************/
-#include <nuttx/config.h>
+#include <nuttx/config.h>
-#include <sys/types.h>
-#include <sched.h>
-#include <nuttx/os_external.h>
-#include "os_internal.h"
-#include "sig_internal.h"
+#include <sys/types.h>
+#include <sched.h>
+#include <nuttx/os_external.h>
+#include "os_internal.h"
+#ifndef CONFIG_DISABLE_SIGNALS
+# include "sig_internal.h"
+#endif
/************************************************************
* Definitions
@@ -156,7 +158,9 @@ STATUS task_delete(pid_t pid)
/* Deallocate anything left in the TCB's queues */
+#ifndef CONFIG_DISABLE_SIGNALS
sig_cleanup(dtcb); /* Deallocate Signal lists */
+#endif
/* Deallocate its TCB */