blob: 6bf2917a46214f09215e35debe7ddfdc5df4d5d3 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Shawn Guo3b4af9b2013-03-14 08:48:06 +01002#include <linux/linkage.h>
3#include <asm/assembler.h>
4
Nicolas Pitre27523672013-05-29 16:57:30 +01005#ifndef CONFIG_DEBUG_SEMIHOSTING
6
Shawn Guo3b4af9b2013-03-14 08:48:06 +01007#include CONFIG_DEBUG_LL_INCLUDE
8
9ENTRY(putc)
10 addruart r1, r2, r3
11 waituart r3, r1
12 senduart r0, r1
13 busyuart r3, r1
14 mov pc, lr
15ENDPROC(putc)
Nicolas Pitre27523672013-05-29 16:57:30 +010016
17#else
18
19ENTRY(putc)
20 adr r1, 1f
21 ldmia r1, {r2, r3}
22 add r2, r2, r1
23 ldr r1, [r2, r3]
24 strb r0, [r1]
25 mov r0, #0x03 @ SYS_WRITEC
26 ARM( svc #0x123456 )
Nicolas Pitreee3eaee2017-10-06 19:39:57 +010027#ifdef CONFIG_CPU_V7M
28 THUMB( bkpt #0xab )
29#else
Nicolas Pitre27523672013-05-29 16:57:30 +010030 THUMB( svc #0xab )
Nicolas Pitreee3eaee2017-10-06 19:39:57 +010031#endif
Nicolas Pitre27523672013-05-29 16:57:30 +010032 mov pc, lr
33 .align 2
341: .word _GLOBAL_OFFSET_TABLE_ - .
35 .word semi_writec_buf(GOT)
36ENDPROC(putc)
37
38 .bss
39 .global semi_writec_buf
40 .type semi_writec_buf, %object
41semi_writec_buf:
42 .space 4
43 .size semi_writec_buf, 4
44
45#endif