250 likes | 586 Views
Introduction to 68000 Programming Environment Using MetroWerks CodeWarrior and Palm Emulator. Contents. Differences between standard 68000 assembly language and Palm-based assembly language Overview of MetroWerks CodeWarrior and Palm Emulator Download and Instrall
E N D
Introduction to68000 Programming EnvironmentUsing MetroWerks CodeWarrior and Palm Emulator
Contents • Differences between standard 68000 assembly language and Palm-based assembly language • Overview of MetroWerks CodeWarrior and Palm Emulator • Download and Instrall • Using MetroWerks CodeWarrior to • - edit a program • - compile a program • - make (link) and program • - load a program • 5. Palm Emulator
Differences between standard 68000 assembly language and Palm-based assembly language
Overview 68000 Assembler editor C & 68000 assembly program Embedded in C compiler other 68000 code 68000 machine code executable binary of a specific machine . . . Bring Up to Date Make linker MetroWerks CodeWarrior Programming Environment executable code Palm DeBugger PDA or Emulator
Download and Install Palm Emulator and MetroWerks • Download and install Palm Emulator and MetroWerks Demo version on your PC. • 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 • 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. • 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
Download and install (contd.) • 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. • Download the sample package SampleProject.zip • Unzip and start the project.
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.
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.
Using CodeWarrior – contd. • Goto the MetroWerks CodeWarrior menu: ProjectCompile, and then ProjectBring Up To Date, and then ProjectMake to build the project • You are now ready to load the program on to Palm OS Emulator and execute it.
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.
Using Palm OS Emulator • 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 – cont. • Click on the New button. This will start a new Emulator session for you. • The following screen will appear.
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’
Using Palm OS Emulator – cont. • Click on Open button on the File Choose Dialog Box. • Now, you will see the following screen
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.
Using Palm OS PDA/Emulator – cont. • The following screen will appear Application icon
Using Palm Debugger • 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 – contd. • 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.
Download the executable to the Palm Emulator • Go to Console window • Type the following command: import 0 Lab0p1.prcNote thatPalm 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.
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
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 iconon 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”.
Set Breakpoints to Debug Your Programs • Add an debugging directive _DbgBreakin 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.
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
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.