Examples

The examples directory contains example test programs in several subdirectories.

	xflash		-- code to perform self-update of flashes
	bench		-- standard benchmark programs
	graphx		-- examples for the LR33020 and LR33120
	intapp		-- code examples from the interrupt application note
	intio		-- example of interrupt driven I/O
	lr333xx		-- examples for the LR33310 and LR33300
	misc		-- miscellaneous demos
	o3opt		-- examples of the using the MIPS -O3 optimization
	pmon		-- examples of using PMON features
	pollio		-- example of polled I/O
	sonic		-- example code for the SONIC Ethernet controller

xflash

This directory contains code that can be used to perform in-circuit updates of flash memories.

Use the following procedure to update the flash memories on your board.

First build the appropriate .rec file.

Then program the file into the flashes.

For flashes that currently contain PMON:

  1. Reset the board.
  2. Type "load" at the PMON prompt.
  3. Download the .rec file.
  4. Type "g" at the PMON prompt.
    -- The board will reboot automatically when completed.
For flashes that currently contain IMON:
  1. Reset the board.
  2. Type "load -d" at the IMON prompt.
  3. Download the .rec file.
    -- The board will reboot automatically when completed.
For flashes that currently contain a SerialICE kernel:
  1. Make sure that IMON is able to communicate with the target.
  2. Type "load" at the IMON prompt.
  3. Download the .rec file.
  4. Type "g" at the IMON prompt.
    -- You will see "41 41 43 44" in the IMON window when completed.
  5. Reset the Controller and the Target.
When converting a board running PMON or IMON, to a board running the SerialICE kernel. Wait 60 seconds after typing "g", and then reconfigure the board as a target.

When converting a board running the SerialICE kernel, to a board running PMON or IMON. Wait 100 seconds after typing "g", and then reconfigure the board appropriately.

bench

	acker.c    -- implements Ackerman's function
	dhry.c     -- Dhrystone 1.0
	dry1.c     -- Dhrystone 1.1
	fibo.c     -- implements the Fibonacci series
	hanoi.c    -- solves the Towers of Hanoi problem
	puzzle.c   -- implements the standard puzzle benchmark
	qsort.c    -- performs a quicksort
	queens.c   -- solves the 8 queens problem
	sieve.c    -- uses the sieve function to find prime numbers
	sort.c     -- performs a bubble sort
	whetd.c    -- double precision Whetstone
	whets.c    -- single precision Whetstone
	stanford.c -- the Stanford suite

graphx

This directory contains example programs that run on the LR33020 and LR33120 GraphX processor.

intapp

This directory contains the code used as examples in the LSI Logic application note, "Interrupt Handlers and Interrupt Latency Calculations for the LR33000 Self-Embedding Processor".

ex1asm.s ex1main.c -- Increment global variable
ex2asm.s ex2main.c -- Increment two global variables
ex3asm.s ex3main.c -- Nested interrupts
ex4asm.s ex4main.c -- Interrupt handler in C
ex5asm.s ex5main.c -- Implement the time() function
ex6asm.s ex6main.c -- Vectored interrupts

intio

lr333xx

This directory contains demonstration programs for the LR33300 and LR33310.

	ctst		- an interactive cache test program
Each of these can be compiled using:

	make 

misc

This directory contains miscellaneous demonstration programs.

	bubble.c	- a bubble sort
	game.c		- a simple adventure game
	hello.c		- Hello World!
	wiggle.c	- text graphics program for floating-point
Each of these can be compiled using:

	make 
Note that the program wiggle will compile correctly only if your toolset is a supplied with a math library that contains the transcendental functions.

pmon

This directory contains examples that demonstrate the use of various PMON functions.

	timetst.c    --  uses the time function.
	filetst.c    --  uses PMON's input file feature
	onintr.c     --  uses the onintr function.
	clock.c      --  uses the time function.
	sinewave.c   --  shows the use of RAM resident FP emulation.
	iotest.c     --  checks PMON's buffered I/O system.

pollio

This is an example program that uses a very simple polled I/O scheme. It can be built either for downloading and executing under PMON (RAMBASED), or built for blowing into a PROM (ROMBASED), make the selection by invoking make as "make ram" or "make rom".

sonic

This directory contains example programs that show how to use the National Sonic Ethernet controller.

	% make intex	-- Builds an interrupt driven example

	% make pollex	-- Builds a polled example
The following is an example of the output generated when the VERBOSE option is enabled. The file was transferred using tftp.

Unix Host = 71.0.0.207 = 47.00.00.cf at 08:00:20:0a:13:de
Target =    71.9.0.204 = 47.09.00.cc at 00:00:6b:80:00:b8

              type  vers
	  len   ident frag  proto sum   src_ip_addr dst_ip
	  _addr sport dport ulen  sum   type  [seq]

type=2 "name file" no seq #
status=3001 count=69
a0023410  00 00 6b 80 00 b8 08 00 20 0a 13 de 08 00 45 00   ..k..... .....E.
a0023420  00 33 a7 9d 00 00 3c 11 47 79 47 00 00 cf 47 09   .3....<.GyG...G.
a0023430  00 cc 07 99 00 45 00 1f 00 00 00 02 2f 74 6d 70   .....E....../tmp
a0023440  2f 66 6f 6f 62 61 72 00 6e 65 74 61 73 63 69 69   /foobar.netascii
dhost=00:00:6b:80:00:b8   shost=08:00:20:0a:13:de
ip: ver=04 len=0033 id=a79d ttl=3c proto=11 src=470000cf dst=470900cc
sport=0799 dport=0045 ulen=001f sum=0000

type=4 "ack" seq = 0
status=3001 count=64
a0023458  08 00 20 0a 13 de 00 00 6b 80 00 b8 08 00 45 00   .. .....k.....E.
a0023468  00 20 ef ad 00 00 1e 11 1d 7c 47 09 00 cc 47 00   . .......|G...G.
a0023478  00 cf 04 2d 07 99 00 0c 64 68 00 04 00 00 00 00   ...-....dh......
a0023488  00 00 00 00 00 00 00 00 00 00 00 00 99 06 c0 4c   ...............L
dhost=08:00:20:0a:13:de   shost=00:00:6b:80:00:b8
ip: ver=04 len=0020 id=efad ttl=1e proto=11 src=470900cc dst=470000cf
sport=042d dport=0799 ulen=000c sum=6468

type=3 "data" seq=1 562-46=516 (actually 503 bytes)
status=3001 count=562
a0023498  00 00 6b 80 00 b8 08 00 20 0a 13 de 08 00 45 00   ..k..... .....E.
a00234a8  02 20 a7 aa 00 00 3c 11 45 7f 47 00 00 cf 47 09   . ....<.E.G...G.
a00234b8  00 cc 07 99 04 2d 02 0c 00 00 00 03 00 01 72 6f   .....-........ro
a00234c8  6f 74 3a 75 77 74 77 47 54 52 45 6a 45 73 52 73   ot:ABCDEFGEjEsRs
dhost=00:00:6b:80:00:b8   shost=08:00:20:0a:13:de
ip: ver=04 len=0220 id=a7aa ttl=3c proto=11 src=470000cf dst=470900cc
sport=0799 dport=042d ulen=020c sum=0000

type=4 "ack" seq=1
status=3001 count=64
a00236cc  08 00 20 0a 13 de 00 00 6b 80 00 b8 08 00 45 00   .. .....k.....E.
a00236dc  00 20 ef ae 00 00 1e 11 1d 7b 47 09 00 cc 47 00   . .......{G...G.
a00236ec  00 cf 04 2d 07 99 00 0c 64 67 00 04 00 01 00 02   ...-....dg......
a00236fc  00 00 00 06 00 00 00 00 00 00 00 00 67 5d e2 45   ............g].E
dhost=08:00:20:0a:13:de   shost=00:00:6b:80:00:b8
ip: ver=04 len=0020 id=efae ttl=1e proto=11 src=470900cc dst=470000cf
sport=042d dport=0799 ulen=000c sum=6467

type=3 "data" 562-46=516 (actually 502 bytes)
status=3001 count=562
a002370c  00 00 6b 80 00 b8 08 00 20 0a 13 de 08 00 45 00   ..k..... .....E.
a002371c  02 20 a7 ab 00 00 3c 11 45 7e 47 00 00 cf 47 09   . ....<.E~G...G.
a002372c  00 cc 07 99 04 2d 02 0c 00 00 00 03 00 02 75 63   .....-........uc
a002373c  70 2f 75 75 63 69 63 6f 0d 0a 6e 65 77 73 3a 2a   p/uucico..news:*
dhost=00:00:6b:80:00:b8   shost=08:00:20:0a:13:de
ip: ver=04 len=0220 id=a7ab ttl=3c proto=11 src=470000cf dst=470900cc
sport=0799 dport=042d ulen=020c sum=0000

type=4 "ack"
status=3001 count=64
a0023940  08 00 20 0a 13 de 00 00 6b 80 00 b8 08 00 45 00   .. .....k.....E.
a0023950  00 20 ef af 00 00 1e 11 1d 7a 47 09 00 cc 47 00   . .......zG...G.
a0023960  00 cf 04 2d 07 99 00 0c 64 66 00 04 00 02 00 09   ...-....df......
a0023970  32 80 00 07 2f 00 01 17 13 00 00 db 2b 1d d2 b1   2.../.......+...
dhost=08:00:20:0a:13:de   shost=00:00:6b:80:00:b8
ip: ver=04 len=0020 id=efaf ttl=1e proto=11 src=470900cc dst=470000cf
sport=042d dport=0799 ulen=000c sum=6466

type=3 "data" 562-46=516 (actually 505 bytes)
status=3001 count=562
a0023980  00 00 6b 80 00 b8 08 00 20 0a 13 de 08 00 45 00   ..k..... .....E.
a0023990  02 20 a7 ac 00 00 3c 11 45 7d 47 00 00 cf 47 09   . ....<.E}G...G.
a00239a0  00 cc 07 99 04 2d 02 0c 00 00 00 03 00 03 74 3a   .....-........t:
a00239b0  64 71 77 4d 55 6c 64 66 5a 42 50 69 6b 3a 32 30   dqwABCDEFGPik:20
dhost=00:00:6b:80:00:b8   shost=08:00:20:0a:13:de
ip: ver=04 len=0220 id=a7ac ttl=3c proto=11 src=470000cf dst=470900cc
sport=0799 dport=042d ulen=020c sum=0000

type=4 "ack"
status=3001 count=64
a0023bb4  08 00 20 0a 13 de 00 00 6b 80 00 b8 08 00 45 00   .. .....k.....E.
a0023bc4  00 20 ef b0 00 00 1e 11 1d 79 47 09 00 cc 47 00   . .......yG...G.
a0023bd4  00 cf 04 2d 07 99 00 0c 64 65 00 04 00 03 ff e5   ...-....de......
a0023be4  ea 06 c0 00 81 c7 e0 08 81 e8 00 00 22 6d 2d 58   ............"m-X
dhost=08:00:20:0a:13:de   shost=00:00:6b:80:00:b8
ip: ver=04 len=0020 id=efb0 ttl=1e proto=11 src=470900cc dst=470000cf
sport=042d dport=0799 ulen=000c sum=6465

type=3 "data" 214-46=168 (actually 160 bytes).
status=3001 count=214
a0023bf4  00 00 6b 80 00 b8 08 00 20 0a 13 de 08 00 45 00   ..k..... .....E.
a0023c04  00 c4 a7 ad 00 00 3c 11 46 d8 47 00 00 cf 47 09   ......<.F.G...G.
a0023c14  00 cc 07 99 04 2d 00 b0 00 00 00 03 00 04 6d 65   .....-........me
a0023c24  6c 2f 6d 69 70 73 62 6f 6f 6b 2f 73 68 65 6c 6c   l/mipsbook/shell
dhost=00:00:6b:80:00:b8   shost=08:00:20:0a:13:de
ip: ver=04 len=00c4 id=a7ad ttl=3c proto=11 src=470000cf dst=470900cc
sport=0799 dport=042d ulen=00b0 sum=0000

type=4 "ack"
status=3001 count=64
a0023ccc  08 00 20 0a 13 de 00 00 6b 80 00 b8 08 00 45 00   .. .....k.....E.
a0023cdc  00 20 ef b1 00 00 1e 11 1d 78 47 09 00 cc 47 00   . .......xG...G.
a0023cec  00 cf 04 2d 07 99 00 0c 64 64 00 04 00 04 01 16   ...-....dd......
a0023cfc  b0 16 21 fc c0 26 20 00 a8 10 20 02 e3 c4 d3 9a   ..!..& ... .....
dhost=08:00:20:0a:13:de   shost=00:00:6b:80:00:b8
ip: ver=04 len=0020 id=efb1 ttl=1e proto=11 src=470900cc dst=470000cf
sport=042d dport=0799 ulen=000c sum=6464
..... break!

o3opt

This directory contains an example of using level -O3 optimization. This feature is only available with the MIPS toolset.


Navigation: Document Home | Document Contents | Document Index