已有 454868个资源




标    签: MGCMC68332

分    享:


关于MGC 开发环境使用说明,国内已找不到,国外网站好不容易找到的


1 XRAY Quick Start Tutorial Bradley University Department of Electrical and Computer Engineering Jose Lopez The purpose of this tutorial is to allow the user to easily begin using Mentor Graphics XRAY On Chip Debugger (OCD). This is not meant to replace reading the documentation provided by Mentor Graphics. In this tutorial two programs are compiled and downloaded to the 68376. Both programs initialize the periodic interrupt timer and flip a pin every 5.8ms. One program is written in assembly language, the other in C++. Please pay attention to the many tabs and buttons XRAY OCD. First the assembly language program will be compiled and downloaded. Figure 1 The compiler can be started by clicking on the START menu, then EE Applications, MGC Embedded and 68k XRAY OCD. 2 Figure 2 The first step is to change the directory to a working directory. This is done by clicking on the FILE menu and selecting Change Directory as shown in figure 2. 3 Figure 3 For this example the working directory is changed to C:\temp. 4 Figure 4 Click File, Open, then select the file name. The name of the program to be compiled and run is named PITADdemo.asm. Make sure the correct file extension (.asm) is selected under Files of Type. 5 Figure 5 As seen in figure 5, the Code window displays the program. 6 Figure 6 To build the program click on Tools and select Build. After clicking Build, the Build window will be displayed, as shown on figure 6. One can either write a Makefile for the project or use Custom Build. To build this program the following Custom Build command line was used: “asm68k –p cpu32 PITADdemo.asm”. The general command line format is compiler options filename.ext. In this case “asm68k” refers to the assembly language compiler, the “–p cpu32” tells the compiler the chip used belongs to the CPU32 family and the “PITADdemo.asm” is the name of the program that will be compiled. The compiler is case sensitive so make sure the file name is typed exactly as it appears. Since the working directory was set in the beginning, one doesn’t have to worry about the Specified line. However, if for some reason or another, the program to be compiled is not in the working directory, simply type the location of the file in the Specified line. Finally, click Build in the Build window to compile the program. 7 Figure 7 After building the program successfully, three asterisks appear in the Output Logging Window. If the program is not compiled successfully, the error messages can be seen in this window. 8 Figure 8 The next step is to connect to the target. Make sure everything is plugged in and ready to go. In the Managers window, select CPU32 under the available connections box and click Connect. 9 Figure 9 In the Managers window, click on Load and select Load File to Target. 10 Figure 10 Again, make sure the correct extension is selected. Assembly language programs produce object files (.obj). 11 Figure 11 Select PITADdemo.obj and check the Replace Program box and click Open. The user may need to raise the Load File to Target window to see the Replace Program check box. 12 Figure 12 After opening PITADdemo.obj, the Managers window will show the loaded file. By selecting the Asm tab at the bottom of the Code window, one can see the loaded program. In this case the Code window does not display the desired program. In the Managers window, under the Debug tab, select Control and click Reset Board. 13 Figure 13 The Code window now displays the desired program. If after this you do not see the desired program under the Files tab, click Load and select Load or Reload All Files to Target. After reloading the program, reset the board again. 14 Figure 14 In the Code window, directly under the File menu, there are eleven buttons. The first one is the Go button. Click the Go button and Run will be shown in the Code window. For this program, PORTA is complemented every 5.8ms. PORTA is an open drain output, therefore a pull up resistor should be used. 15 Figure 15 This can be observed from any of PORTA’s pins. Note the high and low time duration is 5.8ms. 16 Figure 16 To stop the program, click the Stop Execution button. The Stop Execution button is the seventh button of the eleven buttons directly below the File menu. 17 Figure 17 After stopping the execution of the program, the program is unloaded from the chip. In the Managers window, click the Load button and click Unload All Files from Target. 18 Figure 18 Now a similar program in C++ will be compiled. Click File, select Change Directory and change the working directory to C:/temp/dc. Select Open in the File menu and open PITINIT.cpp. 19 Figure 19 The program is displayed in the Code window. 20 Figure 20 In the Tools menu, select Build to open the Build window. In the Custom Build line type: “ccc68k -p cpu32 -H -Os PITINIT.cpp”. As one can see, it is in compiler options filename.ext form. This time the “ccc68k” compiler is used, since the program was written in C++. Note, the C compiler is called “mcc68k”. The “-p cpu32” specifies the processor type. The “-H” saves the assembly program the compiler produced using the same name except the extension is .src. The “-Os” optomizes in favor of size instead of speed. There are many other build options available. Finally, click Build in the Build window to compile the program. 21 Figure 21 In the Managers window, click on Load button and select Load File to Target. 22 Figure 22 The executable files C/C++ programs produce are called absolute files. 23 Figure 23 Select the file PITINIT.abs, check the Replace Program box and click Open. 24 Figure 24 Select the Asm tab in the Code window. If the Code window displays the correct loaded program as shown on figure 24, click the Go button. The following output was observed from TP3. The TPU channels are labeled TP3 on the evaluation board. TPU outputs are not open drain, therefore pull up resistors are not necessary. Note there is no visible RC effect present at the output, unlike PORTA. 25 Figure 25 Now to stop the program, simply click the Stop Execution button. Sample programs and a copy of this tutorial can be found in C:/temp/MGC – tutorial/.

EEWORLD下载中心所有资源均来自网友分享,如有侵权,请发送举报邮件到客服邮箱 或通过站内短信息或QQ:273568022联系管理员 高进,我们会尽快处理。