diff options
-rw-r--r-- | firmware/debug.c | 31 | ||||
-rw-r--r-- | firmware/export/config-ifp7xx.h | 2 | ||||
-rw-r--r-- | firmware/export/debug.h | 5 | ||||
-rw-r--r-- | firmware/export/gdb_api.h | 35 | ||||
-rw-r--r-- | gdb/linker.cfg | 8 |
5 files changed, 80 insertions, 1 deletions
diff --git a/firmware/debug.c b/firmware/debug.c index ba19a9616a..4031ba432d 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
25 | #ifdef HAVE_GDB_API | ||
26 | #include "gdb_api.h" | ||
27 | #endif | ||
25 | 28 | ||
26 | #ifdef DEBUG | 29 | #ifdef DEBUG |
27 | static char debugmembuf[200]; | 30 | static char debugmembuf[200]; |
@@ -196,6 +199,34 @@ static void debug(const char *msg) | |||
196 | putpacket(debugbuf); | 199 | putpacket(debugbuf); |
197 | } | 200 | } |
198 | #endif /* SH7034 */ | 201 | #endif /* SH7034 */ |
202 | |||
203 | #ifdef HAVE_GDB_API | ||
204 | static void *get_api_function(int n) | ||
205 | { | ||
206 | struct gdb_api *api = (struct gdb_api *)GDB_API_ADDRESS; | ||
207 | if (api->magic == GDB_API_MAGIC) | ||
208 | return api->func[n]; | ||
209 | else | ||
210 | return NULL; | ||
211 | } | ||
212 | |||
213 | void breakpoint(void) | ||
214 | { | ||
215 | void (*f)(void) = get_api_function(0); | ||
216 | if (f) (*f)(); | ||
217 | } | ||
218 | |||
219 | static void debug(char *msg) | ||
220 | { | ||
221 | void (*f)(char *) = get_api_function(1); | ||
222 | if (f) (*f)(msg); | ||
223 | } | ||
224 | |||
225 | void debug_init() | ||
226 | { | ||
227 | } | ||
228 | |||
229 | #endif /* HAVE_GDB_API */ | ||
199 | #endif /* end of DEBUG section */ | 230 | #endif /* end of DEBUG section */ |
200 | 231 | ||
201 | #ifdef __GNUC__ | 232 | #ifdef __GNUC__ |
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index 086b455235..9e5a432260 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h | |||
@@ -84,6 +84,8 @@ | |||
84 | 84 | ||
85 | #define USB_ISP1582 | 85 | #define USB_ISP1582 |
86 | 86 | ||
87 | #define HAVE_GDB_API | ||
88 | |||
87 | /* Virtual LED (icon) */ | 89 | /* Virtual LED (icon) */ |
88 | #define CONFIG_LED LED_VIRTUAL | 90 | #define CONFIG_LED LED_VIRTUAL |
89 | 91 | ||
diff --git a/firmware/export/debug.h b/firmware/export/debug.h index 0506ff1e42..52b6687c6b 100644 --- a/firmware/export/debug.h +++ b/firmware/export/debug.h | |||
@@ -31,6 +31,11 @@ extern void ldebugf(const char* file, int line, const char *fmt, ...); | |||
31 | #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) | 31 | #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) |
32 | #else | 32 | #else |
33 | #if defined(DEBUG) | 33 | #if defined(DEBUG) |
34 | |||
35 | #ifdef HAVE_GDB_API | ||
36 | void breakpoint(void); | ||
37 | #endif | ||
38 | |||
34 | #define DEBUGF debugf | 39 | #define DEBUGF debugf |
35 | #define LDEBUGF debugf | 40 | #define LDEBUGF debugf |
36 | #else | 41 | #else |
diff --git a/firmware/export/gdb_api.h b/firmware/export/gdb_api.h new file mode 100644 index 0000000000..896c8d399d --- /dev/null +++ b/firmware/export/gdb_api.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Tomasz Malesinski | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _GDB_API_H_ | ||
21 | #define _GDB_API_H_ | ||
22 | |||
23 | #include "config.h" | ||
24 | |||
25 | #define GDB_API_MAGIC 0x6db570b | ||
26 | #ifdef IRIVER_IFP7XX_SERIES | ||
27 | #define GDB_API_ADDRESS 0x24006000 | ||
28 | #endif | ||
29 | |||
30 | struct gdb_api | ||
31 | { | ||
32 | unsigned long magic; | ||
33 | void *func[]; | ||
34 | }; | ||
35 | #endif | ||
diff --git a/gdb/linker.cfg b/gdb/linker.cfg index 2cc6a0e9b4..46ec779817 100644 --- a/gdb/linker.cfg +++ b/gdb/linker.cfg | |||
@@ -13,7 +13,8 @@ OUTPUT_FORMAT(elf32-sh) | |||
13 | MEMORY | 13 | MEMORY |
14 | { | 14 | { |
15 | IRAM : ORIGIN = 0, LENGTH = 0x10000 | 15 | IRAM : ORIGIN = 0, LENGTH = 0x10000 |
16 | DRAM : ORIGIN = 0x24000000, LENGTH = 0x8000 | 16 | DRAM : ORIGIN = 0x24000000, LENGTH = 0x6000 |
17 | DRAM_API : ORIGIN = 0x24006000, LENGTH = 0x100 | ||
17 | } | 18 | } |
18 | 19 | ||
19 | SECTIONS | 20 | SECTIONS |
@@ -29,6 +30,11 @@ SECTIONS | |||
29 | *(.glue_7t) | 30 | *(.glue_7t) |
30 | } >DRAM | 31 | } >DRAM |
31 | 32 | ||
33 | .gdbapi : | ||
34 | { | ||
35 | *(.gdbapi) | ||
36 | } >DRAM_API | ||
37 | |||
32 | .data : | 38 | .data : |
33 | { | 39 | { |
34 | *(.data) | 40 | *(.data) |