Skip to contentSkip to conversation

debug uboot from ram for x86 board

U-Boot LanceZ 2 participants 3 messages Dec 25, 2008 – Dec 26, 2008

lore
Share & tools
lore

LanceZ

author
#0 lore raw

Hi there,

I am trying to add some codes(driver) to u boot, but I do not have jtag or other debugging tools. what I can use are :serial port/ethernet, so I can use tftp and loadb to download the bin to ram.

Currently, I tried to use "loadb" to load the sample(hello_world) to ram and then execute it, I always failed .here are the output for my testing.

I rename hello_world to rt61test
then rebuild all uboot
use nm command get follows:

00040000 T rt61test
00040098 T dummy

then start my board

In:    serial
Out:   serial
Err:   serial
Net:   i82559#0

boot > loadb 0x40000
## Ready for binary (kermit) download to 0x00040000 at 115200 bps...
## Start Addr = 0x00040000
boot > go 40000
## Starting application at 0x00040000 ...
Invalid Instruction at 0000:00000000

I also tried other address for loadb(loadb 0x1000000)

I got the same error result

Appreciate anyone can give me a direction or explain the error

Thanks

Signature · 2 lines
View this message in context: http://www.nabble.com/debug-uboot-from-ram-for-x86-board-tp21165593p21165593.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
#1 lore raw
Quoted 29 lines · LanceZ

Hi there,

I am trying to add some codes(driver) to u boot, but I do not have jtag or other debugging tools. what I can use are :serial port/ethernet, so I can use tftp and loadb to download the bin to ram.

Currently, I tried to use "loadb" to load the sample(hello_world) to ram and then execute it, I always failed .here are the output for my testing.

I rename hello_world to rt61test
then rebuild all uboot
use nm command get follows:

00040000 T rt61test
00040098 T dummy

then start my board

In:    serial
Out:   serial
Err:   serial
Net:   i82559#0

boot > loadb 0x40000
## Ready for binary (kermit) download to 0x00040000 at 115200 bps...
## Start Addr = 0x00040000
boot > go 40000
## Starting application at 0x00040000 ...
Invalid Instruction at 0000:00000000

Quoted 7 lines

I also tried other address for loadb(loadb 0x1000000)

I got the same error result

Appreciate anyone can give me a direction or explain the error

Thanks

Hi Lance,

I have the same problem. I am in the process of finalising some other x86 common code to make the custom board port more seemless before I dig deeper.

I do, however, feel that a look at the nios code (lib_nios/board.c) might shed some light on the issue. Specifically the comment in do_go_exec:

unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])

{
	/*
	 * x86 does not use a dedicated register to pass the pointer
	 * to the global_data
	 */
	argv[-1] = (char *)gd;
	return entry (argc, argv);
}

I think the lib_i386 implementation of do_go_exec() is not right

Regards,

Graeme

#2 lore raw

Hi Graeme

Quoted 1 line

I have the same problem. I am in the process of finalising some other

x86

Quoted 1 line

common code to make the custom board port more seemless before I dig

deeper.

Quoted 1 line

I do, however, feel that a look at the nios code (lib_nios/board.c)

might

Quoted 3 lines

shed some light on the issue. Specifically the comment in do_go_exec:

unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char

*argv[])

Quoted 11 lines
{
	/*
	 * x86 does not use a dedicated register to pass the pointer
	 * to the global_data
	 */
	argv[-1] = (char *)gd;
	return entry (argc, argv);
}

I think the lib_i386 implementation of do_go_exec() is not right

I carefully read the codes related to the do_go function, and I find that(u boot 1.1.6):
In do_go() functions:

#if defined(CONFIG_I386)
	/*
	 * x86 does not use a dedicated register to pass the pointer
	 * to the global_data
	 */
	argv[0] = (char *)gd;

#endif

But in app_startup function:
void app_startup(char **argv)

{
	unsigned long * cp = &__bss_start;

	/* Zero out BSS */
	while (cp < &_end) {
		*cp++ = 0;
	}
#if defined(CONFIG_I386)
	/* x86 does not have a dedicated register for passing
global_data */
	global_data = (gd_t *)argv[-1];
	jt = global_data->jt;

#endif
}

The gd is not in the same place :see do_go is argv[0], and app_startup is (gd_t *)argv[-1].

But later I modified the global_data = (gd_t *)argv[-1]; in app_startup function to global_data = (gd_t *)argv[0], the change still does not make sense.

Any ideas? Maybe I should change the argv[0] = (char *)gd; in do_go function to argv[-1] = (char *)gd;

Thanks
Lance Zhang