diff --git a/platform/mbed_assert.c b/platform/mbed_assert.c index 8a698abdd9..e9bbf26d96 100644 --- a/platform/mbed_assert.c +++ b/platform/mbed_assert.c @@ -13,15 +13,21 @@ * 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 +#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(); + + const char error_description[] = "Mbed assertation failed "; + unsigned error_message_length = strlen(error_description) + strlen(expr) + 1; + char error_message[error_message_length]; + snprintf(error_message, error_message_length, "%s%s", error_description, expr); + + mbed_error(MBED_ERROR_INVALID_ARGUMENT, error_message, 0, file, line); }