| 1 | 30 | unneback | This is the Or1k specific README file for the RTEMS project.
 | 
      
         | 2 |  |  | Please send questions or comments to Chris Ziomkowski,
 | 
      
         | 3 |  |  | chris@asics.ws. I will try my best to answer your questions.
 | 
      
         | 4 |  |  |  
 | 
      
         | 5 |  |  | Currently, there is only 1 board support package for Or1k, which
 | 
      
         | 6 |  |  | is called bender. To make this package, it may be necessary to
 | 
      
         | 7 |  |  | edit the board configuration make file in rtems-4.5.0/make/custom.
 | 
      
         | 8 |  |  | The file is called bender.cfg. It was necessary to hard code some
 | 
      
         | 9 |  |  | libraries in this file, as I could not figure out how to make the
 | 
      
         | 10 |  |  | automatic scripts link against the correct libraries. There is a
 | 
      
         | 11 |  |  | hardcoded path to your gcclib directory which it may be necessary
 | 
      
         | 12 |  |  | to change.
 | 
      
         | 13 |  |  |  
 | 
      
         | 14 |  |  | Configure is excluded from CVS depository. In order to build or
 | 
      
         | 15 |  |  | rebuild it you will need:
 | 
      
         | 16 |  |  |   autoconf v2.12 or later
 | 
      
         | 17 |  |  |   automake v1.4 or later
 | 
      
         | 18 |  |  |  
 | 
      
         | 19 |  |  | To build configure run bootstrap script in top rtems directory by
 | 
      
         | 20 |  |  | typing
 | 
      
         | 21 |  |  |  
 | 
      
         | 22 |  |  | ./bootstrap
 | 
      
         | 23 |  |  |  
 | 
      
         | 24 |  |  | If you wish to rebuild existing configure scripts type
 | 
      
         | 25 |  |  |  
 | 
      
         | 26 |  |  | ./bootstrap -c
 | 
      
         | 27 |  |  | ./bootstrap
 | 
      
         | 28 |  |  |  
 | 
      
         | 29 |  |  | Then create an or1k directory under the main rtems directory,
 | 
      
         | 30 |  |  | cd into this directory, and type
 | 
      
         | 31 |  |  |  
 | 
      
         | 32 |  |  | ../configure  --target=or1k --program-prefix=
 | 
      
         | 33 |  |  |  
 | 
      
         | 34 |  |  | Where "" represents the prefix you have assigned
 | 
      
         | 35 |  |  | to your or1k tools. For example, mine reads:
 | 
      
         | 36 |  |  |  
 | 
      
         | 37 |  |  | ../configure  --target=or1k --program-prefix=or32-rtems-
 | 
      
         | 38 |  |  |  
 | 
      
         | 39 |  |  | This should setup the makefiles necessary to create the package.
 | 
      
         | 40 |  |  | You can now simply type "make", which should build the bender support
 | 
      
         | 41 |  |  | package and the example tests.
 | 
      
         | 42 |  |  |  
 | 
      
         | 43 |  |  | If you don't happen to have a board available for this CPU, you
 | 
      
         | 44 |  |  | can run this against the architectural or1k simulator. There are
 | 
      
         | 45 |  |  | several ways to do this. The one which I have found most helpful
 | 
      
         | 46 |  |  | for debugging is to use it in gdb mode.
 | 
      
         | 47 |  |  |  
 | 
      
         | 48 |  |  | First, you'll need a console. The or1k simulator is currently
 | 
      
         | 49 |  |  | configured to open a serial port on /tmp/uart0.rx and /tmp/uart0.tx.
 | 
      
         | 50 |  |  | To use this as a normal console, you'll need to make these into
 | 
      
         | 51 |  |  | FIFOs. Do this by running the command:
 | 
      
         | 52 |  |  |  
 | 
      
         | 53 |  |  | mkfifo /tmp/uart0.tx
 | 
      
         | 54 |  |  | mkfifo /tmp/uart0.rx
 | 
      
         | 55 |  |  |  
 | 
      
         | 56 |  |  | You can now create an input and an output stream which you can see
 | 
      
         | 57 |  |  | by opening 2 windows. In the first window, type:
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  | cat > /tmp/uart0.rx
 | 
      
         | 60 |  |  |  
 | 
      
         | 61 |  |  | In the other window, type:
 | 
      
         | 62 |  |  |  
 | 
      
         | 63 |  |  | cat < /tmp/uart0.tx
 | 
      
         | 64 |  |  |  
 | 
      
         | 65 |  |  | The "rx" window is where you will type, and the "tx" window will
 | 
      
         | 66 |  |  | print messages.
 | 
      
         | 67 |  |  |  
 | 
      
         | 68 |  |  | Next, start up the simulator by typing "sim -srv 7777". This assumes
 | 
      
         | 69 |  |  | or1ksim is in your path and that you want to start the gdb server on
 | 
      
         | 70 |  |  | port 7777.
 | 
      
         | 71 |  |  |  
 | 
      
         | 72 |  |  | You are now ready to load the code and run. To do this, type:
 | 
      
         | 73 |  |  |  
 | 
      
         | 74 |  |  | cd rtems-4.5.0/or1k
 | 
      
         | 75 |  |  | gdb bender/samples/hello.exe
 | 
      
         | 76 |  |  |  
 | 
      
         | 77 |  |  | Again, substitute your actual prefix for "". In my
 | 
      
         | 78 |  |  | case, this is "or32-rtems-". A log of this session is shown below. A
 | 
      
         | 79 |  |  | breakpoint has been placed on the exit function so that you can see
 | 
      
         | 80 |  |  | the exit code. Note that if you don't do this, there is no way to
 | 
      
         | 81 |  |  | automatically stop the process. It will simply appear to hang, and
 | 
      
         | 82 |  |  | gdb will never return.
 | 
      
         | 83 |  |  |  
 | 
      
         | 84 |  |  | flex% or32-rtems-gdb bender/samples/hello.exe
 | 
      
         | 85 |  |  | GNU gdb 5.0
 | 
      
         | 86 |  |  | Copyright 2000 Free Software Foundation, Inc.
 | 
      
         | 87 |  |  | GDB is free software, covered by the GNU General Public License, and you are
 | 
      
         | 88 |  |  | welcome to change it and/or distribute copies of it under certain conditions.
 | 
      
         | 89 |  |  | Type "show copying" to see the conditions.
 | 
      
         | 90 |  |  | There is absolutely no warranty for GDB.  Type "show warranty" for details.
 | 
      
         | 91 |  |  | This GDB was configured as "--host=i686-pc-linux-gnu --target=or32-rtems"...
 | 
      
         | 92 |  |  | (gdb) target jtag jtag://localhost:7777
 | 
      
         | 93 |  |  | Remote or1k debugging using jtag://localhost:7777
 | 
      
         | 94 |  |  | 0x0 in text_start ()
 | 
      
         | 95 |  |  | (gdb) load bender/samples/hello.exe
 | 
      
         | 96 |  |  | Loading section .text, size 0x30130 lma 0x0
 | 
      
         | 97 |  |  | Loading section .data, size 0x1cc4 lma 0x30130
 | 
      
         | 98 |  |  | Start address 0x2000 , load size 204276
 | 
      
         | 99 |  |  | Transfer rate: 1634208 bits/sec, 510 bytes/write.
 | 
      
         | 100 |  |  | (gdb) b exit
 | 
      
         | 101 |  |  | Breakpoint 1 at 0x24444: file exit.c, line 65.
 | 
      
         | 102 |  |  | (gdb) run
 | 
      
         | 103 |  |  | Starting program: /home/opencores/2008/rtems-4.5.0/or1k/bender/samples/hello.exe
 | 
      
         | 104 |  |  |  
 | 
      
         | 105 |  |  | Breakpoint 1, exit (code=0) at exit.c:65
 | 
      
         | 106 |  |  | 65      exit.c: No such file or directory.
 | 
      
         | 107 |  |  | (or1k) quit
 | 
      
         | 108 |  |  | flex%
 | 
      
         | 109 |  |  |  
 | 
      
         | 110 |  |  |  
 | 
      
         | 111 |  |  | On your "tx" window, you should see the following message:
 | 
      
         | 112 |  |  |  
 | 
      
         | 113 |  |  | ----
 | 
      
         | 114 |  |  |  
 | 
      
         | 115 |  |  |  
 | 
      
         | 116 |  |  | *** HELLO WORLD TEST ***
 | 
      
         | 117 |  |  | Hello World
 | 
      
         | 118 |  |  | *** END OF HELLO WORLD TEST ***
 | 
      
         | 119 |  |  |  
 | 
      
         | 120 |  |  | ----
 | 
      
         | 121 |  |  |  
 | 
      
         | 122 |  |  | Congratulations! You have just run a program under RTEMS on
 | 
      
         | 123 |  |  | the Or1k simulator! You can now write your own RTEMS code and
 | 
      
         | 124 |  |  | run it in the same way.
 | 
      
         | 125 |  |  |  
 | 
      
         | 126 |  |  | If you want, you can follow the same procedure to run the
 | 
      
         | 127 |  |  | regression test. This is found in the directory
 | 
      
         | 128 |  |  | or1k/bender/tests/base_sp.exe. Use the above instructions,
 | 
      
         | 129 |  |  | and replace bender/tests/base_sp.exe everywhere you see
 | 
      
         | 130 |  |  | bender/samples/hello.exe. It will test a large portion
 | 
      
         | 131 |  |  | of the RTEMS functionality. You should see the following
 | 
      
         | 132 |  |  | after executing this:
 | 
      
         | 133 |  |  |  
 | 
      
         | 134 |  |  | ----
 | 
      
         | 135 |  |  |  
 | 
      
         | 136 |  |  | *** SAMPLE SINGLE PROCESSOR APPLICATION ***
 | 
      
         | 137 |  |  | Creating and starting an application task
 | 
      
         | 138 |  |  | Application task was invoked with argument (0) and has id of 0x8010002
 | 
      
         | 139 |  |  | *** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***
 | 
      
         | 140 |  |  |  
 | 
      
         | 141 |  |  | ---
 | 
      
         | 142 |  |  |  
 | 
      
         | 143 |  |  | You should now have a good idea of how to run executables. It's
 | 
      
         | 144 |  |  | now up to you to start having fun with RTEMS. Good luck....
 | 
      
         | 145 |  |  |  
 | 
      
         | 146 |  |  | Chris Ziomkowski
 | 
      
         | 147 |  |  | chris@asics.ws
 |