aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sidrane <david_s5@nscdg.com>2015-01-23 13:52:43 -1000
committerDavid Sidrane <david_s5@nscdg.com>2015-01-23 13:52:43 -1000
commit536e22ce8cb2a87ac5a711152156ef342321375f (patch)
treed9a6aa8149839732a619248517997eb7705e95f0
parent84b3b03c8de2e4d987c6c7b77dbda21f484af2b1 (diff)
downloadpx4-firmware-536e22ce8cb2a87ac5a711152156ef342321375f.tar.gz
px4-firmware-536e22ce8cb2a87ac5a711152156ef342321375f.tar.bz2
px4-firmware-536e22ce8cb2a87ac5a711152156ef342321375f.zip
Using Nuttx stack assessment itnerfaces
m---------NuttX0
-rw-r--r--nuttx-configs/aerocore/nsh/defconfig1
-rw-r--r--nuttx-configs/px4fmu-v1/nsh/defconfig1
-rw-r--r--nuttx-configs/px4fmu-v2/nsh/defconfig1
-rwxr-xr-xnuttx-configs/px4io-v1/nsh/defconfig1
-rwxr-xr-xnuttx-configs/px4io-v2/nsh/defconfig1
-rw-r--r--src/systemcmds/top/top.c21
7 files changed, 17 insertions, 9 deletions
diff --git a/NuttX b/NuttX
-Subproject ab0606836b66156a540a8cdea9a0721687a989d
+Subproject 1514241953498c8000dc20ee54424d4766004db
diff --git a/nuttx-configs/aerocore/nsh/defconfig b/nuttx-configs/aerocore/nsh/defconfig
index 141e1d9a0..dcb132e01 100644
--- a/nuttx-configs/aerocore/nsh/defconfig
+++ b/nuttx-configs/aerocore/nsh/defconfig
@@ -318,6 +318,7 @@ CONFIG_ARCH_DMA=y
# CONFIG_ADDRENV is not set
CONFIG_ARCH_HAVE_VFORK=y
CONFIG_ARCH_STACKDUMP=y
+CONFIG_STACK_COLORATION=y
# CONFIG_ENDIAN_BIG is not set
# CONFIG_ARCH_HAVE_RAMFUNCS is not set
CONFIG_ARCH_HAVE_RAMVECTORS=y
diff --git a/nuttx-configs/px4fmu-v1/nsh/defconfig b/nuttx-configs/px4fmu-v1/nsh/defconfig
index f5adc4c4a..5bb7bed15 100644
--- a/nuttx-configs/px4fmu-v1/nsh/defconfig
+++ b/nuttx-configs/px4fmu-v1/nsh/defconfig
@@ -407,6 +407,7 @@ CONFIG_ARCH_HAVE_MPU=y
# CONFIG_ARCH_USE_MPU is not set
# CONFIG_ARCH_IRQPRIO is not set
CONFIG_ARCH_STACKDUMP=y
+CONFIG_STACK_COLORATION=y
# CONFIG_ENDIAN_BIG is not set
# CONFIG_ARCH_IDLE_CUSTOM is not set
# CONFIG_ARCH_HAVE_RAMFUNCS is not set
diff --git a/nuttx-configs/px4fmu-v2/nsh/defconfig b/nuttx-configs/px4fmu-v2/nsh/defconfig
index 2aeef89b5..f56b3f7d8 100644
--- a/nuttx-configs/px4fmu-v2/nsh/defconfig
+++ b/nuttx-configs/px4fmu-v2/nsh/defconfig
@@ -428,6 +428,7 @@ CONFIG_ARCH_HAVE_MPU=y
# CONFIG_ARCH_USE_MPU is not set
# CONFIG_ARCH_IRQPRIO is not set
CONFIG_ARCH_STACKDUMP=y
+CONFIG_STACK_COLORATION=y
# CONFIG_ENDIAN_BIG is not set
# CONFIG_ARCH_IDLE_CUSTOM is not set
# CONFIG_ARCH_HAVE_RAMFUNCS is not set
diff --git a/nuttx-configs/px4io-v1/nsh/defconfig b/nuttx-configs/px4io-v1/nsh/defconfig
index 54161dc77..10a278801 100755
--- a/nuttx-configs/px4io-v1/nsh/defconfig
+++ b/nuttx-configs/px4io-v1/nsh/defconfig
@@ -372,6 +372,7 @@ CONFIG_ARCH_HAVE_MPU=y
# CONFIG_ARCH_USE_MPU is not set
# CONFIG_ARCH_IRQPRIO is not set
CONFIG_ARCH_STACKDUMP=y
+CONFIG_STACK_COLORATION=y
# CONFIG_ENDIAN_BIG is not set
# CONFIG_ARCH_IDLE_CUSTOM is not set
# CONFIG_ARCH_HAVE_RAMFUNCS is not set
diff --git a/nuttx-configs/px4io-v2/nsh/defconfig b/nuttx-configs/px4io-v2/nsh/defconfig
index 00cf17427..bfd6f9ba9 100755
--- a/nuttx-configs/px4io-v2/nsh/defconfig
+++ b/nuttx-configs/px4io-v2/nsh/defconfig
@@ -43,6 +43,7 @@ CONFIG_ARCH_MATH_H=y
#
# CONFIG_DEBUG is not set
CONFIG_ARCH_HAVE_STACKCHECK=y
+CONFIG_STACK_COLORATION=y
CONFIG_ARCH_HAVE_HEAPCHECK=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ARCH_HAVE_CUSTOMOPT=y
diff --git a/src/systemcmds/top/top.c b/src/systemcmds/top/top.c
index 37e913040..03a049386 100644
--- a/src/systemcmds/top/top.c
+++ b/src/systemcmds/top/top.c
@@ -41,6 +41,7 @@
*/
#include <nuttx/config.h>
+#include <nuttx/arch.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdbool.h>
@@ -217,18 +218,20 @@ top_main(void)
);
}
- unsigned stack_size = (uintptr_t)system_load.tasks[i].tcb->adj_stack_ptr -
- (uintptr_t)system_load.tasks[i].tcb->stack_alloc_ptr;
- unsigned stack_free = 0;
- uint8_t *stack_sweeper = (uint8_t *)system_load.tasks[i].tcb->stack_alloc_ptr;
- while (stack_free < stack_size) {
- if (*stack_sweeper++ != 0xff)
- break;
+ size_t stack_size = system_load.tasks[i].tcb->adj_stack_size;
+ ssize_t stack_free = 0;
- stack_free++;
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+ if (system_load.tasks[i].tcb->pid == 0) {
+ stack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
+ stack_free = up_check_intstack_remain();
+ } else {
+#endif
+ stack_free = up_check_tcbstack_remain(system_load.tasks[i].tcb);
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
}
-
+#endif
printf(CL "%4d %*-s %8lld %2d.%03d %5u/%5u %3u (%3u) ",
system_load.tasks[i].tcb->pid,
CONFIG_TASK_NAME_SIZE, system_load.tasks[i].tcb->name,