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
This commit is contained in:
patacongo 2010-05-26 22:03:57 +00:00
parent a6004aa2bb
commit 6e32ca55c0
2 changed files with 36 additions and 9 deletions

View File

@ -65,6 +65,19 @@
# define lldbg lib_lowprintf # define lldbg lib_lowprintf
#endif #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 * Private Data
****************************************************************************/ ****************************************************************************/
@ -272,12 +285,12 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
void up_assert(const uint8_t *filename, int lineno) 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; _TCB *rtcb = (_TCB*)g_readytorun.head;
#endif #endif
up_ledon(LED_ASSERTION); 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", lldbg("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
#else #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) 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; _TCB *rtcb = (_TCB*)g_readytorun.head;
#endif #endif
up_ledon(LED_ASSERTION); 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", lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
filename, lineno, rtcb->name, errorcode); filename, lineno, rtcb->name, errorcode);
#else #else

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/cortexm3/up_assert.c * 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 <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -65,6 +65,19 @@
# define lldbg lib_lowprintf # define lldbg lib_lowprintf
#endif #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 * Private Data
****************************************************************************/ ****************************************************************************/
@ -273,12 +286,12 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
void up_assert(const uint8_t *filename, int lineno) 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; _TCB *rtcb = (_TCB*)g_readytorun.head;
#endif #endif
up_ledon(LED_ASSERTION); 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", lldbg("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name); filename, lineno, rtcb->name);
#else #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) 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; _TCB *rtcb = (_TCB*)g_readytorun.head;
#endif #endif
up_ledon(LED_ASSERTION); 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", lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n",
filename, lineno, rtcb->name, errorcode); filename, lineno, rtcb->name, errorcode);
#else #else