Skip to content

Commit

Permalink
Merge pull request #14 from wdfk-prog/port
Browse files Browse the repository at this point in the history
更新port文件,与 rt_kprintf_threadsafe兼容
  • Loading branch information
armink authored Dec 26, 2022
2 parents 7c6c224 + fe30405 commit 0a873cd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cmb_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void rt_cm_backtrace_exception_hook(void *context)
uint32_t lr;
uint32_t *other_info_sp = 0;

rt_enter_critical();
rt_interrupt_enter();

#ifdef RT_USING_FINSH
extern long list_thread(void);
Expand Down Expand Up @@ -178,6 +178,8 @@ void rt_cm_backtrace_exception_hook(void *context)
cmb_println("==============================================================");

cmb_println("Current system tick: %ld", rt_tick_get());

rt_interrupt_leave();
}

#else
Expand All @@ -196,8 +198,8 @@ void rt_cm_backtrace_exception_hook(void *context)
#else
#define EXC_RETURN_MASK 0x0000000F // Bits[31:5]
#endif
rt_enter_critical();

rt_interrupt_enter();

#ifdef RT_USING_FINSH
extern long list_thread(void);
Expand Down Expand Up @@ -230,13 +232,14 @@ void rt_cm_backtrace_exception_hook(void *context)
cm_backtrace_fault(lr, cmb_get_sp() + sizeof(uint32_t) * CMB_SP_WORD_OFFSET);

cmb_println("Current system tick: %ld", rt_tick_get());
rt_interrupt_leave();
}

#endif

void rt_cm_backtrace_assert_hook(const char* ex, const char* func, rt_size_t line)
{
rt_enter_critical();
rt_interrupt_enter();

#ifdef RT_USING_FINSH
extern long list_thread(void);
Expand All @@ -249,6 +252,8 @@ void rt_cm_backtrace_assert_hook(const char* ex, const char* func, rt_size_t lin
cm_backtrace_assert(cmb_get_sp());

cmb_println("Current system tick: %ld", rt_tick_get());

rt_interrupt_leave();
}

RT_WEAK rt_err_t exception_hook(void *context) {
Expand Down Expand Up @@ -277,7 +282,7 @@ int rt_cm_backtrace_init(void) {
return 0;
}

cm_backtrace_init("rtthread","1.0","1.0");
cm_backtrace_init("rt-thread","1.0","1.0");

rt_hw_exception_install(exception_hook);

Expand Down

0 comments on commit 0a873cd

Please sign in to comment.