summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-07 01:54:59 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-07 01:54:59 +0000
commit0a143e4c2dfae5e5b9e1000fd83ce5d05a84d6aa (patch)
tree655d2b930b49f60fb64154d8be99e45612987f15
parent20ff4c56d20fe8c22d6ac44c02efd1252b32ade6 (diff)
downloadnuttx-0a143e4c2dfae5e5b9e1000fd83ce5d05a84d6aa.tar.gz
nuttx-0a143e4c2dfae5e5b9e1000fd83ce5d05a84d6aa.tar.bz2
nuttx-0a143e4c2dfae5e5b9e1000fd83ce5d05a84d6aa.zip
Fix AVR build, Add hooks for kernel threads
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3477 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xapps/examples/thttpd/content/tasks/tasks.c12
-rw-r--r--apps/nshlib/nsh_proccmds.c10
-rw-r--r--misc/buildroot/ChangeLog3
-rw-r--r--nuttx/Documentation/NuttX.html14
-rw-r--r--nuttx/arch/avr/src/Makefile5
-rw-r--r--nuttx/arch/hc/src/common/up_doirq.c2
-rwxr-xr-xnuttx/arch/hc/src/common/up_internal.h2
-rw-r--r--nuttx/include/nuttx/sched.h12
-rw-r--r--nuttx/sched/exit.c2
-rw-r--r--nuttx/sched/pthread_create.c2
-rw-r--r--nuttx/sched/sched_releasetcb.c6
11 files changed, 51 insertions, 19 deletions
diff --git a/apps/examples/thttpd/content/tasks/tasks.c b/apps/examples/thttpd/content/tasks/tasks.c
index 13ba5cbb6..780569090 100755
--- a/apps/examples/thttpd/content/tasks/tasks.c
+++ b/apps/examples/thttpd/content/tasks/tasks.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/thttpd/tasks/tasks.c
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,14 @@ static const char *g_statenames[] =
#endif
};
+static const char *g_ttypenames[4] =
+{
+ "TASK ",
+ "PTHREAD",
+ "KTHREAD",
+ "--?-- "
+};
+
/****************************************************************************
* Public Data
****************************************************************************/
@@ -104,7 +112,7 @@ static const char *g_statenames[] =
printf("%5d %3d %4s %7s%c%c %8s ",
tcb->pid, tcb->sched_priority,
tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO",
- tcb->flags & TCB_FLAG_PTHREAD ? "PTHREAD" : "TASK ",
+ g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT],
tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ',
tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ',
g_statenames[tcb->task_state]);
diff --git a/apps/nshlib/nsh_proccmds.c b/apps/nshlib/nsh_proccmds.c
index 7abd50ec1..8ae201123 100644
--- a/apps/nshlib/nsh_proccmds.c
+++ b/apps/nshlib/nsh_proccmds.c
@@ -86,6 +86,14 @@ static const char *g_statenames[] =
"MQNFULL "
#endif
};
+
+static const char *g_ttypenames[4] =
+{
+ "TASK ",
+ "PTHREAD",
+ "KTHREAD",
+ "--?-- "
+};
#endif
/****************************************************************************
@@ -111,7 +119,7 @@ static void ps_task(FAR _TCB *tcb, FAR void *arg)
nsh_output(vtbl, "%5d %3d %4s %7s%c%c %8s ",
tcb->pid, tcb->sched_priority,
tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO",
- tcb->flags & TCB_FLAG_PTHREAD ? "PTHREAD" : "TASK ",
+ g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT],
tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ',
tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ',
g_statenames[tcb->task_state]);
diff --git a/misc/buildroot/ChangeLog b/misc/buildroot/ChangeLog
index c871bdd49..cbd6c774c 100644
--- a/misc/buildroot/ChangeLog
+++ b/misc/buildroot/ChangeLog
@@ -91,5 +91,8 @@ buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr>
under Cygwin.
* Makefile - Alter copy arguements to avoid permissions problems when
copying NuttX header files.
+ * toolchain/nxflat/nxflat.mk and Makefile - Fix include paths.
+ * toolchain/gcc/3.3.6 - Added a patch to fixed compilation error on Ubuntu
+ 9.10.
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 5721c5eff..891e619bb 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: April 3, 2011</p>
+ <p>Last Updated: April 6, 2011</p>
</td>
</tr>
</table>
@@ -2201,6 +2201,15 @@ nuttx-6.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
separately linked images: (1) a kernel-mode RTOS image, and (2) a user-
mode application image that communicates to the RTOS kernel via system
calls. A lot more still must be done.
+ * user_initialize(): Eliminated the user_initialize() initialization hook.
+ It is difficult to maintain and redundant: Board level initialization
+ an up_initialize() provide the same kind of capability.
+ * arch/*/include/*/type.h: On some compilers, char defaults as unsigned.
+ Explicitly add signed to integer types if signed is what is required.
+ * arch/*: For all architectures -- Global register state save structure
+ (usually called current_regs) should be marked volatile; Added general
+ capability to support nested interrupts (not fully realized for all
+ architectures).
apps-6.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
@@ -2228,6 +2237,9 @@ buildroot-1.10 2011-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
* Makefile - Alter copy arguements to avoid permissions problems when
copying NuttX header files.
* toolchain/nxflat/nxflat.mk and Makefile - Fix include paths.
+ * toolchain/gcc/3.3.6 - Added a patch to fixed compilation error on Ubuntu
+ 9.10.
+
</pre></ul>
<table width ="100%">
diff --git a/nuttx/arch/avr/src/Makefile b/nuttx/arch/avr/src/Makefile
index 531a2100d..1704aad62 100644
--- a/nuttx/arch/avr/src/Makefile
+++ b/nuttx/arch/avr/src/Makefile
@@ -108,11 +108,6 @@ nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
-ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
- @export flashloc=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _eronly | cut -d' ' -f1`; \
- $(OBJCOPY) $(OBJCOPYARGS) --adjust-section-vma=.data=0x$$flashloc $(NUTTX)$(EXEEXT) $(NUTTX).flashimage
- @mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT)
-endif
@$(NM) $(NUTTX)$(EXEEXT) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
diff --git a/nuttx/arch/hc/src/common/up_doirq.c b/nuttx/arch/hc/src/common/up_doirq.c
index adb3f81ce..4fc52224e 100644
--- a/nuttx/arch/hc/src/common/up_doirq.c
+++ b/nuttx/arch/hc/src/common/up_doirq.c
@@ -101,7 +101,7 @@ uint8_t *up_doirq(int irq, uint8_t *regs)
* switch occurred during interrupt processing.
*/
- regs = current_regs;
+ regs = (uint8_t*)current_regs;
/* Restore the previous value of current_regs. NULL would indicate that
* we are no longer in an interrupt handler. It will be non-NULL if we
diff --git a/nuttx/arch/hc/src/common/up_internal.h b/nuttx/arch/hc/src/common/up_internal.h
index 1a30f28e5..efc4ce4b0 100755
--- a/nuttx/arch/hc/src/common/up_internal.h
+++ b/nuttx/arch/hc/src/common/up_internal.h
@@ -101,7 +101,7 @@ typedef void (*up_vector_t)(void);
* structure. If is non-NULL only during interrupt processing.
*/
-extern uint8_t *current_regs;
+extern volatile uint8_t *current_regs;
/* This is the beginning of heap as provided from processor-specific logic.
* This is the first address in RAM after the loaded program+bss+idle stack.
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 1b5d28f82..78e6f6b37 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -66,10 +66,14 @@
/* Values for the _TCB flags flag bits */
-#define TCB_FLAG_PTHREAD 0x0001 /* Thread is a pthread */
-#define TCB_FLAG_NONCANCELABLE 0x0002 /* Pthread is non-cancelable */
-#define TCB_FLAG_CANCEL_PENDING 0x0004 /* Pthread cancel is pending */
-#define TCB_FLAG_ROUND_ROBIN 0x0008 /* Round robin sched enabled */
+#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */
+#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT)
+# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */
+# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */
+# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */
+#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */
+#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */
+#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */
/********************************************************************************
* Global Type Definitions
diff --git a/nuttx/sched/exit.c b/nuttx/sched/exit.c
index 93e24a29d..6793eae77 100644
--- a/nuttx/sched/exit.c
+++ b/nuttx/sched/exit.c
@@ -91,7 +91,9 @@
void exit(int status)
{
+#if CONFIG_NFILE_STREAMS > 0 || defined(CONFIG_SCHED_WAITPID) || defined(CONFIG_SCHED_ATEXIT)
_TCB *tcb = (_TCB*)g_readytorun.head;
+#endif
/* Only the lower 8 bits of the exit status are used */
diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c
index d1f838a9e..e247ce372 100644
--- a/nuttx/sched/pthread_create.c
+++ b/nuttx/sched/pthread_create.c
@@ -354,7 +354,7 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Mark this task as a pthread */
- ptcb->flags |= TCB_FLAG_PTHREAD;
+ ptcb->flags |= TCB_FLAG_TTYPE_PTHREAD;
/* Configure the TCB for a pthread receiving on parameter
* passed by value
diff --git a/nuttx/sched/sched_releasetcb.c b/nuttx/sched/sched_releasetcb.c
index 2be77b77b..5fd509006 100644
--- a/nuttx/sched/sched_releasetcb.c
+++ b/nuttx/sched/sched_releasetcb.c
@@ -151,11 +151,11 @@ int sched_releasetcb(FAR _TCB *tcb)
}
#endif
- /* Release command line arguments that were allocated
- * for task start/re-start.
+ /* Release command line arguments that were allocated for task
+ * start/re-start.
*/
- if ((tcb->flags & TCB_FLAG_PTHREAD) == 0)
+ if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_TASK)
{
for (i = 1; i < CONFIG_MAX_TASK_ARGS+1 && tcb->argv[i]; i++)
{