summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2013-12-07 17:52:17 +0100
committercpldcpu <cpldcpu@gmail.com>2013-12-07 17:52:17 +0100
commit01f5133aa09148a90154597a202a0592bd1f98a3 (patch)
treec24fa76d9e16c9f8d3c6277bb965faeaa8f7a13a
parent5eec4f6815221e78c06cc132df258f38d5b46cd8 (diff)
downloadmicronucleus-01f5133aa09148a90154597a202a0592bd1f98a3.tar.gz
micronucleus-01f5133aa09148a90154597a202a0592bd1f98a3.tar.bz2
micronucleus-01f5133aa09148a90154597a202a0592bd1f98a3.zip
init stackpoint
-rw-r--r--firmware/crt1.S11
1 files changed, 8 insertions, 3 deletions
diff --git a/firmware/crt1.S b/firmware/crt1.S
index bb7b8e0..29693ac 100644
--- a/firmware/crt1.S
+++ b/firmware/crt1.S
@@ -35,11 +35,13 @@
#if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
#error "GCC version >= 3.3 required"
#endif
+
/*
#include IOSYMFILE
-
#include "macros.inc"
*/
+#include <avr/io.h>
+//#include <avr/pgmspace.h>
#define XJMP rjmp
#define XCALL rcall
@@ -75,7 +77,7 @@ __vectors:
__init:
.weak __stack
-
+ .set __stack, RAMEND
/* By default, malloc() uses the current value of the stack pointer
minus __malloc_margin as the highest available address.
@@ -88,7 +90,10 @@ __init:
.section .init2,"ax",@progbits
clr R1
out 0x3f,r1
-
+ ldi r28,lo8(__stack)
+ ldi r29,hi8(__stack)
+ out 0x3d, r28
+ out 0x3e, r29
.section .init9,"ax",@progbits
XJMP main
; .endfunc