aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sidrane <david_s5@nscdg.com>2015-01-23 13:52:43 -1000
committerLorenz Meier <lm@inf.ethz.ch>2015-02-11 07:40:57 +0100
commit9f89d8a93ab250e8f1611e17d84f5d8d44f15fef (patch)
treef948fd0ba9519af2a7474452573e5bc695c766ce
parenteddf288965f8241200c7e6ad6eef398fce32462b (diff)
downloadpx4-firmware-9f89d8a93ab250e8f1611e17d84f5d8d44f15fef.tar.gz
px4-firmware-9f89d8a93ab250e8f1611e17d84f5d8d44f15fef.tar.bz2
px4-firmware-9f89d8a93ab250e8f1611e17d84f5d8d44f15fef.zip
Using Nuttx stack assessment itnerfaces
-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
-rw-r--r--src/systemcmds/top/top.c21
5 files changed, 16 insertions, 9 deletions
diff --git a/nuttx-configs/aerocore/nsh/defconfig b/nuttx-configs/aerocore/nsh/defconfig
index 80df3bebb..c62ed29b9 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 a40816868..eae796a9c 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 ba39a3125..d1c9422bc 100644
--- a/nuttx-configs/px4fmu-v2/nsh/defconfig
+++ b/nuttx-configs/px4fmu-v2/nsh/defconfig
@@ -429,6 +429,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/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,