[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] standalone C program "Hello World" on qemu-system-mipse
From: |
Leo Chen. |
Subject: |
Re: [Qemu-devel] standalone C program "Hello World" on qemu-system-mipsel |
Date: |
Sun, 3 Jul 2011 23:00:02 +0800 |
Hi, Andreas
Thanks for your reply.
I tried the -bios *.elf:
qemu-system-mipsel -M mipssim -nographic -bios bin/test.elf
The result is the same with -kernel *.elf: C program can work, but the
serial port still not working.
And I also tried the normal way: -kernel *.bin
mips-linux-gnu-objcopy -O binary bin/test.elf bin/test.bin
qemu-system-mipsel -M mipssim -nographic -kernel bin/test.bin
and get this failure message:
qemu: could not load kernel 'bin/test.bin'
I know the C programe is working by doing these:
step1:
add some useless code in my C entry:
void c_entry()
{
init_serial();
int a, b, c; //useless code, for remote GDB trace
a = 1;
b = 2;
c = a+b;
print_uart0("Hello world!\n");
}
step2:
using mips-linux-gdb to connect the qemu like this:
mips-linux-gnu-gdb
target remote localhost:1234
Then, I trace the code step by step, and get the correct
result "c=3";
So, I think the problem is I am driving the serial port in
a wrong way. I know there're some linux kernels working
fine on qemu-system-mipsel, maybe I should read these
kernel codes to see how to get the 8250 serial port work.
2011/7/2 Andreas Färber <address@hidden>:
> Hi,
>
> Am 02.07.2011 um 08:13 schrieb Leo Chen.:
>
>> qemu-system-mipsel -M mipssim -nographic -kernel bin/test.elf
>> or
>> qemu-system-mipsel -M malta -nographic -kernel bin/test.elf
>
> The use of -kernel for a random ELF executable looks strange, even if it
> happens to work on arm. Have you tried -bios instead?
>
> Andreas
>
Leo Chen