summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-23 11:32:44 +0800
committerTat-Chee Wan (USM)2011-03-23 11:32:44 +0800
commit2a91d2fc501a9d84753586a900a01be59b6da24d (patch)
tree7f3521d80f8d3bafac6a70b8f557d8ec7fa363e0
parent557eb76616e65cd27c3a014796eafd09836b0996 (diff)
changed output routines to use little endian as default
-rw-r--r--Debugger/debug_comm.S15
-rw-r--r--SConstruct4
2 files changed, 19 insertions, 0 deletions
diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S
index c5738da..54c16a6 100644
--- a/Debugger/debug_comm.S
+++ b/Debugger/debug_comm.S
@@ -207,7 +207,9 @@ byte2ascii:
.global halfword2ascii
halfword2ascii:
stmfd sp!, {r0,r2,r3, lr} /* Keep ASCII buffer pointer */
+#ifdef __BIG_ENDIAN__
mov r2, r1, lsl #16 /* copy of input halfword value R1[15:0], shifted to MSH R2[31:16] */
+#endif
mov r3, #2 /* Loop Counter */
b _conv_byte2ascii /* goto Byte conversion loop */
@@ -231,6 +233,8 @@ word2ascii:
/* Fall through to byte coversion loop */
+#ifdef __BIG_ENDIAN__
+/* Rotate then convert */
_conv_byte2ascii:
ror r2, r2, #24 /* Rotate MSB R2[31:24] into LSB position R2[7:0] */
and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */
@@ -239,6 +243,17 @@ _conv_byte2ascii:
bne _conv_byte2ascii
ldmfd sp!, {r1,r2,r3, pc}
+#else /* __LITTLE_ENDIAN__ */
+/* Convert then rotate */
+_conv_byte2ascii:
+ and r1, r2, #BYTE0 /* Copy byte value in R2[7:0] into R1 */
+ bl byte2ascii_cont /* R0: next ASCII buffer location pointer, R1: destroyed */
+ ror r2, r2, #8 /* Rotate LSB+1 R2[15:8] into LSB position R2[7:0] */
+ subs r3, r3, #1
+ bne _conv_byte2ascii
+ ldmfd sp!, {r1,r2,r3, pc}
+
+#endif
/* ascii2byte
* On entry:
diff --git a/SConstruct b/SConstruct
index 4ca6207..898bb91 100644
--- a/SConstruct
+++ b/SConstruct
@@ -162,11 +162,15 @@ else:
myasflags.append('-Wa,-mcpu=arm7tdmi,-mfpu=softfpa')
mycflags.append('-g')
mycflags.append('-ggdb')
+# Big Endian Output (disabled by default)
+#mycflags.append('-D__BIG_ENDIAN__')
# Test build for NXT Firmware first
#mycflags.append('-D__NXOS__')
myasflags.append('-g')
myasflags.append('-ggdb')
+# Big Endian Output (disabled by default)
+#mycflags.append('-D__BIG_ENDIAN__')
# Test build for NXT Firmware first
#myasflags.append('-D__NXOS__')