- no memset and strcpy in gdb_stub

- boattloader : refactored, size optimization, nostartup, nostdlib, nodefaultlibs

git-svn-id: http://moon:8086/svn/mips@119 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-22 13:51:31 +00:00
parent 793df682b1
commit e86064fd65
6 changed files with 69 additions and 385 deletions
+29 -8
View File
@@ -111,6 +111,27 @@ void flush_i_cache()
ICACHE_invalidate_all();
}
void dbg_strcpy(char *pDst, const char *pSrc)
{
while(*pSrc)
{
*(pDst++) = *(pSrc++);
}
*pDst = *pSrc;
}
void* dbg_memset(void *pBuffer, int value, size_t size)
{
char *pData = (char*)pBuffer;
while(size)
{
*(pData++) = (char)value;
size--;
}
return (void*)pData;
}
/************************************************************************/
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
/* at least NUMREGBYTES*2 are needed for register packets */
@@ -493,10 +514,10 @@ handle_exception (unsigned long *registers)
ptr = mem2hex((char *)&registers[CR], ptr, 4, 0);
ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
/* Floating point F00 .. F31*/
memset(ptr, '0', 8 * 32);
dbg_memset(ptr, '0', 8 * 32);
ptr += 8*32;
/* FCSR, FIR, RESTART*/
memset(ptr, '0', 8 * 3);
dbg_memset(ptr, '0', 8 * 3);
ptr += 8*3;
*ptr = 0;
}
@@ -525,7 +546,7 @@ handle_exception (unsigned long *registers)
ptr += 4 * 2;
*ptr = 0;
strcpy(remcomOutBuffer,"OK");
dbg_strcpy(remcomOutBuffer,"OK");
}
break;
@@ -539,11 +560,11 @@ handle_exception (unsigned long *registers)
{
break;
}
strcpy (remcomOutBuffer, "E03");
dbg_strcpy (remcomOutBuffer, "E03");
}
else
{
strcpy(remcomOutBuffer,"E01");
dbg_strcpy(remcomOutBuffer,"E01");
}
sputs("m:"); print_word(addr); sputs(",");print_word(length); sputs("\n");
break;
@@ -555,16 +576,16 @@ handle_exception (unsigned long *registers)
{
if (hex2mem(ptr, (char *)addr, length, 1))
{
strcpy(remcomOutBuffer, "OK");
dbg_strcpy(remcomOutBuffer, "OK");
}
else
{
strcpy(remcomOutBuffer, "E03");
dbg_strcpy(remcomOutBuffer, "E03");
}
}
else
{
strcpy(remcomOutBuffer, "E02");
dbg_strcpy(remcomOutBuffer, "E02");
}
sputs("M:"); print_word(addr); sputs(",");print_word(length); sputs("\n");
break;