
On Sat, 25 Dec 2021 at 12:57, Ovidiu Panait ovidiu.panait@windriver.com wrote:
Add a return value to kgdb_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Also, move the "KGDB" print message inside kgdb_init().
Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
common/board_r.c | 11 +---------- common/kgdb.c | 7 +++++-- include/kgdb.h | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-)
With changes below: Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/common/board_r.c b/common/board_r.c index a5c1af9c1f..1c7397b29e 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -498,15 +498,6 @@ static int initr_ethaddr(void) } #endif /* CONFIG_CMD_NET */
-#ifdef CONFIG_CMD_KGDB -static int initr_kgdb(void) -{
puts("KGDB: ");
kgdb_init();
return 0;
-} -#endif
#if defined(CONFIG_LED_STATUS) static int initr_status_led(void) { @@ -750,7 +741,7 @@ static init_fnc_t init_sequence_r[] = { #endif INIT_FUNC_WATCHDOG_RESET #ifdef CONFIG_CMD_KGDB
initr_kgdb,
kgdb_init,
#endif interrupt_init, #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K) diff --git a/common/kgdb.c b/common/kgdb.c index 4493a15919..29b09fcfe5 100644 --- a/common/kgdb.c +++ b/common/kgdb.c @@ -527,15 +527,18 @@ handle_exception (struct pt_regs *regs)
- kgdb_init must be called *after* the
- monitor is relocated into ram
*/ -void -kgdb_init(void) +int kgdb_init(void) {
puts("KGDB: ");
kgdb_serial_init(); debugger_exception_handler = handle_exception; initialized = 1; putDebugStr("kgdb ready\n"); puts("ready\n");
return 0;
}
void diff --git a/include/kgdb.h b/include/kgdb.h index 616ce4451f..0609eadade 100644 --- a/include/kgdb.h +++ b/include/kgdb.h @@ -39,7 +39,7 @@ typedef kgdb_data;
/* these functions are provided by the generic kgdb support */ -extern void kgdb_init(void); +extern int kgdb_init(void);
Drop the extern and also please add a comment
extern void kgdb_error(int); extern int kgdb_output_string(const char *, unsigned int); extern void breakpoint(void); -- 2.25.1