background image

phyCORE-P87C591 QuickStart Instructions

                                                                                                                                                

                                                                                                                                                

34

©  PHYTEC Meßtechnik GmbH 2002     L-586e_2

3.2

 

Creating a New Project and Adding an Existing Source
File

RIDE automatically loads the most recently opened project. If you
find an existing project when starting RIDE, close it by selecting the
Project menu and Close the project.

 

To create a new project file open the Project menu and choose
New within the RIDE menu bar. The window as shown below
appears.

Summary of Contents for phyCORE-P87C591

Page 1: ...and the Raisonance Integrated Development Environment RIDE for 8051 and XA Demo Version Note The PHYTEC Spectrum CD includes the electronic version of the English phyCORE P8xC591 Hardware Manual Hinwe...

Page 2: ...tionally PHYTEC Me technik GmbH offers no guarantee nor accepts any liability for damages arising from the improper usage or improper installation of the hardware or software PHYTEC Me technik GmbH fu...

Page 3: ...g PHYTEC FlashTools98 for Windows 20 2 4 Downloading Example Code with FlashTools 21 2 4 1 Blinky 25 2 4 2 Hello 27 3 Getting More Involved 33 3 1 Starting the Raisonance Tool Chain 33 3 2 Creating a...

Page 4: ...onance Debug Features 65 4 6 1 Watch Window 65 4 6 2 Run to 66 4 6 3 Step Into and Step Over 68 4 6 4 Breakpoints 69 4 7 Running Stopping and Resetting 72 4 8 Changing Target Settings for the Final Ve...

Page 5: ...configuration memory mapping and pin layout Selecting the links on the electronic version of this document links to the applicable section of the phCORE P8xC591 Hardware Manual 1 1 Rapid Development...

Page 6: ...ams Hello and Blinky to demonstrate the download of user code to the Flash device using PHYTEC FlashTools98 for Windows 2 The Getting More Involved section provides step by step instructions on how to...

Page 7: ...and AC adapter supplying 5 VDC min 500 mA the PHYTEC Spectrum CD an IBM compatible host PC 486 or higher running at least Windows95 98 For more information and example updates please refer to the fol...

Page 8: ...andard width 2 54 mm 0 10 in pin headers lining the circuit board edges This enables the phyCORE P87C591 to be plugged like a big chip into target hardware The standard memory configuration of the phy...

Page 9: ...Hz clock speed no internal clock prescaler 128 kByte external SRAM 128 to 512 kByte external Flash supporting on board downloading of user code from a host PC in conjunction with PHYTEC FlashTools98 f...

Page 10: ...ORE Development Board LD 5V phyCORE Development Board LD 5V Technical Highlights Reset signal controlled by push button or RS 232 control line CTS0 Boot signal controlled by push button or RS 232 cont...

Page 11: ...s migrating from 8 bit to 16 bit architectures easier The Raisonance tool chain produces OMF object files that are supported by most in circuit emulators The OMF to HEX utility converts a Raisonance a...

Page 12: ...rface for all Raisonance tools All compiler assembler linker locator and debugger options are configured with simple mouse clicks RIDE runs under Windows 95 98 2000 and NT All RIDE commands and functi...

Page 13: ...tor debugger and a ROM Monitor that supports debugging either via software on a host PC or in target hardware All the debugging functions are enabled in the demo version with the same restrictions in...

Page 14: ...phyCORE P87C591 QuickStart Instructions 10 PHYTEC Me technik GmbH 2002 L 586e_2...

Page 15: ...host PC downloading example user code in Intel hexfile format from a host PC to the external Flash memory using FlashTools98 2 1 Installing Rapid Development Kit Software Insert the PHYTEC Spectrum C...

Page 16: ...nstallation of Rapid Development Kit software and documentation The default destination location is C PHYBasic All path and file statements within this QuickStart Instruction are based on the assumpti...

Page 17: ...list of available products By using the Change button advanced users can select in detail which options should be installed for a specific product All Kit specific content will be installed to a Kit s...

Page 18: ...pectrum CD ROM each time you want to access these documents The installed links will refer to your CD ROM drive in this case If you decide to copy the electronic documentation to your hard drive the d...

Page 19: ...blems We recommend that you install the Raisonance tool chain from the Spectrum CD ROM even if other versions of RIDE is already installed on your system These QuickStart Instructions and the demo sof...

Page 20: ...ftware such as Adobe Acrobat Reader will also be offered for installation In the following windows you can decide to install FlashTools98 software and the Acrobat Reader The applicable FlashTools soft...

Page 21: ...ng Started PHYTEC Me technik GmbH 2002 L 586e_2 17 Decide if you want to begin the QuickStart Instruction immediately by selecting the appropriate checkbox and click on Finish to complete the installa...

Page 22: ...opment Board s receptacle footprint X6 Ensure that pin 1 of module denoted by the hash stencil mark on the PCB matches pin 1 of the receptacle on the phyCORE Development Board LD 5V Ensure that there...

Page 23: ...evelopment Board LD 5V Connect the RS 232 interface of your computer to the DB 9 RS 232 interface on the phyCORE Development Board LD 5V P1A bottom using the included serial cable Using the included p...

Page 24: ...FlashTools98 for Windows FlashTools98 should have been installed during the initial setup procedure as described in section 2 1 If not you can manually install it using the setup exe file located in t...

Page 25: ...ograms Phytec program group The Communication Setup tab of the FlashTools98 tabsheet window will now appear Here you can specify connection properties to the phyCORE P87C591 Choose the correct serial...

Page 26: ...ry other baud rates to establish a connection Before attempting each connection be sure to reset the target hardware and render it into Flash programming mode FPM as described in section 2 2 Returning...

Page 27: ...ss ranges in Flash memory Communication Setup allows selection of the serial port and speed before the communication is initialized or to disconnect the ongoing communication 3 The appearance of the F...

Page 28: ...E P87C591 QuickStart Instructions 24 PHYTEC Me technik GmbH 2002 L 586e_2 File Download downloads specified hexfiles to the target hardware Protected Areas Information shows protected areas of Flash m...

Page 29: ...ure 2 Returning to the FlashTools98 tabsheet choose the Bank Utilities tab highlight Bank 1 within the Bank Erase section and click on the Erase Bank s button to erase this memory bank Wait until the...

Page 30: ...ank into which you wish to download code is not empty i e erased a warning dialog box will appear indicating Location not empty Please erase location and try again In this event select the Bank Utilit...

Page 31: ...onnected to the host PC and a power supply Reset the target hardware and force it into Flash programming mode by simultaneously pressing the Reset S2 and Boot S1 buttons on the phyCORE Development Boa...

Page 32: ...bank into which you wish to download code is not empty i e erased a warning dialog box will appear indicating Location not empty Please erase location and try again In this event select the Bank Utili...

Page 33: ...ssories bar The HyperTerminal main window will now appear5 Double click on the HyperTerminal icon Hypertrm to create a new HyperTerminal session The Connection Description window will now appear Enter...

Page 34: ...ct to COM1 COM2 under the Connect Using pull down menu be sure to indicate the correct COM setting for your system Click the Configure button in the COM Direct Properties window to advance to the next...

Page 35: ...ter string Hello World from the target hardware to the HyperTerminal window Pressing any other key than the Space bar leads to an improper baud rate since the automatic baud rate detection is based on...

Page 36: ...phyCORE P87C591 QuickStart Instructions 32 PHYTEC Me technik GmbH 2002 L 586e_2...

Page 37: ...ould have been installed during the install procedure as described in section 2 1 You can also manually install the tool chain by executing install exe from within the Software Raisonance folder of yo...

Page 38: ...an Existing Source File RIDE automatically loads the most recently opened project If you find an existing project when starting RIDE close it by selecting the Project menu and Close the project To cre...

Page 39: ...e currently selected Click on the Browse button and change to the project directory created by the installation procedure default location C PHYBasic pC P87C591 Demos Raisonance Blinky2 In the text fi...

Page 40: ...ckStart Instructions 36 PHYTEC Me technik GmbH 2002 L 586e_2 The following window will appear From here you will be able to add various files to your project Open the Project menu and choose Add node...

Page 41: ...file Blinky2 c in the Add File window and click on Open At this point you have created a project called blinky2 prj and added an existing C source file called blinky2 c The next step is to modify the...

Page 42: ...wn in bold and italic font from the original counts to the indicated values while 1 loop forever LED LED 0xFE output over PD port to LED D3 Bit 1 of port PD LED D3 off for i 0 i 30000 i delay for 3000...

Page 43: ...nd leave all other options set to their default values RIDE allows you to set various options with mouse clicks and these are all saved in your project file Note In most cases options can be set at th...

Page 44: ...o configure the RC51 Compiler Open the Options Project RC51 menu and choose Memory Model Select the Large memory model and activate the checkbox Component with XRAM under Special features and keep the...

Page 45: ...LX51 Linker Check that the Generate an Intel Hex file checkbox is active This option should be enabled by default All others options are correct to run our first example Click on OK to save the config...

Page 46: ...e screen If there are no errors the code is compiled and linked and the executable code is ready to be downloaded to the module The created hexfile will have the name of the project with hex as the fi...

Page 47: ...the Erase Bank s button to erase this memory bank Wait until the status check in the lower left corner of the FlashTools98 tabsheet finishes returning the connection properties description to the low...

Page 48: ...starting at section 3 2 3 8 1 Creating a New Project Start the Raisonance RIDE environment and close all projects that might be open Open the Project menu and create a new project called Hello2 prj w...

Page 49: ...Hello2 c 3 8 3 Setting Tool Chain Options The same tool chain options can be used as for the Blinky2 project described in section 3 5 3 8 4 Building the New Project Build the project If any source fil...

Page 50: ...nection to the target hardware Returning to the FlashTools98 tabsheet choose the Bank Utilities tab highlight Bank 1 within the Bank Erase section and click on the Erase Bank s button to erase this me...

Page 51: ...Development Board LD 5V at S2 will execute the Hello2 hex file loaded into the Flash Now push the Space bar on your keyboard once to start the automatic baud rate detection on phyCORE P87C591 module S...

Page 52: ...phyCORE P87C591 QuickStart Instructions 48 PHYTEC Me technik GmbH 2002 L 586e_2...

Page 53: ...ide variety of peripherals including the serial port external I O and timers The Real Mode using either the Raisonance ROM monitor or an In Circuit Emulator allows target based debugging When using th...

Page 54: ...d click the Connect button to establish connection to the target hardware Returning to the FlashTools98 tabsheet choose the Bank Utilities tab highlight Banks 1 and click on the Erase Bank s button Ne...

Page 55: ...2 1 Creating a New Project Start the RIDE environment and close all projects that might be open Open the Project menu and create a new project called Debug prj within the existing project folder C PHY...

Page 56: ...an 8051 derivative allows access to up to 64 kByte of memory for CODE and 64 kByte for XDATA When debugging with the Raisonance monitor it is important that the user program CODE can be changed durin...

Page 57: ...e CODE and XDATA areas within the application program do not overlap This is important because otherwise portions of the program CODE will be overwritten by e g variables XDATA resulting in an error w...

Page 58: ...technik GmbH 2002 L 586e_2 Open the Options Target menu select the 8xC591 and a Von Neumann architecture as shown below Click on OK to save the configuration Open the Options Project RC51 menu and cho...

Page 59: ...oject RC51 menu now choose Memory Model Select the Large memory model Disable the checkbox Component with XRAM under Special features This is necessary because the XRAM portion can not be accessed as...

Page 60: ...chnik GmbH 2002 L 586e_2 In the Options Project RC51 menu now choose Optimizer Select the Optimizer level 1 as shown below This is necessary because the created Debug aof file can be better debugged w...

Page 61: ...Check that the Generate an Intel Hex file checkbox is disabled This option should be enabled by default The memory ranges for off chip CODE and off chip XDATA memory are configured to fit within the...

Page 62: ...ystal Frequency of 12 000 MHz and a Communication Baud Rate of 9600 Make sure the checkbox Microcontroller without clock prescaler P8xC591 like is enabled Click on OK to save these settings The linker...

Page 63: ...as shown below Click on the Advanced Options button to specify additional debugging options Make sure that the 8xC591 is selected in the microcontroller pull down menu Select the correct COM port and...

Page 64: ...s 60 kB This is because the monitor loader code itself is located at address F000H In addition the I O area of the phyCORE module occupies the memory range between FC00H and FFFFH These memory areas c...

Page 65: ...art the previously downloaded monitor kernel To start the RIDE debug environment select Start debug aof in the Debug menu The RIDE debug environment now initializes the ROM Monitor and loads the debug...

Page 66: ...LX51 ROM Monitor tab and the Options Debug menu Make sure the settings are the same in each configuration menu Push the Reset button S2 on the phyCORE Development Board LD 5V and start the RIDE debug...

Page 67: ...layed In the lower part of the debug screen you will see the Command and Watch window The Xdata window is shown in the lower right section of the screen You may need to open resize and or move some wi...

Page 68: ...ruction level To Step into click on the button or press F7 or open the Debug Step Into menu Step over function calls means to skip over a function that you are not interested in To Step over click on...

Page 69: ...ures 4 6 1 Watch Window Go to the code line where the constant rhythm is defined Select the constant by double clicking on the constant name Right click on the constant rhythm and select Add Watch in...

Page 70: ...small sign in front of rhythm indicates that this is an array with a group of array elements Click the sign to expand the view and to see all array elements of rhythm 4 6 2 Run to The Run to command e...

Page 71: ...o run the program and stop at the selected code line select Run to in the Debug menu The Debugger executes the program until it reaches the code line where the cursor is currently located This code li...

Page 72: ...variable state is now shown in the Watch window The initial value is 0 Now click on the Step Over icon four times to single step through the led function Notice that a new value 1 for the local variab...

Page 73: ...69 4 6 4 Breakpoints Select the variable blink and add blink to the Watch window Click on the green icon in front of the code line if blink to set a breakpoint here The red marker on the left hand sid...

Page 74: ...Click on the Go icon and the program will run and stop at the breakpoint Notice that the LED D3 on the Development Board now goes off This is because the led 0 function call has been executed Also no...

Page 75: ...The code line if blink is now highlighted in pink color Repeat clicking on the Go icon and watch the variable blink and the LED D3 on the Development Board Click on red marker on the left hand side o...

Page 76: ...d Resetting To run your program without stopping at any time delete all breakpoints by clicking on the red icon in front of the code line Click on the Go icon The LED now blinks with alternating on an...

Page 77: ...ield This will include various printf statements in the application program that can be viewed with a terminal emulation program Use of the printf statements is now possible because the serial interfa...

Page 78: ...wnload procedure information refer to sections 2 2 through 2 4 Press the Reset button S2 on the Development Board to start the program The application is now waiting for receipt of a known character o...

Page 79: ...1 allows you to easily update your own code and the target application in which the phyCORE P87C591 has been implemented Currently the phyCORE P87C591 can be populated by two different sized Flash dev...

Page 80: ...T signal after reset BOOT 0 start Flashtools BOOT 1 start user program This signal can be set to a low level by pressing the Boot S1 button located on the phyCORE Development Board LD 5V To enter the...

Page 81: ...and has two physically different signals for separate fetching of data and code The Raisonance tool chain distinguishes the following segment types CODE code XDATA external data max 64 kByte DATA dir...

Page 82: ...ill be addressable at 0x0000 to 0xFFFF The user bank bank 1 FA 18 15 0010b will be addressable at 0x0000 to 0xFFFF This default runtime memory model requires no additional linker settings because both...

Page 83: ...1 QuickStart Instructions Document number L 586e_2 July 2002 How would you improve this manual Did you find any mistakes in this manual page Submitted by Customer number Name Company Address Return to...

Page 84: ...Published by PHYTEC Me technik GmbH 2002 Ordering No L 586e_2 Printed in Germany...

Reviews: