Documentation/Platforms/OpenRISC: Difference between revisions

From QEMU
m (update build directions)
(add user to config target list, add some notes on debug)
Line 1: Line 1:
== Description ==
== Description ==
OpenRISC is an open source processor architecture. While instruction sets like x86 are proprietary and owned by a single company, OpenRISC is free. Its main use is as a processor on an embedded system.
OpenRISC is an open source processor architecture. While instruction sets like x86 are proprietary and owned by a single company, OpenRISC is free. Its main use is as a processor on embedded systems.


== Build Directions ==
== Build Directions ==
   ./configure --target-list=or1k-softmmu && make
   ./configure --target-list='or1k-softmmu or1k-linux-user' && make


== Full system emulation ==
== Full system emulation ==
To boot linux you can run the following.  If you are starting out you can download the OpenRISC test image from [[Testing/System_Images]].
To boot linux you can run the following.  If you are starting out you can download the OpenRISC test image from [[Testing/System_Images]].  The test image may be gzipped, so be sure to gunzip it first.


   qemu-system-or1k -cpu or1200 -M or1k-sim -kernel $LINUX/vmlinux -serial stdio -nographic -monitor none
   qemu-system-or1k -cpu or1200 -M or1k-sim -kernel $LINUX/vmlinux -serial stdio -nographic -monitor none


For networking support you can add the following options, note the <tt>open_eth</tt> option uses the kernel's <tt>ethoc</tt> ethernet driver.  
For networking support you can add the following options, note the <tt>open_eth</tt> option uses the kernel's <tt>ethoc</tt> Ethernet driver.  


   -device open_eth -netdev tap,id=or1k
   -device open_eth -netdev tap,id=or1k
Line 31: Line 31:
== Debugging Tips ==
== Debugging Tips ==


For debugging openrisc can listen on a gdb stub port with the following options
For debugging QEMU can listen on a gdb stub port with the below options.  Note, you can also use <tt>-S</tt> with the <tt>-gdb</tt> option to have QEMU wait for a gdb client connection before starting the boot process.


   -gdb tcp::10001
   -gdb tcp::10001

Revision as of 11:19, 21 June 2018

Description

OpenRISC is an open source processor architecture. While instruction sets like x86 are proprietary and owned by a single company, OpenRISC is free. Its main use is as a processor on embedded systems.

Build Directions

 ./configure --target-list='or1k-softmmu or1k-linux-user' && make

Full system emulation

To boot linux you can run the following. If you are starting out you can download the OpenRISC test image from Testing/System_Images. The test image may be gzipped, so be sure to gunzip it first.

 qemu-system-or1k -cpu or1200 -M or1k-sim -kernel $LINUX/vmlinux -serial stdio -nographic -monitor none

For networking support you can add the following options, note the open_eth option uses the kernel's ethoc Ethernet driver.

 -device open_eth -netdev tap,id=or1k

User mode emulation

Using QEMU user mode emulation we can run and debug OpenRISC binaries on your host linux.

 $ cat main.c
 #include <stdio.h>
 int main() {
    printf ("hello\n");
    return 0;
 }
 $ or1k-linux-musl-gcc main.c
 # Here $LDPATH/lib/ld-musl-or1k.so.1 is linked to or1k-linux-musl/lib/libc.so
 $ qemu-or1k -L $LDPATH ./a.out 
 hello

Debugging Tips

For debugging QEMU can listen on a gdb stub port with the below options. Note, you can also use -S with the -gdb option to have QEMU wait for a gdb client connection before starting the boot process.

 -gdb tcp::10001

To get good traces you can also add the following, this will output trace info to the file trace.txt

 -D trace.txt -d in_asm,exec,int,op_opt

Pictures

Linux booting up Linux command line execution

User mode

Links

Contacts

Maintainer: Stafford Horne