mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #8255 from MateuszMaz/refactoring_mbed_assert
Change behaviour of mbed_asert to use mbed_error instead of mbed_diepull/8436/merge
commit
ce7e61e37e
|
@ -13,15 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "platform/mbed_assert.h"
|
||||
#include "device.h"
|
||||
|
||||
#include "platform/mbed_interface.h"
|
||||
#include <string.h>
|
||||
#include "platform/mbed_assert.h"
|
||||
|
||||
#include "platform/mbed_critical.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
void mbed_assert_internal(const char *expr, const char *file, int line)
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
mbed_error_printf("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
|
||||
mbed_die();
|
||||
mbed_error(MBED_ERROR_ASSERTION_FAILED, expr, 0, file, line);
|
||||
}
|
||||
|
||||
|
|
|
@ -349,6 +349,10 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
|
|||
mbed_error_printf("MessageQueue: 0x%X, ", ctx->error_value);
|
||||
break;
|
||||
|
||||
case MBED_ERROR_CODE_ASSERTION_FAILED:
|
||||
mbed_error_printf("Assertion failed: ");
|
||||
break;
|
||||
|
||||
default:
|
||||
//Nothing to do here, just print the error info down
|
||||
break;
|
||||
|
|
|
@ -783,7 +783,8 @@ typedef enum _mbed_error_code {
|
|||
MBED_DEFINE_SYSTEM_ERROR(BLE_NO_FRAME_INITIALIZED, 65), /* 321 BLE No frame initialized */
|
||||
MBED_DEFINE_SYSTEM_ERROR(BLE_BACKEND_CREATION_FAILED, 66), /* 322 BLE Backend creation failed */
|
||||
MBED_DEFINE_SYSTEM_ERROR(BLE_BACKEND_NOT_INITIALIZED, 67), /* 323 BLE Backend not initialized */
|
||||
|
||||
MBED_DEFINE_SYSTEM_ERROR(ASSERTION_FAILED, 68), /* 324 Assertion Failed */
|
||||
|
||||
//Everytime you add a new system error code, you must update
|
||||
//Error documentation under Handbook to capture the info on
|
||||
//the new error status/codes
|
||||
|
|
Loading…
Reference in New Issue