Commit 0c909551f88c0d92a919ff70127df7b33cdd473d
Committed by
Wolfgang Denk
1 parent
fa2744de65
Exists in
master
and in
54 other branches
kgdb: add default generic stubs
The default kgdb functions can be implemented with common U-Boot functions, so rather than force everyone to copy & paste these things, create a set of weak stubs. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Showing 2 changed files with 65 additions and 1 deletions Side-by-side Diff
common/Makefile
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | COBJS-$(CONFIG_HWCONFIG) += hwconfig.o |
158 | 158 | COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o |
159 | 159 | COBJS-y += flash.o |
160 | -COBJS-$(CONFIG_CMD_KGDB) += kgdb.o | |
160 | +COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o | |
161 | 161 | COBJS-$(CONFIG_KALLSYMS) += kallsyms.o |
162 | 162 | COBJS-$(CONFIG_LCD) += lcd.o |
163 | 163 | COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o |
common/kgdb_stubs.c
1 | +/* | |
2 | + * U-boot - stub functions for common kgdb code, | |
3 | + * can be overridden in board specific files | |
4 | + * | |
5 | + * Copyright 2009 Analog Devices Inc. | |
6 | + * | |
7 | + * Licensed under the GPL-2 or later. | |
8 | + */ | |
9 | + | |
10 | +#include <common.h> | |
11 | +#include <kgdb.h> | |
12 | + | |
13 | +int (*debugger_exception_handler)(struct pt_regs *); | |
14 | + | |
15 | +__attribute__((weak)) | |
16 | +void kgdb_serial_init(void) | |
17 | +{ | |
18 | + puts("[on serial] "); | |
19 | +} | |
20 | + | |
21 | +__attribute__((weak)) | |
22 | +void putDebugChar(int c) | |
23 | +{ | |
24 | + serial_putc(c); | |
25 | +} | |
26 | + | |
27 | +__attribute__((weak)) | |
28 | +void putDebugStr(const char *str) | |
29 | +{ | |
30 | +#ifdef DEBUG | |
31 | + serial_puts(str); | |
32 | +#endif | |
33 | +} | |
34 | + | |
35 | +__attribute__((weak)) | |
36 | +int getDebugChar(void) | |
37 | +{ | |
38 | + return serial_getc(); | |
39 | +} | |
40 | + | |
41 | +__attribute__((weak)) | |
42 | +void kgdb_interruptible(int yes) | |
43 | +{ | |
44 | + return; | |
45 | +} | |
46 | + | |
47 | +__attribute__((weak)) | |
48 | +void kgdb_flush_cache_range(void *from, void *to) | |
49 | +{ | |
50 | + flush_cache((unsigned long)from, (unsigned long)(to - from)); | |
51 | +} | |
52 | + | |
53 | +__attribute__((weak)) | |
54 | +void kgdb_flush_cache_all(void) | |
55 | +{ | |
56 | + if (dcache_status()) { | |
57 | + dcache_disable(); | |
58 | + dcache_enable(); | |
59 | + } | |
60 | + if (icache_status()) { | |
61 | + icache_disable(); | |
62 | + icache_enable(); | |
63 | + } | |
64 | +} |