LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Jeremy Bennett<jeremy.bennett@e...>
    Date: Tue Sep 23 10:55:48 CEST 2008
    Subject: [openrisc] Problem booting linux-2.6.19
    Top
    On Tue, 2008-09-23 at 08:27 +0000, Γιώργος Γράσσος wrote:

    > I am already using the second window with the command :
    > telnet 127.0.0.1 10084
    > and i have this bug, but after i've got the two ## as you said.
    >
    > The thing is i just wanna make a simulation of a program running at
    > openrisc and see the clkcycles and instructions . I suppose that can
    > be done at the testbench with the test program that exists there . Am
    > I right ?
    >
    > I use the command ./sim testbench/test or dhry but i've got errors as
    > the following :
    >
    >
    > Reading script file from 'sim.cfg'...
    > file /tmp/sim_atadev0 already exists. Using existing file.
    > Verbose on, simdebug off, interactive prompt off
    > Machine initialization...
    > Clock cycle: 100ns
    > Data cache present.
    > Insn cache tag present.
    > BPB simulation off.
    > BTIC simulation off.
    > Building automata... done, num uncovered: 0/213.
    > Parsing operands data... done.
    > loadcode: filename testbench/dhry startaddr=00000000
    > virtphy_transl=00000000
    > testbench/dhry: No such file or directory
    >
    >
    > or
    >
    > Reading script file from 'sim.cfg'...
    > file /tmp/sim_atadev0 already exists. Using existing file.
    > Verbose on, simdebug off, interactive prompt off
    > Machine initialization...
    > Clock cycle: 100ns
    > Data cache present.
    > Insn cache tag present.
    > BPB simulation off.
    > BTIC simulation off.
    > Building automata... done, num uncovered: 0/213.
    > Parsing operands data... done.
    > loadcode: filename testbench/test startaddr=00000000
    > virtphy_transl=00000000
    > Not COFF file format
    > Not ELF file format.
    > identifyfile2: Success
    > WARNING: dependstats stats must be enabled to do history analisis.
    > setting status register BSY 0x80
    > WARNING: Unable to open RX file stream.
    > Ethernet phy not enabled in this configuration. Configure with
    > --enable-ethphy.
    >
    >
    > and the ethernet is enabled here, in the sim.cfg
    > Is there any tutorial for help. Can you just guide me with some steps
    > to make the simulation?

    Hi George,

    I've copied your reply to the mailing list, so that everyone can benefit
    from this discussion.

    The Or1ksim testbench directory is very broken. There are some hints on
    running it in the appendix of the Embecosm Application Note 2:

    http://www.embecosm.com/download/ean2.html

    You need to run any of these tests using the makefile in the testsuite
    directory. One day this will all be fixed.

    If you want to write small C programs to exercise the simulator, I
    suggest you use a minimal bootloader. Put this in a file called start.s

    .file "start.s"

    .text
    .org 0x100 # The reset routine goes at 0x100

    .global _start
    _start:
    l.addi r1,r0,0x7f00 # Set SP to value 0x7f00
    l.addi r2,r1,0x0 # FP and SP are the same
    l.mfspr r3,r0,17 # Get SR value
    l.ori r3,r3,0x10 # Set exception enable bit
    l.jal _main # Jump to main routine
    l.mtspr r0,r3,17 # Enable exceptions (DELAY SLOT)

    .org 0xFFC
    l.nop # Guarantee the exception vector space
    # does not have general purpose code

    # C code starts at 0x1000

    You can then link this with any C program that defines a main() routine.
    But remember you will not have any libraries at all - so you'll need to
    do everything yourself. For example you could write Hello World (in say
    hello.c) as:

    main()
    { simputs( "Hello World!\n" ); } But you'll need to provide simputs(): void simputs( char *str ) { int i; for( i = 0; str[i] != '\0' ; i++ ) { simputc( (int)(str[i]) ); } } /* simputs() */ And then in turn simputc(), which can put out a character using the assembly l.nop 4 instruction (in Or1ksim, this writes the character in GPR 3, i.e. the first argument, to stdout). #define NOP_PUTC 0x0004 /* Simputc l.nop instruction */ void simputc( int c ) { __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_PUTC )); } /* simputc() */ Compile the bootloader using or32-uclinux-gcc to give start.o and the main routines to hello.o, then link them using: or32-uclinux-ld -Ttext start.o hello.o -o hello Note that start.o must be first, to ensure it ends up with the reset code at location 0x100. You can then run this interactively using or32-uclinux-sim -f sim.cfg -i hello The commands at the Or1ksim interactive prompt will let you see the instructions as they execute. Type "help" to see what the commands are. Hope this helps. Jeremy -- Tel: +44 (1202) 416955 Cell: +44 (7970) 676050 SkypeID: jeremybennett Email: jeremy.bennett@e... Web: www.embecosm.com

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.