mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
Increase the chance for _assert to work early in the boot
This commit is contained in:
parent
1086a05e50
commit
52baca0a89
1 changed files with 12 additions and 3 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <nuttx/board.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/tls.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
@ -569,6 +570,7 @@ static void pause_all_cpu(void)
|
|||
void _assert(FAR const char *filename, int linenum,
|
||||
FAR const char *msg, FAR void *regs)
|
||||
{
|
||||
const bool os_ready = OSINIT_OS_READY();
|
||||
FAR struct tcb_s *rtcb = running_task();
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
FAR struct tcb_s *ptcb = NULL;
|
||||
|
@ -585,14 +587,18 @@ void _assert(FAR const char *filename, int linenum,
|
|||
}
|
||||
#endif
|
||||
|
||||
flags = enter_critical_section();
|
||||
flags = 0; /* suppress GCC warning */
|
||||
if (os_ready)
|
||||
{
|
||||
flags = enter_critical_section();
|
||||
}
|
||||
|
||||
if (g_fatal_assert)
|
||||
{
|
||||
goto reset;
|
||||
}
|
||||
|
||||
if (fatal)
|
||||
if (os_ready && fatal)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
pause_all_cpu();
|
||||
|
@ -738,5 +744,8 @@ reset:
|
|||
#endif
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
if (os_ready)
|
||||
{
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue