diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-10-22 12:05:39 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-10-22 12:05:39 -0600 |
commit | fe7b49cb3a1cabc7be4ef0718f87974f81d76817 (patch) | |
tree | 6bd158df53e850b0be4c0061952c7bc0835107aa /apps/system/stackmonitor | |
parent | a591b7d0d6ab1e343c42f02f6bac1833f771a26f (diff) | |
download | px4-nuttx-fe7b49cb3a1cabc7be4ef0718f87974f81d76817.tar.gz px4-nuttx-fe7b49cb3a1cabc7be4ef0718f87974f81d76817.tar.bz2 px4-nuttx-fe7b49cb3a1cabc7be4ef0718f87974f81d76817.zip |
Fix compile problems introduced when the syslog() prototype changed; Also update Makefile for kernel build
Diffstat (limited to 'apps/system/stackmonitor')
-rw-r--r-- | apps/system/stackmonitor/Makefile | 32 | ||||
-rw-r--r-- | apps/system/stackmonitor/stackmonitor.c | 24 |
2 files changed, 41 insertions, 15 deletions
diff --git a/apps/system/stackmonitor/Makefile b/apps/system/stackmonitor/Makefile index c51488142..40624f5fe 100644 --- a/apps/system/stackmonitor/Makefile +++ b/apps/system/stackmonitor/Makefile @@ -44,7 +44,7 @@ endif # Stack Monitor Application PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 768 +STACKSIZE = 2048 ASRCS = CSRCS = @@ -52,10 +52,15 @@ MAINSRC = stackmonitor.c AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) +MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) -SRCS = $(ASRCS) $(CSRCS) +SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) +ifneq ($(CONFIG_BUILD_KERNEL),y) + OBJS += $(MAINOBJ) +endif + ifeq ($(CONFIG_WINDOWS_NATIVE),y) BIN = ..\..\libapps$(LIBEXT) else @@ -66,6 +71,15 @@ else endif endif +ifeq ($(WINTOOL),y) + INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}" +else + INSTALL_DIR = $(BIN_DIR) +endif + +CONFIG_XYZ_PROGNAME ?= ramtest$(EXEEXT) +PROGNAME = $(CONFIG_XYZ_PROGNAME) + ROOTDEPPATH = --dep-path . # Common build @@ -78,15 +92,26 @@ all: .built $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) -$(COBJS): %$(OBJEXT): %.c +$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) $(call ARCHIVE, $(BIN), $(OBJS)) $(Q) touch .built +ifeq ($(CONFIG_BUILD_KERNEL),y) +$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ) + @echo "LD: $(PROGNAME)" + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS) + $(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME) + +install: $(BIN_DIR)$(DELIM)$(PROGNAME) + +else install: +endif + # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) @@ -99,6 +124,7 @@ $(BUILTIN_REGISTRY)$(DELIM)stackmonitor_stop.bdat: $(DEPCONFIG) Makefile context: $(BUILTIN_REGISTRY)$(DELIM)stackmonitor_start.bdat $(BUILTIN_REGISTRY)$(DELIM)stackmonitor_stop.bdat else context: + endif # Create dependencies diff --git a/apps/system/stackmonitor/stackmonitor.c b/apps/system/stackmonitor/stackmonitor.c index 094ced4b5..f152d36fa 100644 --- a/apps/system/stackmonitor/stackmonitor.c +++ b/apps/system/stackmonitor/stackmonitor.c @@ -97,8 +97,8 @@ static struct stkmon_state_s g_stackmonitor; static void stkmon_task(FAR struct tcb_s *tcb, FAR void *arg) { -#if CONFIG_NAME_MAX > 0 - syslog(LOG_INFO, ("%5d %6d %6d %s\n", +#if CONFIG_TASK_NAME_SIZE > 0 + syslog(LOG_INFO, "%5d %6d %6d %s\n", tcb->pid, tcb->adj_stack_size, up_check_tcbstack(tcb), tcb->name); #else syslog(LOG_INFO, ("%5d %6d %6d\n", @@ -108,17 +108,17 @@ static void stkmon_task(FAR struct tcb_s *tcb, FAR void *arg) static int stackmonitor_daemon(int argc, char **argv) { - syslog(LOG_INFO, (STKMON_PREFIX "Running: %d\n", g_stackmonitor.pid); + syslog(LOG_INFO, STKMON_PREFIX "Running: %d\n", g_stackmonitor.pid); /* Loop until we detect that there is a request to stop. */ while (!g_stackmonitor.stop) { sleep(CONFIG_SYSTEM_STACKMONITOR_INTERVAL); -#if CONFIG_NAME_MAX > 0 - syslog(LOG_INFO, ("%-5s %-6s %-6s %s\n", "PID", "SIZE", "USED", "THREAD NAME"); +#if CONFIG_TASK_NAME_SIZE > 0 + syslog(LOG_INFO, "%-5s %-6s %-6s %s\n", "PID", "SIZE", "USED", "THREAD NAME"); #else - syslog(LOG_INFO, ("%-5s %-6s %-6s\n", "PID", "SIZE", "USED"); + syslog(LOG_INFO, "%-5s %-6s %-6s\n", "PID", "SIZE", "USED"); #endif sched_foreach(stkmon_task, NULL); } @@ -127,7 +127,7 @@ static int stackmonitor_daemon(int argc, char **argv) g_stackmonitor.stop = false; g_stackmonitor.started = false; - syslog(LOG_INFO, (STKMON_PREFIX "Stopped: %d\n", g_stackmonitor.pid); + syslog(LOG_INFO, STKMON_PREFIX "Stopped: %d\n", g_stackmonitor.pid); return 0; } @@ -158,14 +158,14 @@ int stackmonitor_start(int argc, char **argv) if (ret < 0) { int errcode = errno; - syslog(LOG_INFO, (STKMON_PREFIX + syslog(LOG_INFO, STKMON_PREFIX "ERROR: Failed to start the stack monitor: %d\n", errcode); } else { g_stackmonitor.pid = ret; - syslog(LOG_INFO, (STKMON_PREFIX "Started: %d\n", g_stackmonitor.pid); + syslog(LOG_INFO, STKMON_PREFIX "Started: %d\n", g_stackmonitor.pid); } sched_unlock(); @@ -173,7 +173,7 @@ int stackmonitor_start(int argc, char **argv) } sched_unlock(); - syslog(LOG_INFO, (STKMON_PREFIX "%s: %d\n", + syslog(LOG_INFO, STKMON_PREFIX "%s: %d\n", g_stackmonitor.stop ? "Stopping" : "Running", g_stackmonitor.pid); return 0; } @@ -188,11 +188,11 @@ int stackmonitor_stop(int argc, char **argv) * it will see the the stop indication and will exist. */ - syslog(LOG_INFO, (STKMON_PREFIX "Stopping: %d\n", g_stackmonitor.pid); + syslog(LOG_INFO, STKMON_PREFIX "Stopping: %d\n", g_stackmonitor.pid); g_stackmonitor.stop = true; } - syslog(LOG_INFO, (STKMON_PREFIX "Stopped: %d\n", g_stackmonitor.pid); + syslog(LOG_INFO, STKMON_PREFIX "Stopped: %d\n", g_stackmonitor.pid); return 0; } |