********************************************************************** Board-HOWTO.txt ********************************************************************** How to get your rex programs running on the robot. o High level overview of conversion of 'C' code to running on the robot First we present the high level view of the process and then get into the details. [Rex] --makem--> [C] --make--> [s19] --dl--> [Robot] 1 2 3 Step 1: This has already been discussed elsewhere, and it generates the 'C' code in a file (use the ":ic t" argument to 'makem'). Step 2: A makefile is used to invoke a C compiler with the proper settings so that it will output 's19' code. This code is a special format for the boards that you can essentially consider a binary or executable. Step 3: With you executable, you are now ready to run it on the robot. However, you must download the file from the SUNs to your 68HC11 robot controller boards. The downloading program 'dl' does this, but it requires you to have things hooked up and operating correctly. o Compiling the C code In the directory that the 'C' file is created in you need to create a Makefile. Actually you just need to copy a standard one and fill in the blanks (so to speak). Do this (where "mydir" is the same directory where the 'C' code goes to. cp /course/cs148/examples/Makefile mydir Now all you need to do is edit this file so that the name of the 'C' file that was created with makem matches the one in the Makefile. For instance suppose the "myfun.c" file was generated. Then the makefile would look like this: # Makefile for rex generated C code CFILE=myfun.c include /course/cs148/include/Makefile.cs148 The second line is the Makefile that does all the work, but there's no need for you to unravel the deep mysteries of makefiles. Now with the 'C' code generated and the Makefile properly set up, in the directory of concern just type: make all then cross your fingers, and the end result should be a file called: myfun.s19 This is the code you robot needs (S-record format). (Excerpts from /course/cs148/handouts/labNotes.fm.) o Connecting your robot board to the Sparcs Plug the large RS-232 type connector on one end of the serial cable into the port on the back of the Sparc (labelled "A/B"). Plug the phone-type connector into the 6.270 board (upside down). The green LED at the opposite end of the board labeled SER RCV should light. If it is not on, then unplug the whole thing and start again. If this is a persistant problem, make sure that your serial cable is not damaged or frayed. If the green SER RCV light is on, all is well. You are ready to communicate with the 6.270. To do this from the Sparcs, you will use a program called "dl" to download compiled pro grams. o Downloading We assume that you have a valid program and have compiled it into the S-record format (*.s19). Once your robot board is connected to a Sparc via the serial line, perform the following steps to download your program: If the board is off, turn it on with the big black switch. Be sure that the serial line is connected as above and the green LED is lit. You need to put the board in download mode so that it will accept a program on the serial line. To do this, hold the "choose" button down while you press and release the red reset button. The yellow SER XMIT LED next to the green LED should turn off. This may take a few tries at first but you will get the hang of it. Make sure that the yellow LED stays off, rather than just blinking. Once the board is in download mode, you are ready to initiate comunication from the Sparc side. To do this you use the "dl" program. If your program was compiled into a file called "myfun.s19", run "dl myfun.s19" from the directory that the s19 file is in. The green and yellow LEDs on the 6.270 will flicker for a bit, and you will be able to keep track of the download from a display in your shell. When the download is finished, simply press the red reset button or power cycle the 6.270 to start your program running. Note that turning the power off does not erase the program in memory, though removing (or running down) the batteries does. See examples directory for rsum.rex and seeklight.rex example.