µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
assert.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <cmsis-plus/diag/trace.h>
#include <cmsis-plus/rtos/os-c-api.h>

Go to the source code of this file.

Functions

void __assert_func (const char *file, int line, const char *func, const char *failedexpr)
 

Function Documentation

◆ __assert_func()

void __assert_func ( const char *  file,
int  line,
const char *  func,
const char *  failedexpr 
)

Definition at line 51 of file assert.c.

53{
55
56 // Not atomic, but otherwise the entire string might get too long,
57 // and temporary buffer used by trace_printf() will overflow.
58#if defined(TRACE)
59
60 trace_printf ("assertion \"%s\" failed\n", failedexpr);
61 trace_printf ("file: \"%s\"\n", file);
62 trace_printf ("line: %d\n", line);
63 if (func != NULL)
64 {
65 trace_printf ("function: %s\n", func);
66 }
68 {
69 if (os_this_thread () != NULL)
70 {
71 trace_printf ("this_thread: %s @%p\n",
74 }
75 }
76
77#elif defined(OS_USE_SEMIHOSTING_SYSCALLS)
78
79 printf ("assertion \"%s\" failed\n", failedexpr);
80 printf ("file: \"%s\"\n", file);
81 printf ("line: %d\n", line);
82 if (func != NULL)
83 {
84 printf ("function: %s\n", func);
85 }
87 {
88 if (os_this_thread () != NULL)
89 {
90 printf ("this_thread: %s @%p\n",
92 }
93 }
94
95#endif
96 abort ();
97 /* NOTREACHED */
98}
void abort(void)
Definition exit.c:43
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:59
bool os_irq_in_handler_mode(void)
Check if the CPU is in handler mode.
os_irq_state_t os_irq_critical_enter(void)
Enter an interrupts critical section.
const char * os_thread_get_name(os_thread_t *thread)
Get the thread name.
os_thread_t * os_this_thread(void)
Get the current running thread.
int trace_printf(const char *format,...)

References abort(), os_irq_critical_enter(), os_irq_in_handler_mode(), os_this_thread(), os_thread_get_name(), and trace_printf().