Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Introduction to 68000 Programming Environment Using MetroWerks CodeWarrior and Palm Emulator.

Similar presentations


Presentation on theme: "1 Introduction to 68000 Programming Environment Using MetroWerks CodeWarrior and Palm Emulator."— Presentation transcript:

1 1 Introduction to 68000 Programming Environment Using MetroWerks CodeWarrior and Palm Emulator

2 2 Contents 1.Differences between standard 68000 assembly language and Palm-based assembly language 2.Overview of MetroWerks CodeWarrior and Palm Emulator 3.Download and Instrall 4.Using MetroWerks CodeWarrior to - edit a program - compile a program - make (link) and program - load a program 5.Palm Emulator

3 3 Differences between standard 68000 assembly language and Palm-based assembly language Standard Assembly programPalm Emulator Assembly program embedded in C Hexadecimal: $FF20 Hexadecimal: 0xFF20 Label MTCH Label must have a colon MTCH: Assembly directives ORG, EQU, DC, DS Assembly directives DC Number.B,.W,.L Number.W,.L Comments after * or 4th column Comments in C format after // or in /*... */

4 4 Overview executable binary of a specific machine 68000 machine code other 68000 code... C & 68000 assembly program 68000 Assembler editor Bring Up to Date Make linker Embedded in C compiler PDA or Emulator MetroWerks CodeWarrior Programming Environment Palm DeBugger executable code

5 5 Download and Install Palm Emulator and MetroWerks Download and install Palm Emulator and MetroWerks Demo version on your PC. 1)Go to the following URL for the steps needed to install CodeWarrior. The Palm Emulator comes with the demo version 8.0. http://www.palmos.com/dev/training/online/course_p_1-r.html http://www.palmos.com/dev/training/online/course_p_1-r.html 2)The links are provided for the CodeWarrior download. When selecting the link: http://www.metrowerks.com/contact/secure/palmdemo/ you are taken to the download area of the metrowerks website. If you scroll down to the bottom of the screen you will see fields for your name and email address. You will need to fill in this information and send it in order to receive an email with a password in order to install the demo. 3)Next you need to register with palm in order to access the ROM images. It takes one or two business days to process the request in order to download. The link to join is, http://www.palmos.com/dev/programs/pdp/join.html http://www.palmos.com/dev/programs/pdp/join.html

6 6 Download and install (contd.) 4)After installing the CodeWarrior demo, all the items that you will need are in the CodeWarrior folder in C:\Program Files\Metrowerks\CodeWarrior. The Palm Emulator is in...\CodeWarrior\Palm Tools\Palm OS 4.0 SDK\Other Tools. 5)Download the sample package SampleProject.zip 6)Unzip and start the project.

7 7 Using GWC167 Lab for CSE225 You could do the sample project in CSE225 lab, or follow the same steps to do it on your PC. In GWC167, you must save your work into a floppy disk, or into your M drive, or email it to your email account. Your work will be automatically removed after you log off your account. Please note, CodeWarrior Demo and Palm Emulator have been installed in the machines in GWC167.

8 8 Using CodeWarrior Go to \Homework 5\CSE 225 Lab 0 Open the project file "Lab 0.mcp" Close the "project message" window if it occurs Click the "File" in the "Lab 0.mcp" window. Open the "Palm Lab 0.c" file in "Assembly" folder in the Lab 0.mcp window.

9 9 Using CodeWarrior – contd. Goto the MetroWerks CodeWarrior menu: Project  Compile, and then Project  Bring Up To Date, and then Project  Make to build the project You are now ready to load the program on to Palm OS Emulator and execute it.

10 10 Put the Executable into the Device Folder After the "Make" (link) operation, a lab0p1.prc file (the final executable file) is created. If the "target" of your project is the set to the following directory "C:\Program Files\Metrowerks\CodeWarrior\Palm Tools\Palm OS Other SDK Tools\Palm Debugger\Device" the.prc file (executable) gets created in this directory, overwriting previous existing files. This target path should have been set. If not, you can set the the project target settings accessible from the project main window. The path can be an absolute one or relative to your project folder. If you still do not know how to set this target path then manually copy the.prc file from its current location to the above location. Most likely, the current location is the "CSE 225 Lab folder". You can also use "search" to find it). Then do the following: –Copy the lab0p1.prc file from your project folder –Go to folder "CSE 225" folder (on the desktop) –Go to Palm OS folder –Go to Palm Debugger folder –Go to Device folder –Paste the lab0p1.prc file into the Device folder.

11 11 Go to folder "CSE 225" on the desktop Go to Palm OS folder Open the Palm OS Emulator application (Emulator.exe) You will see the following screen Using Palm OS Emulator

12 12 Using Palm OS Emulator – cont. Click on the New button. This will start a new Emulator session for you. The following screen will appear.

13 13 Using Palm OS Emulator – cont. Click on the drop-down list labeled ‘ROM file’ Select the option ‘Other’ This will allow you to choose a particular ROM file. Go to the folder ‘Popular ROM Downloads’ Select the file ‘Palm OS 3.5-en-ezdbg’

14 14 Using Palm OS Emulator – cont. Click on Open button on the File Choose Dialog Box. Now, you will see the following screen

15 15 Using Palm OS Emulator – cont. Click on the drop-down list labeled ‘Device’ Select the option ‘Palm Vx’ Click on the drop-down list labeled ‘RAM Size’ Select the option ’16, 384 K’. Click on the OK button.

16 16 Using Palm OS PDA/Emulator – cont. The following screen will appear Application icon

17 17 Now, go to folder CSE 225 on the desktop Go to Palm OS folder Go to Palm Debugger folder Open the Palm Debugger (PalmDebugger.exe) This will allow you to download your application to the Palm OS Emulator Using Palm Debugger

18 18 After doing the steps outlined in the previous slide, you should be able to see the Palm Debugger Application. Now, go to Connection menu: Select the "Emulator" option (If you see a "  ", it is already selected). Select the "USB" option if you have connected a Palm PDA (hand-held computer) through a USB cable. Using Palm Debugger – contd.

19 19 Download the executable to the Palm Emulator Go to Console window Type the following command: import 0 Lab0p1.prc Note that Palm Emulator must be running before you execute the command. If no errors occur, the debugger will indicate that your application has been downloaded to the Palm OS Emulator. Skip the next slide.

20 20 Download the executable to the Palm Emulator (contd.) If an error occurs, close the Palm Emulator Re-start the Palm Emulator Redo the steps in the previous slide If an error still occurs, close the Palm OS Emulator and Palm Debugger. Redo the whole procedure

21 21 Download the executable to the Palm PDA Make sure that your Palm Hotsync manager is running (you should see the icon in the system trap. Start the “Palm Desktop” application. Click on the tool icon “install”. A dialog box will appear. Click “Add” and browse to the location of the executable “Lab0p1.prc”. It should be in your Device folder at: \Metrowerks\CodeWarrior\Palm Tools\Palm OS 4.0 SDK Other Tools\PalmDebugger\Device After you have added the executable, push the Hotsync icon on the Cradle of the PDA. The executable should be downloaded into the folder “unfiled”. Start the application. Note, you must use the Stylus to enter the command. You can find how to write different characters under “Graffiti” – “Try It”.

22 22 Set Breakpoints to Debug Your Programs Add an debugging directive _DbgBreak in your program to insert a breakpoint. Then use g command in the Debugger Window of Palm Debugger to allow the program to execute up to its next breakpoint. If there is no other breakpoint after this one, then the program will run to its completion. When the program stops at the breakpoint, you can see the CPU registers in the window named ‘CPU Registers’ [lower right portion]. When the program stops at the breakpoint, you can use the commands under menu "Source" to execute single steps.

23 23 Printing to the Emulator Screen You can use three library functions to print memory or register contents - JSR WriteString: It will write a string starting from [M([A0])] - JSR WriteChar: It will write a character stored in D0 - JSR WriteNum: It will write a number stored in D0

24 24 Back to Palm OS Emulator Go back to Palm OS Emulator. Click on ‘Applications’ icon on the Palm screen. You will see an icon that has your file name. Click on it to execute your application Lab 0 p1.


Download ppt "1 Introduction to 68000 Programming Environment Using MetroWerks CodeWarrior and Palm Emulator."

Similar presentations


Ads by Google