summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/debug.S
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2012-02-22 21:58:03 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-03-24 09:38:55 +0000
commit9b5a146a43db3733c731d47022f4f5259e6b31e6 (patch)
tree3fc6d02c65c3f373d6408f9c332de183be7230b0 /arch/arm/kernel/debug.S
parent101d9b0dedbc9e560737d3357104bf09db48eb3e (diff)
downloadlinux-9b5a146a43db3733c731d47022f4f5259e6b31e6.tar.bz2
ARM: 7338/1: add support for early console output via semihosting
This is a very simple method for code running in an emulator, or under the supervision of a debugger, to use I/O facilities on the controlling host. Tested with OpenOCD, and ARM's Fast Models. Details on semihosting can be found in chapter 8 of DUI0203I_rvct_developer_guide.pdf from ARM Ltd. Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/debug.S')
-rw-r--r--arch/arm/kernel/debug.S25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 204e2160cfcc..e5a765c5f06a 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -100,7 +100,7 @@
#endif /* CONFIG_CPU_V6 */
-#else
+#elif !defined(CONFIG_DEBUG_SEMIHOSTING)
#include <mach/debug-macro.S>
#endif /* CONFIG_DEBUG_ICEDCC */
@@ -155,6 +155,8 @@ hexbuf: .space 16
.ltorg
+#ifndef CONFIG_DEBUG_SEMIHOSTING
+
ENTRY(printascii)
addruart_current r3, r1, r2
b 2f
@@ -177,3 +179,24 @@ ENTRY(printch)
mov r0, #0
b 1b
ENDPROC(printch)
+
+#else
+
+ENTRY(printascii)
+ mov r1, r0
+ mov r0, #0x04 @ SYS_WRITE0
+ ARM( svc #0x123456 )
+ THUMB( svc #0xab )
+ mov pc, lr
+ENDPROC(printascii)
+
+ENTRY(printch)
+ adr r1, hexbuf
+ strb r0, [r1]
+ mov r0, #0x03 @ SYS_WRITEC
+ ARM( svc #0x123456 )
+ THUMB( svc #0xab )
+ mov pc, lr
+ENDPROC(printch)
+
+#endif