aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-09-17 15:10:52 +0200
committerAyke van Laethem <[email protected]>2018-09-17 15:10:52 +0200
commit77934f364f0fb147357bf691d0e71c35f4051168 (patch)
tree6f0c626d93a65140276cff7a7243b2016d88624f
parentfc0ff3a987ca227ce7fa7d1f1264ca6af010d1c6 (diff)
downloadtinygo-77934f364f0fb147357bf691d0e71c35f4051168.tar.gz
tinygo-77934f364f0fb147357bf691d0e71c35f4051168.zip
avr: fix corrupted .data byte
The stack and the .data section shared the first byte, leading to corruption of the first byte of .data.
-rw-r--r--targets/avr.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/targets/avr.S b/targets/avr.S
index b62c1add6..a60dde2b1 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)