* [U-Boot] debug uboot from ram for x86 board
@ 2008-12-25 5:52 LanceZ
2008-12-25 11:36 ` Graeme Russ
0 siblings, 1 reply; 4+ messages in thread
From: LanceZ @ 2008-12-25 5:52 UTC (permalink / raw)
To: u-boot
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
--
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] debug uboot from ram for x86 board
2008-12-25 5:52 [U-Boot] debug uboot from ram for x86 board LanceZ
@ 2008-12-25 11:36 ` Graeme Russ
2008-12-26 5:34 ` Lance Zhang
0 siblings, 1 reply; 4+ messages in thread
From: Graeme Russ @ 2008-12-25 11:36 UTC (permalink / raw)
To: u-boot
On Thu, Dec 25, 2008 at 4:52 PM, LanceZ <Lance.Zhang@taihootech.com> wrote:
>
> 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
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
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot] debug uboot from ram for x86 board
2008-12-25 11:36 ` Graeme Russ
@ 2008-12-26 5:34 ` Lance Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Lance Zhang @ 2008-12-26 5:34 UTC (permalink / raw)
To: u-boot
Hi Graeme
>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
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] debug uboot from ram for x86 board
@ 2008-12-26 6:45 Lance Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Lance Zhang @ 2008-12-26 6:45 UTC (permalink / raw)
To: u-boot
> 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;
>
Later, I tried remove the function bodies, and the main function like
this:
int _main (int argc, char *argv[])
{
return (8);
}
And got the following result:
boot > go 01000000
## Starting application at 0x01000000 ...
## Application terminated, rc = 0x8
I am sure app_startup and do_go are not consistent, so I can not use any
printf or some other function calls.
Currently I can not update the flash as I do not have jtag tools. Later
I will update flash and see if it could fix the problem.
Thanks in advance
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-26 6:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-25 5:52 [U-Boot] debug uboot from ram for x86 board LanceZ
2008-12-25 11:36 ` Graeme Russ
2008-12-26 5:34 ` Lance Zhang
-- strict thread matches above, loose matches on Subject: below --
2008-12-26 6:45 Lance Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.