Skip to content

Commit b0779f0

Browse files
committed
fill stack region with pattern 0xADADADAD for detect stack usage
1 parent cf68679 commit b0779f0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cores/nRF5/gcc_startup_nrf52.S

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
.syntax unified
2929
.arch armv7e-m
3030

31-
/* Adafruit nrf52 use RTOS, thus disable stack here */
31+
/* Adafruit define stack & heap inside linker script */
3232
/* .section .stack
3333
.align 3
3434
#ifdef __STACK_SIZE
@@ -362,6 +362,16 @@ Reset_Handler:
362362

363363
.L_loop1_done:
364364

365+
/* Adafruit fill stack region with pattern 0xADADADAD */
366+
ldr r0, =__StackLimit
367+
ldr r1, =__StackSize
368+
ldr r2, =0xADADADAD
369+
.L_fill:
370+
str r2, [r0]
371+
adds r0, 4
372+
subs r1, 4
373+
bne .L_fill
374+
365375
/* This part of work usually is done in C library startup code. Otherwise,
366376
* define __STARTUP_CLEAR_BSS to enable it in this startup. This section
367377
* clears the RAM where BSS data is located.

0 commit comments

Comments
 (0)