arch: Fix rtcb can't found error

use the same condition check in declaration and reference

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7b05316e914708fceeddac394d784ee3720a3c1b
This commit is contained in:
Xiang Xiao 2021-07-14 23:18:35 +08:00 committed by Alan Carvalho de Assis
parent 3204c75c1d
commit 98b5724b59
21 changed files with 72 additions and 149 deletions

View File

@ -306,22 +306,18 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -359,10 +359,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -371,10 +367,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -395,10 +395,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -408,18 +404,18 @@ void up_assert(const char *filename, int lineno)
#ifdef CONFIG_SMP
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed CPU%d at file:%s line: %d task: %s\n",
up_cpu_index(), filename, lineno, rtcb->name);
up_cpu_index(), filename, lineno, running_task()->name);
#else
_alert("Assertion failed CPU%d at file:%s line: %d\n",
up_cpu_index(), filename, lineno);
up_cpu_index(), filename, lineno);
#endif
#else
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
#endif

View File

@ -387,10 +387,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -398,20 +394,20 @@ void up_assert(const char *filename, int lineno)
syslog_flush();
#ifdef CONFIG_SMP
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed CPU%d at file:%s line: %d task: %s\n",
up_cpu_index(), filename, lineno, rtcb->name);
up_cpu_index(), filename, lineno, running_task()->name);
#else
_alert("Assertion failed CPU%d at file:%s line: %d\n",
up_cpu_index(), filename, lineno);
up_cpu_index(), filename, lineno);
#endif
#else
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
#endif

View File

@ -371,10 +371,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -383,10 +379,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -387,10 +387,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -400,18 +396,18 @@ void up_assert(const char *filename, int lineno)
#ifdef CONFIG_SMP
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed CPU%d at file:%s line: %d task: %s\n",
up_cpu_index(), filename, lineno, rtcb->name);
up_cpu_index(), filename, lineno, running_task()->name);
#else
_alert("Assertion failed CPU%d at file:%s line: %d\n",
up_cpu_index(), filename, lineno);
up_cpu_index(), filename, lineno);
#endif
#else
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
#endif

View File

@ -129,10 +129,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -141,10 +137,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -304,10 +304,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -316,10 +312,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -129,10 +129,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -141,10 +137,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -133,10 +133,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -145,10 +141,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
lm32_dumpstate();

View File

@ -133,10 +133,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (prior to the assertion) */
@ -145,7 +141,7 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n", filename, lineno);
#endif

View File

@ -359,10 +359,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -371,7 +367,7 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);

View File

@ -128,10 +128,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -140,10 +136,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -329,19 +329,15 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);

View File

@ -346,10 +346,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -359,18 +355,18 @@ void up_assert(const char *filename, int lineno)
#ifdef CONFIG_SMP
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed CPU%d at file:%s line: %d task: %s\n",
up_cpu_index(), filename, lineno, rtcb->name);
up_cpu_index(), filename, lineno, running_task()->name);
#else
_alert("Assertion failed CPU%d at file:%s line: %d\n",
up_cpu_index(), filename, lineno);
up_cpu_index(), filename, lineno);
#endif
#else
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
#endif

View File

@ -24,10 +24,10 @@
#include <nuttx/config.h>
#include <sched/sched.h>
#include <debug.h>
#include <stdlib.h>
#include <syslog.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/board.h>
#include "up_internal.h"
/****************************************************************************
@ -67,20 +67,30 @@
*
****************************************************************************/
void up_assert(const char *filename, int line)
void up_assert(const char *filename, int lineno)
{
/* Flush any buffered SYSLOG data (from prior to the assertion) */
/* Flush any buffered SYSLOG data (prior to the assertion) */
syslog_flush();
/* Show the location of the failed assertion */
#ifdef CONFIG_SMP
syslog(LOG_ERR, "CPU%d: Assertion failed at file:%s line: %d\n",
up_cpu_index(), filename, line);
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed CPU%d at file:%s line: %d task: %s\n",
up_cpu_index(), filename, lineno, running_task()->name);
#else
syslog(LOG_ERR, "Assertion failed at file:%s line: %d\n",
filename, line);
_alert("Assertion failed CPU%d at file:%s line: %d\n",
up_cpu_index(), filename, lineno);
#endif
#else
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
#endif
#endif
/* Flush any buffered SYSLOG data (from the above) */
@ -90,7 +100,7 @@ void up_assert(const char *filename, int line)
/* Allow for any board/configuration specific crash information */
#ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, line);
board_crashdump(up_getsp(), running_task(), filename, lineno);
#endif
/* Flush any buffered SYSLOG data */

View File

@ -265,10 +265,6 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -277,10 +273,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -247,22 +247,18 @@ static void _up_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = this_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
up_dumpstate();

View File

@ -148,10 +148,6 @@ static void xtensa_assert(void)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -160,10 +156,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
xtensa_assert();
@ -193,10 +189,6 @@ void up_assert(const char *filename, int lineno)
void xtensa_panic(int xptcode, uint32_t *regs)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
/* We get here when a un-dispatch-able, irrecoverable exception occurs */
board_autoled_on(LED_ASSERTION);
@ -206,7 +198,7 @@ void xtensa_panic(int xptcode, uint32_t *regs)
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Unhandled Exception %d task: %s\n", xptcode, rtcb->name);
_alert("Unhandled Exception %d task: %s\n", xptcode, running_task()->name);
#else
_alert("Unhandled Exception %d\n", xptcode);
#endif
@ -298,10 +290,6 @@ void xtensa_panic(int xptcode, uint32_t *regs)
void xtensa_user_panic(int exccause, uint32_t *regs)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
/* We get here when a un-dispatch-able, irrecoverable exception occurs */
board_autoled_on(LED_ASSERTION);
@ -311,7 +299,8 @@ void xtensa_user_panic(int exccause, uint32_t *regs)
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0
_alert("User Exception: EXCCAUSE=%04x task: %s\n", exccause, rtcb->name);
_alert("User Exception: EXCCAUSE=%04x task: %s\n",
exccause, running_task()->name);
#else
_alert("User Exception: EXCCAUSE=%04x\n", exccause);
#endif

View File

@ -129,10 +129,6 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -141,10 +137,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
z16_registerdump();

View File

@ -128,10 +128,6 @@ static int assert_tracecallback(struct usbtrace_s *trace, void *arg)
void up_assert(const char *filename, int lineno)
{
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT)
struct tcb_s *rtcb = running_task();
#endif
board_autoled_on(LED_ASSERTION);
/* Flush any buffered SYSLOG data (from prior to the assertion) */
@ -140,10 +136,10 @@ void up_assert(const char *filename, int lineno)
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
filename, lineno, rtcb->name);
filename, lineno, running_task()->name);
#else
_alert("Assertion failed at file:%s line: %d\n",
filename, lineno);
filename, lineno);
#endif
REGISTER_DUMP();