From 9c1f2edd6f2799d6bdb1c2d8e15edcd822dba8e8 Mon Sep 17 00:00:00 2001 From: claudiol Date: Fri, 13 Nov 2015 16:46:52 -0500 Subject: [PATCH 1/2] Activated debug mode with -d switch in command line. --- gdbstub.c | 10 +++++----- main.c | 22 ++++++++++++++++------ timer.c | 4 ---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 775a239..78ec755 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -45,7 +45,7 @@ #include #endif -#define DEBUG_GDB +//#define DEBUG_GDB enum RSState { RS_IDLE, @@ -455,7 +455,7 @@ static void gdb_read_byte(GDBState *s, int ch) int i, csum; char reply[1]; -printf("%s: state %u, byte %02x (%c)\n", __FUNCTION__, s->state, ch, ch); +//printf("%s: state %u, byte %02x (%c)\n", __FUNCTION__, s->state, ch, ch); fflush(stdout); switch(s->state) { @@ -515,7 +515,7 @@ gdb_handlesig (CPUState *env, int sig) s = &gdbserver_state; -printf("%s: sig: %u\n", __FUNCTION__, sig); +//printf("%s: sig: %u\n", __FUNCTION__, sig); fflush(stdout); /* disable single step if it was enabled */ @@ -537,7 +537,7 @@ fflush(stdout); { int i; -printf("%s: read: %d\n", __FUNCTION__, n); +//printf("%s: read: %d\n", __FUNCTION__, n); fflush(stdout); for (i = 0; i < n; i++) @@ -573,7 +573,7 @@ gdb_poll (CPUState *env) return 0; } -printf("%s: revents: %08x\n", __FUNCTION__, pfd.revents); +//printf("%s: revents: %08x\n", __FUNCTION__, pfd.revents); fflush(stdout); if (pfd.revents & (POLLIN | POLLHUP)) diff --git a/main.c b/main.c index 2ea6338..1bd6a2f 100644 --- a/main.c +++ b/main.c @@ -25,6 +25,14 @@ #include "gdbstub.h" +static void *oom_check(void *ptr) +{ + if (ptr == NULL) { + abort(); + } + return ptr; +} + static x49gp_t *x49gp; #ifdef QEMU_OLD // LD TEMPO HACK @@ -383,7 +391,7 @@ printf("%s:%u: x49gp: %p\n", __FUNCTION__, __LINE__, x49gp); exit(1); } - error = x49gp_modules_load(x49gp, argv[1]); + error = x49gp_modules_load(x49gp, argv[argc-1]); if (error) { if (error != -EAGAIN) { exit(1); @@ -408,15 +416,17 @@ printf("%s:%u: x49gp: %p\n", __FUNCTION__, __LINE__, x49gp); x49gp_mod_timer(x49gp->lcd_timer, x49gp_get_clock()); -#if 0 - gdbserver_start(1234); - gdb_handlesig(x49gp->env, 0); -#endif + if(argc>=3) { + if((argv[1][0]=='-')&&(argv[1][1]=='d')&&(argv[1][2]==0)) { + gdbserver_start(1234); + gdb_handlesig(x49gp->env, 0); + } + } x49gp_main_loop(x49gp); - x49gp_modules_save(x49gp, argv[1]); + x49gp_modules_save(x49gp, argv[argc-1]); x49gp_modules_exit(x49gp); diff --git a/timer.c b/timer.c index 9a5258f..ff8a8a5 100644 --- a/timer.c +++ b/timer.c @@ -232,11 +232,9 @@ x49gp_main_loop_wait(x49gp_t *x49gp, int timeout) { // printf("%s: timeout: %d\n", __FUNCTION__, timeout); -#if 0 if (gdb_poll(x49gp->env)) { gdb_handlesig(x49gp->env, 0); } else -#endif poll(NULL, 0, timeout); if (x49gp->arm_idle != X49GP_ARM_OFF) { @@ -277,11 +275,9 @@ printf("PC %08x: SRAM %08x: %08x %08x %08x <%08x>\n", x49gp->env->regs[15], 0x08 * ((uint32_t *) &x49gp->sram[0x0a0c]) = 0x00000000; } -#if 0 if (ret == EXCP_DEBUG) { gdb_handlesig(x49gp->env, SIGTRAP); } -#endif if (x49gp->arm_idle != prev_idle) { if (x49gp->arm_idle == X49GP_ARM_OFF) { From f5c0ad34cd7519cc318e01dfcc4189126c3d1c90 Mon Sep 17 00:00:00 2001 From: claudiol Date: Mon, 10 Jul 2017 08:26:02 -0400 Subject: [PATCH 2/2] Changed firmware to newrpl. --- updatefw | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 updatefw diff --git a/updatefw b/updatefw new file mode 100755 index 0000000..125d72b --- /dev/null +++ b/updatefw @@ -0,0 +1,3 @@ +rm flash-50g flash-noboot +make flash-50g +