libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
libxr.cpp
1#include "libxr.hpp"
2
3#include "thread.hpp"
4
5extern "C" void libxr_fatal_error(const char* file, uint32_t line, bool in_isr)
6{
7 volatile bool stop = false;
8 while (!stop)
9 {
10 if (in_isr)
11 {
12 *(volatile int*)0 = 0; // NOLINT
13 }
14 else
15 {
17 {
18 LibXR::STDIO::Print<"Fatal error at {}:{}\r\n">(file, static_cast<int>(line));
19 }
20
21 if (!LibXR::Assert::FatalErrorCallback().Empty())
22 {
23 // The fatal callback is executed only on the non-ISR fatal path here.
24 // Normalize the user callback to thread context instead of forwarding the
25 // original fault source flag.
26 LibXR::Assert::FatalErrorCallback().Run(false, file, line);
27 }
28
30 }
31 }
32}
static int Print(Args &&... args)
将一个编译期 brace 字面量打印到当前 STDIO 输出 / Print one compile-time brace literal to the active STDIO output
Definition stdio.hpp:196
static WritePort * write_
Write port instance. 写入端口。
Definition stdio.hpp:26
static void Sleep(uint32_t milliseconds)
让线程进入休眠状态 Puts the thread to sleep
Definition thread.cpp:15