Changed behaviour of mbed_asert to use mbed_error instead of mbed_die.

pull/8255/head
MateuszM 2018-09-26 11:08:54 +02:00
parent a0a9b54e97
commit c3e7ddbb10
1 changed files with 11 additions and 5 deletions

View File

@ -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 <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();
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);
}