gint/gdb: more testing with gdb

This commit is contained in:
Lephenixnoir 2024-04-12 08:07:12 +02:00
parent 21b261d0c9
commit 29fbc5cd8a
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
6 changed files with 52 additions and 35 deletions

View File

@ -77,6 +77,7 @@ set(ASSETS_fx
assets-fx/img/opt_gint_cpumem.png
assets-fx/img/opt_gint_dma.png
assets-fx/img/opt_gint_drivers.png
assets-fx/img/opt_gint_gdb.png
assets-fx/img/opt_gint_gray.png
assets-fx/img/opt_gint_keyboard.png
assets-fx/img/opt_gint_kmalloc.png
@ -124,7 +125,7 @@ fxconv_declare_assets(${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(gintctl ${SOURCES} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(gintctl PRIVATE
-Wall -Wextra -Os)
-Wall -Wextra -Os -g)
target_link_options(gintctl PRIVATE
-Wl,-Map=map -Wl,--print-memory-usage)
target_include_directories(gintctl PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -28,6 +28,7 @@ extern bopti_image_t
img_opt_gint_bopti,
img_opt_gint_cpumem,
img_opt_gint_drivers,
img_opt_gint_gdb,
img_opt_gint_gray,
img_opt_gint_keyboard,
img_opt_gint_kmalloc,

View File

@ -3,6 +3,7 @@
#include <gint/mpu/power.h>
#include <gint/mpu/ubc.h>
#include <gint/ubc.h>
#include <gint/config.h>
#include <gintctl/assets.h>
#include <gintctl/gint.h>
@ -11,14 +12,16 @@
#ifdef FXCG50
static void val(int y, const char *name, uint32_t value)
{
dtext(0, 20 + y*12, C_BLACK, name);
dprint(88, 20 + y*12, C_BLACK, "%08X", value);
dtext(4, 20 + y*12, C_BLACK, name);
dprint(92, 20 + y*12, C_BLACK, "%08X", value);
}
#else
static void val(int y, const char *name, uint32_t value)
{
dtext(0, 8 + y*6, C_BLACK, name);
dprint(40, 8 + y*6, C_BLACK, "%08X", value);
int px = 64 * (y / 8);
int py = 8 + 6 * (y % 8);
dtext(px, py, C_BLACK, name);
dprint(px+30, py, C_BLACK, "%08X", value);
}
#endif
@ -32,48 +35,49 @@ void gintctl_gint_gdb(void)
{
int key = 0;
int ret = -1;
gdb_start_on_exception();
while (key != KEY_EXIT) {
dclear(C_WHITE);
#ifdef FXCG50
row_title("GDB remote serial protocol");
#else
row_title("GDB");
#endif
row_title(GINT_HW_SWITCH("GDB", "GDB remote serial protocol"));
#ifdef FXCG50
#if GINT_RENDER_MONO
dimage(0, 56, &img_opt_gint_gdb);
#elif GINT_RENDER_RGB
fkey_action(6, "START");
fkey_action(5, "PANICR");
fkey_action(4, "PANICW");
fkey_action(3, "STOP");
fkey_action(1, "BANK 1");
#endif
#ifdef FX9860G
font_t const *old_font = dfont(&font_mini);
#endif
val(0, "ret", ret);
reg(1, "MSTPCR0", SH7305_POWER.MSTPCR0);
reg(2, "CBR0", SH7305_UBC.CBR0);
reg(3, "CRR0", SH7305_UBC.CRR0);
val(4, "CAR0", SH7305_UBC.CAR0);
val(5, "CAMR0", SH7305_UBC.CAMR0);
reg(6, "CBR1", SH7305_UBC.CBR1);
reg(7, "CRR1", SH7305_UBC.CRR1);
val(8, "CAR1", SH7305_UBC.CAR1);
val(9, "CAMR1", SH7305_UBC.CAMR1);
val(10, "CDR1", SH7305_UBC.CDR1);
val(11, "CDMR1", SH7305_UBC.CDMR1);
reg(12, "CETR1", SH7305_UBC.CETR1);
reg(13, "CCMFR", SH7305_UBC.CCMFR);
reg(14, "CBCR", SH7305_UBC.CBCR);
val(15, "DBR", (uint32_t) ubc_getDBR());
font_t const *old_font = dfont(_(&font_mini, dfont_default()));
reg(0, _("MSTP...", "MSTPCR0"), SH7305_POWER.MSTPCR0);
reg(1, "CBR0", SH7305_UBC.CBR0);
reg(2, "CRR0", SH7305_UBC.CRR0);
val(3, "CAR0", SH7305_UBC.CAR0);
val(4, "CAMR0", SH7305_UBC.CAMR0);
reg(5, "CBR1", SH7305_UBC.CBR1);
reg(6, "CRR1", SH7305_UBC.CRR1);
val(7, "CAR1", SH7305_UBC.CAR1);
val(8, "CAMR1", SH7305_UBC.CAMR1);
val(9, "CDR1", SH7305_UBC.CDR1);
val(10, "CDMR1", SH7305_UBC.CDMR1);
reg(11, "CETR1", SH7305_UBC.CETR1);
reg(12, "CCMFR", SH7305_UBC.CCMFR);
reg(13, "CBCR", SH7305_UBC.CBCR);
val(14, "DBR", (uint32_t) ubc_getDBR());
#ifdef FX9860G
val(15, "ret", ret);
#endif
#ifdef FXCG50
dprint(176, 20, C_BLACK, "exc_catcher: %p", gint_exc_catcher);
dprint(176, 20, C_BLACK, "ret: %d", ret);
dprint(176, 32, C_BLACK, "exc_catcher: %p", gint_exc_catcher);
#endif
#ifdef FX9860G
dfont(old_font);
#endif
dupdate();
key_event_t ev = gintctl_getkey();
@ -82,10 +86,13 @@ void gintctl_gint_gdb(void)
volatile uint32_t* miss = (void*)0x41414140;
if (key == KEY_F6) {
ret = gdb_start();
gdb_main(NULL);
} else if (key == KEY_F5) {
ret = *miss;
} else if (key == KEY_F4) {
*miss = 0x1337;
} else if (key == KEY_F3) {
__asm__("trapa #42");
} else if (key == KEY_F1) {
ret = gintctl_gint_gdb_bank1_test();
}

View File

@ -1,6 +1,8 @@
#define __BSD_VISIBLE 1
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/config.h>
#include <gint/video.h>
#include <gintctl/util.h>
#include <math.h>
@ -29,7 +31,7 @@ void gintctl_gint_render(void)
dclear(C_WHITE);
drect_border(1, 1, DWIDTH-2, DHEIGHT-2, C_NONE, 1, C_BLACK);
#ifdef FXCG50
#if GINT_RENDER_RGB
drect_border(3, 3, DWIDTH-4, DHEIGHT-4, C_NONE, 1, C_BLACK);
#endif
@ -79,6 +81,12 @@ void gintctl_gint_render(void)
dcircle(x4+w1/2, y3, r, fill2, C_NONE);
dupdate();
#if GINT_HW_CG
extern image_t gint_gdb_icons_rgb565;
video_update(0, 0, &gint_gdb_icons_rgb565, 0);
#endif
if(getkey().key == KEY_EXIT)
return;
}

View File

@ -61,7 +61,7 @@ struct menu menu_gint = {
#if GINT_RENDER_MONO
{ "Gray rendering", gintctl_gint_grayrender, 0 },
#endif
{ "GDB", gintctl_gint_gdb, 0},
{ "GDB", gintctl_gint_gdb, MENU_SH4_ONLY },
{ NULL, NULL, 0 },
}};