Skip to content

Commit 5ced5d9

Browse files
tokangasnordicjm
authored andcommitted
samples: cellular: modem_shell: Fix modem coredump handling
After a modem fault, the application halted execution too early, because of which a part of the coredump was not sent. This commit waits until all trace data has been processed before halting the application core. It also uses k_oops() to halt the system instead of an assert. Signed-off-by: Tommi Kangas <[email protected]>
1 parent da6ab0b commit 5ced5d9

File tree

1 file changed

+14
-1
lines changed
  • samples/cellular/modem_shell/src

1 file changed

+14
-1
lines changed

samples/cellular/modem_shell/src/main.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,27 @@ static const char *modem_crash_reason_get(uint32_t reason)
132132
}
133133
}
134134

135+
static void modem_crash_work_fn(struct k_work *work)
136+
{
137+
mosh_error("Modem crash detected, halting application execution");
138+
139+
#if defined(CONFIG_NRF_MODEM_LIB_TRACE)
140+
nrf_modem_lib_trace_processing_done_wait(K_SECONDS(5));
141+
#endif
142+
143+
k_oops();
144+
}
145+
146+
K_WORK_DEFINE(modem_crash_work, modem_crash_work_fn);
147+
135148
void nrf_modem_fault_handler(struct nrf_modem_fault_info *fault_info)
136149
{
137150
printk("Modem crash reason: 0x%x (%s), PC: 0x%x\n",
138151
fault_info->reason,
139152
modem_crash_reason_get(fault_info->reason),
140153
fault_info->program_counter);
141154

142-
__ASSERT(false, "Modem crash detected, halting application execution");
155+
k_work_submit(&modem_crash_work);
143156
}
144157

145158
#if defined(CONFIG_NRF_MODEM_LIB_SHELL_TRACE)

0 commit comments

Comments
 (0)