summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-31 02:21:12 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-08-31 02:21:12 +0000
commita66cf9d6e86bc95a25e21e746000e602e6f1ecbc (patch)
tree21c35973ac5cd59ec676a68423140c3a42ce4231
parente3dbd274922d727842086ad42df644308dfc668d (diff)
downloadpx4-nuttx-a66cf9d6e86bc95a25e21e746000e602e6f1ecbc.tar.gz
px4-nuttx-a66cf9d6e86bc95a25e21e746000e602e6f1ecbc.tar.bz2
px4-nuttx-a66cf9d6e86bc95a25e21e746000e602e6f1ecbc.zip
Add paging debug instrumentation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2899 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/Documentation/NuttX.html15
-rw-r--r--nuttx/arch/arm/src/arm/up_dataabort.c6
-rw-r--r--nuttx/arch/arm/src/arm/up_prefetchabort.c5
-rw-r--r--nuttx/arch/arm/src/lpc313x/lpc313x_spi.c5
-rwxr-xr-xnuttx/configs/ea3131/pgnsh/defconfig5
-rwxr-xr-xnuttx/configs/ea3131/pgnsh/ld.script50
-rwxr-xr-xnuttx/configs/ea3131/src/up_fillpage.c2
-rw-r--r--nuttx/examples/nsh/nsh_main.c9
-rw-r--r--nuttx/sched/pg_miss.c6
-rwxr-xr-xnuttx/sched/pg_worker.c30
11 files changed, 103 insertions, 33 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 9aa4e40fa..30b843a9d 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -1247,3 +1247,6 @@
- Replace any occurrences of lib$(CONFIG_EXAMPLE)$(LIBEXT)
with libapp$(LIBEXT) in your Makefiles.
- Check any other occurrences of CONFIG_EXAMPLE.
+
+ * arch/arm/src/lpc313x/lpc313x_spi.c - Fix compilation error when
+ when CONFIG_DEBUG is enabled.
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 80b7d5bd1..fe69cc76a 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: August 28, 2010</p>
+ <p>Last Updated: August 30, 2010</p>
</td>
</tr>
</table>
@@ -1864,7 +1864,7 @@ nuttx-5.9 2010-08-25 Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* configs/ntosd-dm320 and arch/arm/src/dm320 - Add support for the
Neuros production OSD (changes contributed by bf.nuttx).
-pascal-2.0 2010-12-21 Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+pascal-2.0 2009-12-21 Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Updated to use standard C99 types in stdint.h and
stdbool.h. This change was necessary for compatibility
@@ -1920,7 +1920,18 @@ nuttx-5.10 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
with libapp$(LIBEXT) in your Makefiles.
- Check any other occurrences of CONFIG_EXAMPLE.pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+ * arch/arm/src/lpc313x/lpc313x_spi.c - Fix compilation error when
+ when CONFIG_DEBUG is enabled.
+
+pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+
buildroot-1.9 2010-xx-xx <spudmonkey@racsa.co.cr>
+
+ * configs/arm926t-defconfig-4.3.3: update arm926t-defconfig-4.2.4
+ * configs/arm926t-defconfig-nxflat: NXFLAT-only configuration for
+ arm926
+ * toolchain/gdb/gdb.mk - Remove ncurses dependency from gdb_target target.
+
</pre></ul>
<table width ="100%">
diff --git a/nuttx/arch/arm/src/arm/up_dataabort.c b/nuttx/arch/arm/src/arm/up_dataabort.c
index 5ad67a9c6..49eb5b6a6 100644
--- a/nuttx/arch/arm/src/arm/up_dataabort.c
+++ b/nuttx/arch/arm/src/arm/up_dataabort.c
@@ -123,6 +123,7 @@ void up_dataabort(uint32_t *regs, uint32_t far, uint32_t fsr)
* fatal error.
*/
+ pglldbg("FSR: %08x FAR: %08x\n", fsr, far);
if ((fsr & FSR_MASK) != FSR_PAGE)
{
goto segfault;
@@ -133,6 +134,7 @@ void up_dataabort(uint32_t *regs, uint32_t far, uint32_t fsr)
* (It has not yet been saved in the register context save area).
*/
+ pgllvdbg("VBASE: %08x VEND: %08x\n", PG_PAGED_VBASE, PG_PAGED_VEND);
if (far < PG_PAGED_VBASE || far >= PG_PAGED_VEND)
{
goto segfault;
@@ -162,7 +164,7 @@ void up_dataabort(uint32_t *regs, uint32_t far, uint32_t fsr)
return;
segfault:
- lldbg("Data abort at PC: %x FAR: %08x FSR: %08x\n", regs[REG_PC], far, fsr);
+ lldbg("Data abort. PC: %08x FAR: %08x FSR: %08x\n", regs[REG_PC], far, fsr);
PANIC(OSERR_ERREXCEPTION);
}
@@ -178,7 +180,7 @@ void up_dataabort(uint32_t *regs)
/* Crash -- possibly showing diagnost debug information. */
- lldbg("Data abort at %08x\n", regs[REG_PC]);
+ lldbg("Data abort. PC: %08x\n", regs[REG_PC]);
PANIC(OSERR_ERREXCEPTION);
}
diff --git a/nuttx/arch/arm/src/arm/up_prefetchabort.c b/nuttx/arch/arm/src/arm/up_prefetchabort.c
index 14451fbab..ea70a2ff5 100644
--- a/nuttx/arch/arm/src/arm/up_prefetchabort.c
+++ b/nuttx/arch/arm/src/arm/up_prefetchabort.c
@@ -105,6 +105,9 @@ void up_prefetchabort(uint32_t *regs)
* virtual addresses.
*/
+ pglldbg("VADDR: %08x VBASE: %08x VEND: %08x\n",
+ regs[REG_PC], PG_PAGED_VBASE, PG_PAGED_VEND);
+
if (regs[REG_R15] >= PG_PAGED_VBASE && regs[REG_R15] < PG_PAGED_VEND)
{
/* Save the offending PC as the fault address in the TCB of the currently
@@ -133,7 +136,7 @@ void up_prefetchabort(uint32_t *regs)
else
#endif
{
- lldbg("Prefetch abort at %08x\n", regs[REG_PC]);
+ lldbg("Prefetch abort. PC: %08x\n", regs[REG_PC]);
PANIC(OSERR_ERREXCEPTION);
}
}
diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c b/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c
index 780969576..98c3dc64d 100644
--- a/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c
+++ b/nuttx/arch/arm/src/lpc313x/lpc313x_spi.c
@@ -1,7 +1,7 @@
/************************************************************************************
* arm/arm/src/lpc313x/lpc313x_spi.c
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -568,8 +568,7 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
{
FAR struct lpc313x_spidev_s *priv = (FAR struct lpc313x_spidev_s *)dev;
-
- DEBUGASSERT(priv && priv->spibase);
+ DEBUGASSERT(priv);
spi_writeword(priv, wd);
return spi_readword(priv);
diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig
index 58480f875..8f5082eea 100755
--- a/nuttx/configs/ea3131/pgnsh/defconfig
+++ b/nuttx/configs/ea3131/pgnsh/defconfig
@@ -301,6 +301,7 @@ CONFIG_APP_DIR=examples/nsh
CONFIG_DEBUG=n
CONFIG_DEBUG_VERBOSE=n
CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_PAGING=n
CONFIG_MM_REGIONS=1
CONFIG_ARCH_LOWPUTC=y
CONFIG_RR_INTERVAL=200
@@ -407,12 +408,12 @@ CONFIG_SIG_SIGWORK=4
#
CONFIG_PAGING=y
CONFIG_PAGING_PAGESIZE=1024
-CONFIG_PAGING_NLOCKED=36
+CONFIG_PAGING_NLOCKED=48
#CONFIG_PAGING_LOCKED_PBASE
#CONFIG_PAGING_LOCKED_VBASE
CONFIG_PAGING_NPPAGED=96
CONFIG_PAGING_NVPAGED=384
-CONFIG_PAGING_NDATA=44
+CONFIG_PAGING_NDATA=32
#CONFIG_PAGING_DEFPRIO
CONFIG_PAGING_STACKSIZE=2048
CONFIG_PAGING_BLOCKINGFILL=y
diff --git a/nuttx/configs/ea3131/pgnsh/ld.script b/nuttx/configs/ea3131/pgnsh/ld.script
index ba5030bdd..eb77ecaff 100755
--- a/nuttx/configs/ea3131/pgnsh/ld.script
+++ b/nuttx/configs/ea3131/pgnsh/ld.script
@@ -42,20 +42,35 @@
* address space: 0x1102 8000. The virtual space is broken up into three
* regions:
*
- * locked - Pages locked in memory. Start: 0x1102 8000 Size: 36Kb
- * paged - Pages in nonvolatile store. Start: 0x1103 1000 Size: 384Kb
- * data - .data/.bss/heap. Start: 0x1109 1000 Size: 44Kb
+ * PHYSICAL VIRTUAL
+ * NAME DESCRIPTION SIZE START SIZE START
+ * -------- -------------------------- ----- ----------- ------- -----------
+ * locked Pages locked in memory. 48Kb 0x1102 8000 48Kb 0x1102 8000
+ * paged Pages in nonvolatile store. 96Kb 0x1103 4000 384Kb 0x1103 4000
+ * data .data/.bss/heap. 32Kb 0x1104 c000 32Kb 0x1109 4000
+ * Reserved for page table 16Kb 0x1105 4000 16Kb 0x1109 c000
+ * -------- -------------------------- ----- ----------- ------- -----------
+ * 192Kb 0x1105 8000 480Kb 0x110a 0000
*
* These region sizes must match the size in pages specified for each region
* in the NuttX configuration file: CONFIG_PAGING_NLOCKED, CONFIG_PAGING_NVPAGED,
* and CONFIG_PAGING_NDATA.
+ *
+ * NOTE 1: The locked region is really big here so that you can enable lots of
+ * debug output without overflowing the locked region. 32Kb would probably be
+ * plenty if this were a real, optimized application.
+ *
+ * NOTE 2: Different compilers will compile the code to different sizes. If you
+ * get a link time error saying that the locked region is full, you may have to
+ * re-organize this memory layout (here and in defconfig) to make the locked
+ * region even bigger.
*/
MEMORY
{
- locked (rx) : ORIGIN = 0x11029080, LENGTH = 36K - 4224
- paged (rx) : ORIGIN = 0x11031000, LENGTH = 384K
- data (rw) : ORIGIN = 0x11091000, LENGTH = 44K
+ locked (rx) : ORIGIN = 0x11029080, LENGTH = 48K - 4224
+ paged (rx) : ORIGIN = 0x11034000, LENGTH = 384K
+ data (rw) : ORIGIN = 0x11094000, LENGTH = 44K
}
OUTPUT_ARCH(arm)
@@ -65,18 +80,19 @@ SECTIONS
.locked : {
_slocked = ABSOLUTE(.);
*(.vectors)
- locked.r (.text .text.*)
- locked.r (.fixup)
- locked.r (.gnu.warning)
- locked.r (.rodata .rodata.*)
- locked.r (.gnu.linkonce.t.*)
- locked.r (.glue_7)
- locked.r (.glue_7t)
- locked.r (.got)
- locked.r (.gcc_except_table)
- locked.r (.gnu.linkonce.r.*)
+ up_head.o locked.r (.text .text.*)
+ up_head.o locked.r (.fixup)
+ up_head.o locked.r (.gnu.warning)
+ up_head.o locked.r (.rodata .rodata.*)
+ up_head.o locked.r (.gnu.linkonce.t.*)
+ up_head.o locked.r (.glue_7)
+ up_head.o locked.r (.glue_7t)
+ up_head.o locked.r (.got)
+ up_head.o locked.r (.gcc_except_table)
+ up_head.o locked.r (.gnu.linkonce.r.*)
_elocked = ABSOLUTE(.);
} >locked
+
_eronly = ABSOLUTE(.);
.paged : {
@@ -94,8 +110,6 @@ SECTIONS
_epaged = ABSOLUTE(.);
} > paged
- _eronly = ABSOLUTE(.);
-
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
diff --git a/nuttx/configs/ea3131/src/up_fillpage.c b/nuttx/configs/ea3131/src/up_fillpage.c
index be355fffe..b9a97f684 100755
--- a/nuttx/configs/ea3131/src/up_fillpage.c
+++ b/nuttx/configs/ea3131/src/up_fillpage.c
@@ -112,12 +112,14 @@
#ifdef CONFIG_PAGING_BLOCKINGFILL
int up_fillpage(FAR _TCB *tcb, FAR void *vpage)
{
+ pglldbg("TCB: %p vpage: %d far: %08x\n", tcb, vpage, tcb->xcp.far);
# warning "Not implemented"
return -ENOSYS;
}
#else
int up_fillpage(FAR _TCB *tcb, FAR void *vpage, up_pgcallback_t pg_callback)
{
+ pglldbg("TCB: %p vpage: %d far: %08x\n", tcb, vpage, tcb->xcp.far);
# warning "Not implemented"
return -ENOSYS;
}
diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c
index f41d2e450..046ab562f 100644
--- a/nuttx/examples/nsh/nsh_main.c
+++ b/nuttx/examples/nsh/nsh_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_main.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -958,10 +958,17 @@ static inline int nsh_nice(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd, FAR ch
* Name: user_initialize
****************************************************************************/
+/* In order to support user_initialize if CONFIG_PAGING is defined, this
+ * function (and only this function) would need to get moved to the locked
+ * text region.
+ */
+
+#ifndef CONFIG_PAGING
void user_initialize(void)
{
/* stub */
}
+#endif
/****************************************************************************
* Name: user_start
diff --git a/nuttx/sched/pg_miss.c b/nuttx/sched/pg_miss.c
index ff57081eb..7abf0e2c2 100644
--- a/nuttx/sched/pg_miss.c
+++ b/nuttx/sched/pg_miss.c
@@ -39,8 +39,8 @@
#include <nuttx/config.h>
-#include <debug.h>
#include <errno.h>
+#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
@@ -132,6 +132,7 @@ void pg_miss(void)
* always present in memory.
*/
+ pglldbg("Blocking TCB: %p PID: %d\n", ftcb, ftcb->pid);
DEBUGASSERT(g_pgworker != ftcb->pid);
/* Block the currently executing task
@@ -158,6 +159,8 @@ void pg_miss(void)
{
/* Reprioritize the page fill worker thread */
+ pgllvdbg("New worker priority. %d->%d\n",
+ wtcb->sched_priority, ftcb->sched_priority);
sched_setpriority(wtcb, ftcb->sched_priority);
}
@@ -168,6 +171,7 @@ void pg_miss(void)
if (!g_pftcb)
{
+ pglldbg("Signaling worker. PID: %d\n", g_pgworker);
kill(g_pgworker, SIGWORK);
}
}
diff --git a/nuttx/sched/pg_worker.c b/nuttx/sched/pg_worker.c
index ba201f565..2ee0b3904 100755
--- a/nuttx/sched/pg_worker.c
+++ b/nuttx/sched/pg_worker.c
@@ -160,6 +160,7 @@ static void pg_callback(FAR _TCB *tcb, int result)
{
/* Verify that g_pftcb is non-NULL */
+ pgllvdbg("g_pftcb: %p\n", g_pftcb);
if (g_pftcb)
{
FAR _TCB *htcb = (FAR _TCB *)g_waitingforfill.head;
@@ -185,6 +186,8 @@ static void pg_callback(FAR _TCB *tcb, int result)
if (priority > wtcb->sched_priority)
{
+ pgllvdbg("New worker priority. %d->%d\n",
+ wtcb->sched_priority, priority);
sched_setpriority(wtcb, priority);
}
@@ -197,9 +200,10 @@ static void pg_callback(FAR _TCB *tcb, int result)
g_fillresult = result;
}
- /* Signal the page fill worker thread (in any event) */
+ /* Signal the page fill worker thread (in any event) */
- kill(g_pgworker, SIGWORK);
+ pglldbg("Signaling worker. PID: %d\n", g_pgworker);
+ kill(g_pgworker, SIGWORK);
}
#endif
@@ -246,6 +250,7 @@ static inline bool pg_dequeue(void)
/* Remove the TCB from the head of the list (if any) */
g_pftcb = (FAR _TCB *)dq_remfirst((dq_queue_t*)&g_waitingforfill);
+ pgllvdbg("g_pftcb: %p\n", g_pftcb);
if (g_pftcb != NULL)
{
/* Call the architecture-specific function up_checkmapping() to see if
@@ -291,6 +296,8 @@ static inline bool pg_dequeue(void)
/* Reduce the priority of the page fill worker thread */
+ pgllvdbg("New worker priority. %d->%d\n",
+ wtcb->sched_priority, priority);
sched_setpriority(wtcb, priority);
}
@@ -305,6 +312,7 @@ static inline bool pg_dequeue(void)
* virtual address space -- just restart it.
*/
+ pglldbg("Restarting TCB: %p\n", g_pftcb);
up_unblock_task(g_pftcb);
}
}
@@ -360,6 +368,7 @@ static inline bool pg_startfill(void)
* a page in-use, un-map it, and make it available.
*/
+ pgllvdbg("Call up_allocpage(%p)\n", g_pftcb);
result = up_allocpage(g_pftcb, &vpage);
DEBUGASSERT(result == OK);
@@ -376,6 +385,7 @@ static inline bool pg_startfill(void)
* status of the fill will be provided by return value from up_fillpage().
*/
+ pgllvdbg("Call up_fillpage(%p)\n", g_pftcb);
result = up_fillpage(g_pftcb, vpage);
DEBUGASSERT(result == OK);
#else
@@ -388,6 +398,7 @@ static inline bool pg_startfill(void)
* This callback will probably from interrupt level.
*/
+ pgllvdbg("Call up_fillpage(%p)\n", g_pftcb);
result = up_fillpage(g_pftcb, vpage, pg_callback);
DEBUGASSERT(result == OK);
@@ -412,6 +423,8 @@ static inline bool pg_startfill(void)
#endif /* CONFIG_PAGING_BLOCKINGFILL */
return true;
}
+
+ pglldbg("Queue empty\n");
return false;
}
@@ -443,6 +456,8 @@ static inline void pg_alldone(void)
{
FAR _TCB *wtcb = (FAR _TCB *)g_readytorun.head;
g_pftcb = NULL;
+ pgllvdbg("New worker priority. %d->%d\n",
+ wtcb->sched_priority, CONFIG_PAGING_DEFPRIO);
sched_setpriority(wtcb, CONFIG_PAGING_DEFPRIO);
}
@@ -477,6 +492,7 @@ static inline void pg_fillcomplete(void)
* received the fill ready-to-run.
*/
+ pglldbg("Restarting TCB: %p\n", g_pftcb);
up_unblock_task(g_pftcb);
}
@@ -520,6 +536,7 @@ int pg_worker(int argc, char *argv[])
* fill completions should occur while this thread sleeps.
*/
+ pglldbg("Started\n");
flags = irqsave();
for (;;)
{
@@ -567,6 +584,7 @@ int pg_worker(int argc, char *argv[])
* task that was blocked waiting for this page fill.
*/
+ pglldbg("Restarting TCB: %p\n", g_pftcb);
up_unblock_task(g_pftcb);;
/* Yes .. Start the next asynchronous fill. Check the return
@@ -574,6 +592,7 @@ int pg_worker(int argc, char *argv[])
* no fill was started).
*/
+ pgllvdbg("Calling pg_startfill\n");
if (!pg_startfill())
{
/* No fill was started. This can mean only that all queued
@@ -581,6 +600,7 @@ int pg_worker(int argc, char *argv[])
* nothing more to do.
*/
+ pgllvdbg("Call pg_alldone()\n");
pg_alldone();
}
}
@@ -592,7 +612,7 @@ int pg_worker(int argc, char *argv[])
#ifdef CONFIG_PAGING_TIMEOUT_TICKS
else
{
- dbg("Timeout!\n");
+ lldbg("Timeout!\n");
ASSERT(g_system_timer - g_starttime < CONFIG_PAGING_TIMEOUT_TICKS);
}
#endif
@@ -610,6 +630,7 @@ int pg_worker(int argc, char *argv[])
* g_pftcb).
*/
+ pgllvdbg("Calling pg_startfill\n");
(void)pg_startfill();
}
#else
@@ -624,6 +645,7 @@ int pg_worker(int argc, char *argv[])
* (false means that no fill was perforemd).
*/
+ pgllvdbg("Calling pg_startfill\n");
if (!pg_startfill())
{
/* Break out of the loop -- there is nothing more to do */
@@ -638,11 +660,13 @@ int pg_worker(int argc, char *argv[])
* returns true.
*/
+ pgllvdbg("Restarting TCB: %p\n", g_pftcb);
up_unblock_task(g_pftcb);;
}
/* All queued fills have been processed */
+ pgllvdbg("Call pg_alldone()\n");
pg_alldone();
#endif
}