Sam_I_Am -- Program Operation
Andrew Sterian
Padnos College of Engineering and Computing
Grand Valley State University
Top-Level | Connecting the Device | Program Operation | Commands |
Command-Line Options | Startup Files | Command-Line Commands |
Sam_I_Am --versionThis will verify that Sam_I_Am is properly installed and accessible. If this does not work, you need to find out where Sam_I_Am was installed. Type the following:
python -c "import sys; print sys.prefix+'/lib/python'+sys.version[:3]"You should see a directory name such as /usr/lib/python2.3. You can then invoke Sam_I_Am as follows:
python /usr/lib/python2.3/site-packages/Sam_I_Am/samiam.pyIf this still does not work, try the Installation instructions again.
In its normal mode of operation, Sam_I_Am looks in the current directory for a file named .samiamrc. If found, the commands in this file are executed as if they had been typed by you at the keyboard in interactive mode. Once all commands are executed, Sam_I_Am enters interactive mode in which you can begin typing your own commands.
If no .samiamrc file is found in your current directory, the same file name is loaded, if it exists, from your home directory (i.e., ${HOME}/.samiamrc). If this file does not exist here either, then no startup file is loaded.
Here is a sample .samiamrc file that opens a connection to SAM-BA, prints the SAM-BA version, then sets allowable memory accesses to correspond to the memory map of an AT91SAM7S256 device:
open /dev/ttyUSB0 version set readallow 0 0x300000 set ramwriteallow 0x202000 57344 set flashwriteallow 0x100000 0x40000
Sam_I_Am can be told to either ignore startup files or execute a startup file other than .samiamrc depending upon the command-line options presented in the previous section.
Sam_I_Am dump 0x202000The above command would rely upon the presence of a .samiamrc file that contained an open command so that the dump command would be successful.
Multiple commands can be executed by separating them with isolated commas. After all commands are performed, Sam_I_Am exits (unless the -i or --interactive command-line option is specified).
For example:
Sam_I_Am open /dev/ttyUSB0 , send program.hex , goThe above command opens the device port (assuming no .samiamrc file does so), uploads a HEX file, and runs the program uploaded. As soon as the GO command is issued, Sam_I_Am exits (though the uploaded program continues to run).
The following example uses the source command to effectively execute two startup files, .samiamrc and run.sam, and then remain in interactive mode to accept more commands:
Sam_I_Am -i source run.sam