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
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* 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_critical.h"
|
||||||
|
#include "platform/mbed_error.h"
|
||||||
|
|
||||||
void mbed_assert_internal(const char *expr, const char *file, int line)
|
void mbed_assert_internal(const char *expr, const char *file, int line)
|
||||||
{
|
{
|
||||||
core_util_critical_section_enter();
|
core_util_critical_section_enter();
|
||||||
mbed_error_printf("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
|
mbed_error(MBED_ERROR_ASSERTION_FAILED, expr, 0, file, line);
|
||||||
mbed_die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
mbed_error_printf("MessageQueue: 0x%X, ", ctx->error_value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MBED_ERROR_CODE_ASSERTION_FAILED:
|
||||||
|
mbed_error_printf("Assertion failed: ");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//Nothing to do here, just print the error info down
|
//Nothing to do here, just print the error info down
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -783,6 +783,7 @@ typedef enum _mbed_error_code {
|
||||||
MBED_DEFINE_SYSTEM_ERROR(BLE_NO_FRAME_INITIALIZED, 65), /* 321 BLE No frame initialized */
|
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_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(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
|
//Everytime you add a new system error code, you must update
|
||||||
//Error documentation under Handbook to capture the info on
|
//Error documentation under Handbook to capture the info on
|
||||||
|
|
Loading…
Reference in New Issue