2023-02-27 11:00:23 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022, 2023 - Tillitis AB
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "assert.h"
|
2023-02-27 11:19:26 -05:00
|
|
|
#include "led.h"
|
2023-02-27 11:00:23 -05:00
|
|
|
#include "lib.h"
|
|
|
|
|
2023-03-21 09:11:08 -04:00
|
|
|
void assert_fail(const char *assertion, const char *file, unsigned int line,
|
|
|
|
const char *function)
|
2023-02-27 11:00:23 -05:00
|
|
|
{
|
|
|
|
htif_puts("assert: ");
|
2023-03-21 08:56:07 -04:00
|
|
|
htif_puts(assertion);
|
2023-02-27 11:00:23 -05:00
|
|
|
htif_puts(" ");
|
2023-03-21 08:56:07 -04:00
|
|
|
htif_puts(file);
|
2023-02-27 11:00:23 -05:00
|
|
|
htif_puts(":");
|
2023-03-21 08:56:07 -04:00
|
|
|
htif_putinthex(line);
|
2023-02-27 11:00:23 -05:00
|
|
|
htif_puts(" ");
|
2023-03-21 08:56:07 -04:00
|
|
|
htif_puts(function);
|
2023-02-27 11:00:23 -05:00
|
|
|
htif_lf();
|
|
|
|
|
2024-03-14 10:07:42 -04:00
|
|
|
// Force illegal instruction to halt CPU
|
|
|
|
asm volatile("unimp");
|
|
|
|
|
2023-02-27 11:00:23 -05:00
|
|
|
// Not reached
|
2024-03-14 10:07:42 -04:00
|
|
|
__builtin_unreachable();
|
2023-02-27 11:00:23 -05:00
|
|
|
}
|