summaryrefslogtreecommitdiff
path: root/nuttx/arch/z80
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-03-08 21:19:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-03-08 21:19:39 +0000
commit99e869802e5b69c659946feb2467dd7bca0f415f (patch)
tree8ea391abd2636d31e700109f4ebee4749bd57691 /nuttx/arch/z80
parent9c3d2d95d0b27266398dd49184ead7416f3d369b (diff)
downloadpx4-nuttx-99e869802e5b69c659946feb2467dd7bca0f415f.tar.gz
px4-nuttx-99e869802e5b69c659946feb2467dd7bca0f415f.tar.bz2
px4-nuttx-99e869802e5b69c659946feb2467dd7bca0f415f.zip
Initial fixes for Z8Encore debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@726 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/z80')
-rw-r--r--nuttx/arch/z80/src/common/up_allocateheap.c12
-rwxr-xr-xnuttx/arch/z80/src/z8/z8_head.S29
2 files changed, 25 insertions, 16 deletions
diff --git a/nuttx/arch/z80/src/common/up_allocateheap.c b/nuttx/arch/z80/src/common/up_allocateheap.c
index 270e3e0d9..0ebb416e4 100644
--- a/nuttx/arch/z80/src/common/up_allocateheap.c
+++ b/nuttx/arch/z80/src/common/up_allocateheap.c
@@ -61,7 +61,13 @@
****************************************************************************/
/* For the ZiLOG ZDS-II toolchain(s), the heap will be set using linker-
- * defined values.
+ * defined values:
+ *
+ * far_heapbot : set to the offset to the first unused value in EDATA
+ * far_stacktop : set to the highest address in EDATA
+ *
+ * The top of the heap is then determined by the amount of stack setaside
+ * in the NuttX configuration file
*/
#ifdef __ZILOG__
@@ -70,8 +76,8 @@
# define CONFIG_HEAP1_BASE ((uint16)&far_heapbot)
# endif
# ifndef CONFIG_HEAP1_END
- extern far unsigned long far_heaptop;
-# define CONFIG_HEAP1_END ((uint16)&far_heaptop)
+ extern far unsigned long far_stacktop;
+# define CONFIG_HEAP1_END (((uint16)&far_stacktop) - CONFIG_PROC_STACK_SIZE + 1)
# endif
#endif
diff --git a/nuttx/arch/z80/src/z8/z8_head.S b/nuttx/arch/z80/src/z8/z8_head.S
index 49e0bd756..63ff14482 100755
--- a/nuttx/arch/z80/src/z8/z8_head.S
+++ b/nuttx/arch/z80/src/z8/z8_head.S
@@ -92,8 +92,7 @@
xref _len_pramseg
xref _low_pram_romdata
#endif
- xref _far_stack
- xref _near_stack
+ xref _far_stacktop
xdef _z8_reset
xdef __intrp
@@ -128,8 +127,8 @@ _z8_reset:
/* Initialize the stack pointer */
- ldx spl, #low(_far_stack+1)
- ldx sph, #high(_far_stack+1)
+ ldx spl, #low(_far_stacktop+1)
+ ldx sph, #high(_far_stacktop+1)
/* Clear internal register ram area (c_nearbss) */
@@ -165,16 +164,20 @@ _z8_reset3:
/* Copy ROM data into internal RAM */
_z8_reset4:
+#ifdef CONFIG_Z8_COPYNEARDATA
ld r0, #high(_low_near_romdata)
ld r1, #low(_low_near_romdata)
ld r3, #_len_neardata
ld r4, #_low_neardata
- or r3, r3
+ cp r3, #0
+ jr z, _z8_reset6
_z8_reset5:
ldci @r4, @rr0
djnz r3, _z8_reset5
+_z8_reset6:
+#endif
/* Copy ROM data into extended RAM */
ld r0, #high(_low_fardata)
@@ -186,19 +189,19 @@ _z8_reset5:
ld r6, r4
or r6, r5
- jr z, _z8_reset7
+ jr z, _z8_reset8
-_z8_reset6:
+_z8_reset7:
ldc r6, @rr2
ldx @rr0, r6
incw rr0
incw rr2
decw rr4
- jr nz, _z8_reset6
+ jr nz, _z8_reset7
/* Copy ROM copy of code into Program RAM */
-_z8_reset7:
+_z8_reset8:
#ifdef CONFIG_Z8_COPYPRAM
ld r0, #high(_low_pramseg)
ld r1, #low(_low_pramseg)
@@ -209,17 +212,17 @@ _z8_reset7:
ld r6, r4
or r6, r5
- jr z, _z8_reset9
+ jr z, _z8_reset10
-_z8_reset8:
+_z8_reset9:
ldc r6, @rr2
ldc @rr0, r6
incw rr0
incw rr2
decw rr4
- jr nz, _z8_reset8
+ jr nz, _z8_reset9
-_z8_reset9:
+_z8_reset10:
#endif
/* Start NuttX */