Skip to content

Commit fb4e63e

Browse files
committed
Some cleanup for fault debugging
- Not the correct print for 32 bit Hex uints in firmware (bootloader is ok) - Fixing bootloader warnings
1 parent 48daada commit fb4e63e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Bootloader/mchck-cdefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828

2929
#define _CONCAT(x,y) _CONCAT1(x,y)
3030
#define _CONCAT1(x,y) x ## y
31-
#define _STR(a) #a
31+
#define _STR_(a) #a
3232

3333
typedef __CHAR16_TYPE__ char16_t;
3434

3535
#define __packed __attribute__((__packed__))
3636

3737
/* From FreeBSD: compile-time asserts */
38-
#define CTASSERT(x) _Static_assert(x, _STR(x))
38+
#define CTASSERT(x) _Static_assert(x, _STR_(x))
3939

4040
#define CTASSERT_SIZE_BYTE(t, s) CTASSERT(sizeof(t) == (s))
4141
#define CTASSERT_SIZE_BIT(t, s) CTASSERT(sizeof(t) * 8 == (s))

Lib/sam.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ void __stack_chk_fail(void)
105105
uint32_t sp = __get_MSP();
106106
print("Stack overflow!" NL );
107107
print(" SP = ");
108+
#if defined(_bootloader_)
108109
printHex(sp);
110+
#else
111+
printHex32(sp);
112+
#endif
109113
print(NL NL);
110114
fault_isr();
111115
}
@@ -116,7 +120,11 @@ void unused_isr()
116120
Cortex_IRQ irq = get_current_isr();
117121
print("Unhandled ISR!" NL);
118122
print(" IRQn = ");
123+
#if defined(_bootloader_)
119124
printHex(irq);
125+
#else
126+
printHex32(irq);
127+
#endif
120128
print(NL NL);
121129
fault_isr();
122130
}

0 commit comments

Comments
 (0)