From be8e4108d2a8a1d8de48199e1516ce35f06e1065 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 26 May 2010 22:03:57 +0000 Subject: [PATCH] Fixed a compilation problem that occurs with certain combinations of options git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2703 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/arm/up_assert.c | 22 ++++++++++++++++++---- arch/arm/src/cortexm3/up_assert.c | 23 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/arm/up_assert.c b/arch/arm/src/arm/up_assert.c index cd0b595110e..f52dc1b9467 100644 --- a/arch/arm/src/arm/up_assert.c +++ b/arch/arm/src/arm/up_assert.c @@ -65,6 +65,19 @@ # define lldbg lib_lowprintf #endif +/* The following is just intended to keep some ugliness out of the mainline + * code. We are going to print the task name if: + * + * CONFIG_TASK_NAME_SIZE > 0 && <-- The task has a name + * (defined(CONFIG_DEBUG) || <-- And the debug is enabled (lldbg used) + * defined(CONFIG_ARCH_STACKDUMP) <-- Or lib_lowprintf() is used + */ + +#undef CONFIG_PRINT_TASKNAME +#if CONFIG_TASK_NAME_SIZE > 0 && (defined(CONFIG_DEBUG) || defined(CONFIG_ARCH_STACKDUMP)) +# define CONFIG_PRINT_TASKNAME 1 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -272,12 +285,12 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ void up_assert(const uint8_t *filename, int lineno) { -#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG) +#ifdef CONFIG_PRINT_TASKNAME _TCB *rtcb = (_TCB*)g_readytorun.head; #endif up_ledon(LED_ASSERTION); -#if CONFIG_TASK_NAME_SIZE > 0 +#ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); #else @@ -294,12 +307,13 @@ void up_assert(const uint8_t *filename, int lineno) void up_assert_code(const uint8_t *filename, int lineno, int errorcode) { -#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG) +#ifdef CONFIG_PRINT_TASKNAME _TCB *rtcb = (_TCB*)g_readytorun.head; #endif up_ledon(LED_ASSERTION); -#if CONFIG_TASK_NAME_SIZE > 0 + +#ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", filename, lineno, rtcb->name, errorcode); #else diff --git a/arch/arm/src/cortexm3/up_assert.c b/arch/arm/src/cortexm3/up_assert.c index b10bc0d8d3a..a2ee022b205 100644 --- a/arch/arm/src/cortexm3/up_assert.c +++ b/arch/arm/src/cortexm3/up_assert.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/cortexm3/up_assert.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -65,6 +65,19 @@ # define lldbg lib_lowprintf #endif +/* The following is just intended to keep some ugliness out of the mainline + * code. We are going to print the task name if: + * + * CONFIG_TASK_NAME_SIZE > 0 && <-- The task has a name + * (defined(CONFIG_DEBUG) || <-- And the debug is enabled (lldbg used) + * defined(CONFIG_ARCH_STACKDUMP) <-- Or lib_lowprintf() is used + */ + +#undef CONFIG_PRINT_TASKNAME +#if CONFIG_TASK_NAME_SIZE > 0 && (defined(CONFIG_DEBUG) || defined(CONFIG_ARCH_STACKDUMP)) +# define CONFIG_PRINT_TASKNAME 1 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -273,12 +286,12 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ void up_assert(const uint8_t *filename, int lineno) { -#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG) +#ifdef CONFIG_PRINT_TASKNAME _TCB *rtcb = (_TCB*)g_readytorun.head; #endif up_ledon(LED_ASSERTION); -#if CONFIG_TASK_NAME_SIZE > 0 +#ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); #else @@ -295,12 +308,12 @@ void up_assert(const uint8_t *filename, int lineno) void up_assert_code(const uint8_t *filename, int lineno, int errorcode) { -#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG) +#ifdef CONFIG_PRINT_TASKNAME _TCB *rtcb = (_TCB*)g_readytorun.head; #endif up_ledon(LED_ASSERTION); -#if CONFIG_TASK_NAME_SIZE > 0 +#ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", filename, lineno, rtcb->name, errorcode); #else