Skip to content

Commit 7200df5

Browse files
committed
Merge branch 'maintenance/abort-print-err-msg'
2 parents 4bb5b20 + f6c68c5 commit 7200df5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/hardfault.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020
#include <platform_config.h>
2121
#include <screen.h>
2222
#include <usb/usb.h>
23-
#ifndef TESTING
2423

24+
#if defined(TESTING)
25+
#include <stdio.h>
26+
#include <stdlib.h>
27+
#endif
28+
29+
#ifndef TESTING
2530
void HardFault_Handler(void)
2631
{
2732
Abort("Unexpected error.\nPlease contact support.");
@@ -35,20 +40,23 @@ void MemManage_Handler(void)
3540

3641
void Abort(const char* msg)
3742
{
43+
#if defined(TESTING)
44+
fprintf(stderr, "%s\n", msg);
45+
exit(1);
46+
#else
3847
util_log("%s", msg);
3948
screen_print_debug(msg, 0);
4049
usb_stop();
41-
#if !defined(TESTING)
4250
#if defined(BOOTLOADER)
4351
bootloader_close_interfaces();
4452
#else
4553
system_close_interfaces();
46-
#endif
4754
#endif
4855
// Break the program if we are debugging
4956
ASSERT(false);
5057
while (1) {
5158
}
59+
#endif
5260
}
5361

5462
void AbortAutoenter(const char* msg)

0 commit comments

Comments
 (0)