Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
nrf_802154_platform_assert.h
1
/*
2
* Copyright (c) 2026, RISE Research Institutes of Sweden AB
3
* All rights reserved.
4
*
5
* Author: Joakim Eriksson <joakim.eriksson@ri.se>
6
*
7
* SPDX-License-Identifier: BSD-3-Clause
8
*
9
* Platform assert override for nrf_802154 on nRF54L15.
10
* Prints file:line via UART and resets via NVIC_SystemReset().
11
*
12
* IMPORTANT: We must NOT use BKPT on the XIAO nRF54L15 because the onboard
13
* CMSIS-DAP debugger keeps CoreDebug->DHCSR.C_DEBUGEN set. When C_DEBUGEN
14
* is active, BKPT halts the CPU in Debug state instead of escalating to
15
* HardFault — the HardFault handler never fires, and the system hangs
16
* silently until the debugger chip issues an SREQ reset.
17
*/
18
#ifndef NRF_802154_PLATFORM_ASSERT_H_
19
#define NRF_802154_PLATFORM_ASSERT_H_
20
21
#define NRF_802154_ASSERT(condition) do { \
22
if(!(condition)) { \
23
extern void uarte_write(unsigned char c); \
24
uarte_write('A'); uarte_write('!'); uarte_write(' '); \
25
/* Print file name */
\
26
{ const char *_f = __FILE__; \
27
/* Skip path, just print filename */
\
28
const char *_s = _f; \
29
while(*_s) { if(*_s == '/') _f = _s + 1; _s++; } \
30
while(*_f) uarte_write((unsigned char)*_f++); } \
31
uarte_write(':'); \
32
/* Print line number in decimal */
\
33
{ unsigned _l = __LINE__; \
34
char _b[6]; int _i = 0; \
35
if(_l == 0) { uarte_write('0'); } \
36
else { while(_l) { _b[_i++] = '0' + (_l % 10); _l /= 10; } \
37
while(_i--) uarte_write((unsigned char)_b[_i]); } } \
38
uarte_write('\n'); \
39
for(volatile int _d = 0; _d < 100000; _d++) {} \
40
/* Reset via SCB->AIRCR (CMSIS NVIC_SystemReset equivalent) */
\
41
__asm volatile("dsb 0xF":::"memory"); \
42
*((volatile unsigned long *)0xE000ED0CUL) = 0x05FA0004UL; \
43
__asm volatile("dsb 0xF":::"memory"); \
44
for(;;) { __asm volatile("nop"); } \
45
} \
46
} while(0)
47
48
#endif
/* NRF_802154_PLATFORM_ASSERT_H_ */
arch
cpu
nrf
nrf54l15
nrf_802154_platform_assert.h
Generated on
for Contiki-NG by
1.17.0