- bootloader build with LTO

- switch between debugger from rom or from app
- gdb_stub: added debug output to stdout

git-svn-id: http://moon:8086/svn/mips@104 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-19 18:03:53 +00:00
parent cfef553c9c
commit f3e297c9e6
6 changed files with 102 additions and 35 deletions
+17 -2
View File
@@ -92,8 +92,9 @@
extern void dbg_putchar(char c); /* write a single character */
extern char dbg_getchar(); /* read and return a single char */
extern void ICACHE_invalidate_all();
extern void flush_i_cache();
extern int sputs(char const *pStr);
extern void print_byte(char byte);
extern void print_word(int word);
void putDebugChar(char c)
{
@@ -415,6 +416,7 @@ handle_exception (unsigned long *registers)
char remcomInBuffer[BUFMAX];
char remcomOutBuffer[BUFMAX];
sputs("Entry\n");
unsigned long tt; /* Trap type */
unsigned long sigval;
unsigned long addr;
@@ -466,6 +468,7 @@ handle_exception (unsigned long *registers)
switch (*ptr++)
{
case '?':
sputs("?\n");
remcomOutBuffer[0] = 'S';
remcomOutBuffer[1] = hexchars[sigval >> 4];
remcomOutBuffer[2] = hexchars[sigval & 0xf];
@@ -473,10 +476,12 @@ handle_exception (unsigned long *registers)
break;
case 'd': /* toggle debug flag */
sputs("d\n");
break;
case 'g': /* return the value of the CPU registers */
{
sputs("g\n");
ptr = remcomOutBuffer;
/* R00 .. R31 */
ptr = mem2hex((char *)&registers[R00], ptr, 4*32, 0);
@@ -499,6 +504,7 @@ handle_exception (unsigned long *registers)
case 'G': /* set the value of the CPU registers - return OK */
{
sputs("G\n");
unsigned long *newsp, sr;
sr = registers[SR];
@@ -538,6 +544,7 @@ handle_exception (unsigned long *registers)
break;
case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
sputs("m\n");
/* Try to read %x,%x. */
if (hexToInt(&ptr, &addr) && *ptr++ == ',' && hexToInt(&ptr, &length))
@@ -552,6 +559,7 @@ handle_exception (unsigned long *registers)
{
strcpy(remcomOutBuffer,"E01");
}
sputs("m:"); print_word(addr); sputs(",");print_word(length); sputs("\n");
break;
case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
@@ -572,14 +580,17 @@ handle_exception (unsigned long *registers)
{
strcpy(remcomOutBuffer, "E02");
}
sputs("M:"); print_word(addr); sputs(",");print_word(length); sputs("\n");
break;
case 'c': /* cAA..AA Continue at address AA..AA(optional) */
/* try to read optional parameter, pc unchanged if no parm */
sputs("c: PC="); print_word(registers[PC]);sputs("\n");
if (hexToInt(&ptr, &addr))
{
registers[PC] = addr;
sputs("c: addr="); print_word(addr);sputs("\n");
}
/* Need to flush the instruction cache here, as we may have deposited a
@@ -592,6 +603,7 @@ handle_exception (unsigned long *registers)
/* kill the program */
case 'k' : /* do nothing */
sputs("Kill\n");
break;
#if 0
case 't': /* Test feature */
@@ -599,9 +611,12 @@ handle_exception (unsigned long *registers)
#endif
case 'r': /* Reset */
// Perform reset
sputs("Reset\n");
break;
} /* switch */
/* reply to the request */
putpacket(remcomOutBuffer);
}
sputs("Exit\n");
}