Hello,

So, we are running into an issue where some peripheral needs to get shut
down before the breakpoint gets hit. this only happens when the debugger is
connected and so, it quite isolated in terms on functionality.

There are different approaches we could follow:

1. Have a macro (syscfg) define that function and call that macro

154 #ifdef MYNEWT_VAL_HAL_SYSTEM_PRE_BKPT_CB
155        HAL_SYSTEM_PRE_BKPT_CB();
156 #endif
157
158 #if !MYNEWT_VAL(MCU_DEBUG_IGNORE_BKPT)
159        asm("bkpt");
160 #endif

2. Have a `hal_system_pre_bkpt_cb()` function, register a callback and have
one specific MCU call it only if a syscfg is set, something like:

154 #ifdef MYNEWT_VAL(HAL_SYSTEM_PRE_BKPT_CB)
155        hal_system_pre_bkpt_cb();
156 #endif
157
158 #if !MYNEWT_VAL(MCU_DEBUG_IGNORE_BKPT)
159        asm("bkpt");
160 #endif

These are just some simple suggestions we could follow, obviously there is
a hard way of doing this thing where we change APIs and register a callback
and have assert take that callback as an argument but I am not a big fan of
changing standard APIs.

If others have a suggestion, please let me know. If not I am going to
assume everybody is fine with option 2.

-- 

Regards,
Vipul Rahane

Reply via email to