gcc.md

00001 # gcc (Linux) {#gcc}
00002 
00003 The following instructions were performed on
00004 
00005     $ uname -a
00006     Linux localhost.localdomain 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
00007     $ g++ --version
00008     g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
00009 
00010 ## Copy Files
00011 
00012     $ mkdir test
00013     $ cd test
00014     $ tar -xzf /usr/share/doc/gclib/src/gclib_131_examples.tar.gz 
00015     $ ls
00016     x_arrays.cpp    x_gcommand.cpp    x_gmotioncomplete.cpp  x_programs.cpp
00017     x_examples.cpp  x_ginterrupt.cpp  x_gread_gwrite.cpp     x_simple.c
00018     x_examples.h    x_gmessage.cpp    x_grecord.cpp
00019    
00020 ## x_simple.c
00021 
00022 * In a text editor, open *x_simple.c*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options. 
00023 
00024 ### Compile
00025 
00026     $ gcc -Wall -Werror x_simple.c -lgclib -lgclibo -o simple
00027 
00028 ### Run
00029 
00030     $ ./simple 
00031     rc: 0
00032     version: 85.60.131
00033     rc: 0
00034     rc: 0
00035     info: 10.1.3.17, DMC4020 Rev 1.2b, 291
00036     rc: 0
00037     response:  179340166.0000
00038     :
00039 
00040 ## x_examples.cpp
00041 * In a text editor, open *x_examples.cpp*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options. Don't forget `-s ALL` if data records, interrupts, and messages are to be tested.
00042 * Find the `#if 0` preprocessor block enclosing the example calls. Change to `#if 1` to run the examples. Comment out the function calls to be avoided. Note some calls attempt to move motors and not all functions are compatible with all Galil products.
00043 
00044 ### Compile
00045 
00046     $ g++ x_*.cpp -lgclib -lgclibo -o example
00047 
00048 ### Run
00049     $./example 
00050     Library version: 85.60.131
00051     
00052     
00053     10.1.3.17, DMC4020 Rev 1.2b, 291
00054     
00055     ************************************************************************
00056     Example GRead() and GWrite() usage
00057     ************************************************************************
00058     
00059     Read 155 QR bytes.
00060     
00061     ************************************************************************
00062     Example GCommand() usage
00063     ************************************************************************
00064     Revision report, ^R^V
00065     DMC4020 Rev 1.2b
00066     :
00067     
00068     Command Values
00069     val is 10
00070     val is 11
00071     val is 3.1415
00072     val is 9.869
00073     
00074     Command Trimming
00075     > 179798738.0000
00076     :<
00077     > 179798738.0000<
00078     >179798738.0000<
00079     
00080     Receiving Binary Data
00081     QR read 155 bytes
00082     
00083     Error handling
00084     QD correctly trapped, not allowed, try GArrayDownload()
00085     DL correctly trapped, not allowed, try GProgramDownload()
00086     
00087     Modifying timeout
00088     Burning program...OK
00089     
00090     ************************************************************************
00091     Example GProgramDownload() and GProgramUpload() usage
00092     ************************************************************************
00093     GProgramDownload() correctly errored. Can't fit with level 3 compression
00094     Program Downloaded with compression level 4
00095     Uploading program:
00096     #A;i=0;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1
00097     i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;EN
00098     
00099     Program executed as expected
00100     ************************************************************************
00101     Example GArrayDownload(), GArrayUploadFile()
00102     GArrayDownloadFile(), and GArrayUpload usage
00103     ************************************************************************
00104     2.0000, 4.0000, 6.0000, 8.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00105     
00106     2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00107     
00108     3.0000, 5.0000, 10.0000
00109     2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00110     
00111     
00112     ************************************************************************
00113     Example GRecord() usage
00114     ************************************************************************
00115     
00116     QR-based data record
00117     36100
00118     6000
00119     
00120     DR-based data record
00121     36204
00122     36306
00123     36408
00124     36510
00125     36612
00126     36714
00127     36816
00128     36918
00129     37020
00130     37122
00131     37224
00132     
00133     QR-based data record with offsets
00134     37224
00135     37224
00136     
00137     ************************************************************************
00138     Example GMessage() usage
00139     ************************************************************************
00140      0.0000
00141      1.0000
00142      2.0000
00143      3.0000
00144      4.0000
00145      5.0000
00146      6.0000
00147      7.0000
00148      8.0000
00149      9.0000
00150     
00151     ************************************************************************
00152     Example GInterrupt() usage
00153     ************************************************************************
00154     "UI 8" executed.
00155     
00156     ************************************************************************
00157     Example GMotionComplete() usage
00158     ************************************************************************
00159     
00160     Position: 0, 0
00161     Beginning independent motion... Motion Complete on A
00162     Position: 8000, 0
00163     
00164     Position: 0, 0
00165     Beginning vector motion... Motion Complete on vector plane S
00166     Position: 6000, 0
00167     
00168     
00169     examples.cpp executed OK
00170     main() is finished. Press Enter to exit:
00171