From 77934f364f0fb147357bf691d0e71c35f4051168 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 17 Sep 2018 15:10:52 +0200 Subject: [PATCH] avr: fix corrupted .data byte The stack and the .data section shared the first byte, leading to corruption of the first byte of .data. --- targets/avr.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/targets/avr.S b/targets/avr.S index b62c1add..a60dde2b 100644 --- a/targets/avr.S +++ b/targets/avr.S @@ -17,6 +17,9 @@ reset: out 0x3d, xl; SPL out 0x3e, xh; SPH + ; Add one to the stack pointer, so it doesn't point in the .data section. + push r0 + ; Initialize .data init_data: ldi xl, lo8(_sdata)