The need for BUG() During code development we really need assertions We need to verify values are as expected Mishaps happens, and they need to be notified Unfortunately, the assert code takes quite some space Besides the conditional, you need to pass __FILE__ etc You call printf and panic, with arguments (or __assert) This can be an issue in hot code paths Assert can be conditional (e.g.: CONFIG_ASSERT) But sometimes you want to keep the check in production too So we can use the undefined instruction handler One instruction (two bytes in thumb code) And an handler that looks up which asertion it was