Home
SPARC SH Series Simulator/Debugger User's Manual
Contents
1. 206 I O ARI EA START ADDRI ESS RI El 207 KKK MAP ENU KKK 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END 1 RET EXTERNAL START ADDRESS 06000000 RET END ADDRESS 07FFFFFF RET STATE COUN 3 RET DATA BUS SIZE 8 RET EXTERNAL START ADDRESS RET MAP MENU 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END 2 2 RET RAM AREA START ADDRESS OF000000 RET END ADDRESS OFFFFFFF RET STATE COUN Z eke RET DATA BUS SIZE 2 32 RET RAM AREA START ADDRESS RET xk MAP ENU KKK 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END RET lt q X CPU INFORMATION x CPU SH 7000 lt a 93 01 25 SH SAMPLE lt b BIT SIZE 32 c No Device Start End State Bus il EXTERNAL 00000000 OOFFFFFF 3 8 2 EXTERNAL 01000000 O4FFFFFF 2 8 3 I O AREA 05000000 OSFFFFFF 3 8 4 EXTERNAL 06000000 O7FFFFFF 3 8 5 RAM AREA 0F000000 OFFFFFFF 1 32 d e f g h i xx EDIT MENU k 1 ADD 2 DELETE 3 COMMENT 4 CIA ABORT CIA END RET lt w CIA COMPLETED o o Description 1 The name of a new CPU information file is s
2. OV L FNUM_ADR RO OV L H 00000002 R1 OV B R1 RO OV L REQ_COD RO MOV L PAR_ADR R1 OV L CALL_ADR R3 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL _ ADR DATA L SYS_CALL REQ COD DATA L H 01060000 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM FCLSE_BUF RES B 1 FNUM RES B 1 END 2 3 FGETC lt Function gt Inputs one byte from a file lt Function code gt H 27 lt Parameter block gt 182 MSB 0 8 15 0 Return value File number 2 Unused 4 Start address of input buffer 6 e Return value output 0 Normal termination 1 EOF detected e File number input The number returned when the file was opened e Input buffer start address The start address of the buffer for writing input data lt Example gt To read one byte of data from the file sample src STOP SYS_CALL NOP IMPORT FN MOV L PAR OV L REQ MOV L CAL OV L FNU MOV B R2 MOV L PAR ADD L 01 MOV B R4 JSR R3 NOP NOP ALIGN 4 UM _ADR R1 _COD RO L_ADR R3 M_ADR R2 R4 _ADR R2 R2 R2 183 TRAP_ADDRESS TRAP_ADDRESS 2 4 CALL_ADR DATA L SYS_CALL REQ COD DATA L H 01270000 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM FGETC_BUF RES B 2 RES W 1 DATA L INBUF INBUF RES B END FPUTC lt Function gt Outputs one byte to a file lt Function code gt H 28 lt Parameter block gt MSB 0 8
3. 00000400 MOV L 0000002E R1 00000400 E12E RET 00000402 MOV L FFFFFFF R2 00000402 E2FF MOV L 0FF R3 RET 00000404 0009 ADD R1 R2 RET 00000406 0009 RET DISASSEMBLE 400 3 RET 00000400 MOV L 0000002E R1 00000402 MOV L FFFFFFFF R3 00000404 ADD L R1 R2 62 BREAK 5 2 BREAK Sets displays and cancels breakpoints based on B instruction execution address Format Set BREAKA lt instruction address gt A lt repeat count gt Enable disable BRI Display BRI Cancellation BRI Parameters EA E EA lt command line gt RET KA lt instruction address gt E D RET K RET EA E K A lt instruction address gt RET e lt instruction address gt Specifies the address of the breakpoint s lt repeat count gt Specifies the number of times the instruction of the specific position is fetched before breaking A value between H 1 and H 3FFF default is H 1 e Option Enable disable E D E enable D disable Enables previously set breakpoints Disables previously set breakpoints e lt command line gt Specifies a certain command line to be executed when the break occurs To indicate a double quotation mark in a character string insert two double quotation marks in sequence Function Sets displays and cancels breakpoints based on instruction execution
4. CNV400 OV L H FF RO OV L CNV_RC6 R4 OV L RO R4 RETURNNING RESEQUENCE CNV500 OV L SV_R1P R8 RELOAD REGISTER OV L R8 R1 7 OV L SV_R2P R8 OV L R8 R2 OV L SV_R3P R8 OV L R8 R3 OV L SV_R4P R8 OV L R8 R4 7 OV L SV_R5P R8 OV L R8 R5 i OV L SV_R6P R8 OV L R8 R6 7 OV L SV_R7P R8 OV L R8 R7 E OV L CNV_RC6 R8 LOAD RETURN CODE OV L R8 RO H OV L R15 R8 LOAD R8 REGISTER RTS DELAY BRANCH LDS L R15 PR 7 PR LOAD i POITER AREA etna ee Hel e RO Se a eae align 4 SV_R1P DATA L SV_R1 SV_R2P DATA L SV_R2 SV_R3P DATA L SV_R3 SV_R4P DATA L SV_R4 SV_R5P DATA L SV_R5 SV_R6P DATA L SV_R6 SV_R7P DATA L SV_R7 CNV_STR6 DATA L CNV_STR CNV_TBL6 DATA L CNV_TBL CNV_RC6 DATA L CNV_RC MODE_TBL6 DATA L MODE_TBL 230 TRAP ADDRESS SAY TRAP_ADDR SPROG TRAP A ee ee TRAP NOP r DATA AREA PARAMETER BLOCK AND I O BUFFER r section dt data r CONSOLE I O SIMULATION PARAMETER BLOCK r PARI RES L 1 I O BUFFER ADDRESS f FILE I O SIMULATION PARAMETER BLOCK A ee eo ir O A E O PARM_FP FP_RCOD RES B ab RETURN CODE AREA FP_FNUM RES B L FILE ID NUMBER FP_MODE RES B al OPEN MODE FP_RESV RES B J RESERVED FP_FNMA RES L 1 FILE NAME AREA ADDRESS r FILE I O SIMULATION FILE READ PARAMETER BLOCK E ee A eee a o a e PARM_FR FR_RCOD RES B 1 RETURN CODE AREA FR_FNUM RES B 1 FILE ID NUMBER alig
5. Sprog src P 1 08000A78 STS L PR R15 O8000A7A OV L R4 R0 O8000A7C MOV L Sprog src PARM_1 R1 O8000A7E OV L RO RL 08000A80 OV L Sprog src REQ_CD_1 R0O 08000A82 MOV L Sprog src TRP_AD_1 R3 08000A84 JSR R3 08000A86 NOP 08000A88 OV L Sprog src PARM_1 R3 08000A8A MOV L R3 R1 08000A8C OV B R1 RO O8000A8E CMP EQ L 00000000 R0 08000A90 BT Sprog src R_EXIT 08000A92 MOV L 00000001 RO 08000A94 MOV L Sprog src RTN_AD_1 R3 08000A96 BRA Sprog src R_RTN Ld 2 3 4 Notes 1 The line prog src P is the symbol defined for address H 8000A78 Here prog src is the file name and P is the label Note that prog src P can be specified instead of H 8000A78 2 The first address of the instructions The instruction mnemonics 4 The instruction operand 3 3 6 Checking Memory Contents DUMP stop_f 6 RET 1 address 0 2 4 6 8 A C E ASCII 09002F48 0000 0000 0000 0000 0000 0000 wi 2 3 4 35 Notes 1 This command displays six 2 byte blocks of data starting at the symbol stop_f in hexadecimal The first address Displayed in 16 byte units The contents of 12 bytes of data six 2 byte blocks The contents of 3 as ASCII characters Periods are displayed when the values cannot be converted 3 3 7 System Call Start Address Line 24 of the sample program prog src see appendix D Sample Program inputs a single line using the instruction JSR ER3 The starting addr
6. To generate a break if 100 is written to symbol rsym BD rsym 100 RET 71 BREAK_DATA 6 To display the currently set breakpoints note that addresses data and masks are displayed in hexadecimal BD RET lt E D gt lt ADDR gt lt DATA gt lt EQ NE gt lt COMMAND LINE gt lt MASK gt lt SYMBOL gt D 00002000 0010 W EQ REGISTER file c a 4 E 0000AFOO 20 B NE file c b 236 E 0000FFOO 02 B EQ 03 Sfile c c 246 E R4 00000100 L EQ 22222 rsym If a symbol assigned to a register is specified as a break addresses the register name is indicated at lt ADDR gt 7 To clear the breakpoint at address H FFOO BD OFFOO RET 72 BREAK_REGISTER 5 5 BREAK_REGISTER Sets displays and cancels break conditions based BR on the value of data in a register Format Set BREAK_REGISTERA lt register gt A A lt data gt lt size gt A lt mask gt EQ NE lt command line gt RET Enable disable BREAK_REGISTERA lt register gt E D RET Display BREAK_REGISTER RET Cancellation BREAK_REGISTER A lt register gt RET Parameters lt register gt Specifies the register for which the break is to be set SP can be specified instead of R15 lt data gt lt size gt Specifies the data value for the break condition When the size is omitted
7. CA func2 1800 50 10 RET D 1800 10 RET Loads the file test2 obj Allocates the stack and return areas Initializes the stack pointer The return address will be H 100 i e the current value of the PC Confirms the results of the arithmetic operations address 0 1 2 3 4 5 6 7 8 9 A B C D E F ASCII 00001800 00 00 00 60 00 00 00 40 00 00 05 00 00 00 00 05 82 COMMAND_CHAIN 5 8 COMMAND_CHAIN Executes commands from a file CC Format COMMAND_CHAINA lt file name gt A lt actual parameter gt lt actual parameter gt RET Parameters e lt file name gt Specifies the name of the command file e lt actual parameter gt Specifies a character string to replace dummy parameters To omit an actual parameter skip its position by inserting an extra comma Function This command reads commands from a file and executes them in sequence Dummy arguments can be specified within a command file to be replaced with the actual parameters specified in the COMMAND_CHAIN command There are 10 dummy parameters 0 to 9 Use the strings 0 to 9 to represent YO to 9 within character stings or as character strings in option command lines of the BREAK BREAK_ACCESS or BREAK_DATA commands Dummy parameters for which no actual parameters are specified are replaced with NULL Notes 1 To include a double quotation mark in a character string in
8. OV L CNV_STR6 R2 CNVO00 MOV B RO R1 j EXTU B R1 R1 TERMINATOR SUB L R4 R4 dE CMP EQ R1 R4 BT CNV100 MOV H 61 R4 CMP GT R1 R4 lower CHANGE LOOP BF CNV0101 ADD H 20 R1 EXTU B RIR TO BE lower CNVO10 MOV B R1 R2 LOCAL SAVE ADD L 1 R0 BRA CNV000 DELAY BRANCH ADD L 1 R2 ad COMPARE WITH MODE STRING CNV100 MOV L CNV_TBL6 ER1 SUB L R2 R2 CNV110 MOV L R1 R3 SUB L R6 R6 CMP EQ R6 R3 BT CNV400 ERROR MOV L CNV_STR6 R4 CNV120 MOV B R4 R5 MOV L 0 R7 CMP EQ R5 R7 BT CNV300 MOV B R3 R6 CMP EQ R5 R6 BF CNV190 ADD 1 R3 BRA CNV120 ADD 1 R4 TRY NEXT STRING CNV190 ADD 4 R1 ADD 1 R2 BRA CNV110 EXTU B R2 R2 TOP OF COMPARE LOCAL INDEX STRING ADDRESS ARRAY DATA ADDRESS WORK 0 CLEAR NULL NO DATA MORE IT IS AN TOP OF USER STRING LOAD 1 CHAR NULL CHAR NOW COMPLETED SET TO UPPER SAME NO TRY NEXT NEXT STRING TABLE ENTRY INCREMENT THE INDEX TRY NEXT 229 COMPARE SUCCESSFUL ER2 HAS THE MODE ID INDEX CNV300 SUB L RO RO OV L CNV_RC6 R4 RESET THE RC OV L RO R4 OV L MODE_TBL6 R3 MODE ID NUMBER TABLE SHLL R2 INDEX 2 EXTU B R2 R2 ADD L R2 R3 TABLE ENTRY OV W R3 RO RO NOW THE MODE ID ADD L 2 R4 SAVE TEMPORARY BRA CNV500 GO TO RETURN SEQUENCE OV W RO R4 r ERROR RETURN COMPARE FAILED
9. f_ no short 0 if F_read 0 bp 0 Data less than 256 byte block if F_close 0 0 Write ALSO CLOSE failed Yn nxt_f short 1 223 KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KK KK KK KA AAA AAA AAA KK Y SAMPLE OF e A KKXKXKXXKXXX Y SD38 I O SIMULATION THIS PROGRAM IS DESIGNATI ED FOR SH FILE NAME IS PROG SRC KAEKKKKK KKK KKK KKK KKK KKK KAKI INPUT AREA A DDRESS ARGUMENT_1 PARAMETER AR REQUEST CODE TRAP ADDRESS GO TRAP ER ADRESS SET DELAY_BRANCH O DATA HAD BEEN READ BUFFER ADDRESS ADRRESS BUFFER ADDRESS READ CHECK IF 0X00 NOTHING HAD BEEN READ RETURN POINT ER SET SET RETUTRN CODE DELAY RETURN EXPORT TRAP EXPORT _Read _Write EXPORT F_open _F_close _F_read F 1 LINE READ FROM CONSOLE A A A A ee eee ee Read o o Se e a o REGISTER SAVING SES PR _R15 SAVE PR F PARAMETER BLOCK SETTING MOV L R4 RO R4 MOV L PARM_1 R1 MOV LPO R1 SET pon gn ee ee ee GO TRAP MOV L REQ_CD_1 R0 MOV L TRP_AD_1 R3 JSR R3 NOP r RETURN CODE CHECK IF TOP OF DATA IS 0 N MOV L PARM_1 R3 MOV L R3 R1 MOV B R1 RO CMP EQ 0 RO BT R_EXIT NORMAL as toto pts tii tapas tene tarta tits blabla ni RETURN CODE SET I O ERROR OR EOF 1 MOV L 1 RO MOV L RIN_AD_1 R3 BRA R_RTN DELAY
10. Note that this command only sets the range for coverage measurement and that the COVERAGE command is used to start the acquisition of coverage information Description Set Setting state display Clear Sets the area for the acquisition of CO and C1 coverage information Up to 16 address ranges can be specified The coverage ranges may not be set during coverage execution When a debugging object program is loaded with the LOAD command the code segment areas in that program are automatically set as the address range Displays the setting state When the setting state is displayed during coverage execution the address range s the file name and the enable disable state are displayed When coverage is not being executed only the coverage areas are displayed The specified coverage area is made invalid When the address specification is omitted all areas settings are cleared 148 SET_COVERAGE In this case a confirmation message will be displayed Respond Y to clear all areas or N to cancel the clear operation Examples 1 To set the address range for coverage data acquisition to be from address H 1000 to address H 12FF SCV 1000 12FF RET 2 To display coverage setting following the start of coverage measurement SCV RET file name testl cov Enable Disable E coverage area 00001000 000012FF 00001800 00001FFF 3 To cancel the area starting at address H 1000
11. 5 38 STEP Performs step execution in subroutine units S Format STEP lt step count gt R RET Parameters lt step count gt Specifies the number of instruction execution steps H 1 to H 7FFFFFFF When omitted 1 step is executed Option Register content display R R register Displays the contents of the registers after instruction execution Function Executes instructions one at a time starting at the current program counter for the specified number of steps Description 1 Each time an instruction is executed the mnemonic of the executed instruction is displayed If the R option was specified the contents of the registers are displayed after instruction execution This command executes subroutines called with a BSR or JSR instruction from the start of the subroutine through the RTN instruction as a single step Execution is halted if a condition set by a break command is satisfied or if a simulator debugger error occurs The cause of the halt is displayed when execution stops The simulator debugger performs processing identical to that for the input of a STEP RET command line if a RET is input following the completion of STEP command execution 152 Note STEP If a delayed branch instruction is executed during STEP command execution execution stops at the end of the instruction following the delayed branch instruction Example To execute five instructions wi
12. 64 Examples 1 BREAK To set a breakpoint that breaks just prior to the eighth time the instruction at address H 2000 is about to be executed and to execute the REGISTER command after stopping at the breakpoint B_2000 8 r REGISTI ER RET To disable the break at address H 2000 B 2000 D RET To display currently set breakpoints note that addresses and counts are displayed in hexadecimal B RET lt E D gt lt ADDR gt D 00002000 lt COUNT gt 8 lt COMMAND LINE gt lt SYMBOL gt REGISTER file c symbol 100 To clear the breakpoint at address H 2000 B 2000 RI ET 65 BREAK_ACCESS 5 3 BREAK_ACCESS Sets displays and cancels break conditions based BA on access to a range of memory Format Set BREAK_ACCESSA lt start address gt A lt end address gt lt byte count gt R W RW lt command line gt RET Enable disable BREAK_ACCESSA lt start address gt E D RET Display BREAK _ACCESS RET Cancellation BREAK_ACCESS A lt start address gt RET Parameters e lt start address gt A lt end address gt lt byte count gt Specifies the start address or the range of memory for which the simulator debugger will stop if accessed by the object program being debugged When the end address is not specified the range consists of
13. lt assembly language or DATA notation gt R Gl E HH address xxxx lt assembly language or DATA notation gt R address xxxx RET The above terms are described below lt instruction mnemonic gt The current disassembled contents of the start address address The start address XXXX The value of the first two bytes of the memory address indicated by address periods Terminates the line assembly command 61 ASSEMBLE 2 The following processing is performed if only RET is entered e Prior to assembly language notation input The address counter is advanced to value equal to the current address plus the instruction length the instruction mnemonic is displayed and the command waits for assembly language notation input e After assembly language notation input The address counter is advanced to the current address plus 2 and the command waits for assembly language notation input Notes 1 Refer to the SH Series Cross Assembler User s Manual for details on assembly language syntax and the DATA directive 2 Refer to appendix A Differences Between SH Series Cross Assembler Syntax and Line Assembly Command for differences between the notations used with this command and those of the cross assembler Example To interactively input assembly language expressions convert them to machine language and store them starting at address H 400 ASSEMBLE 400 RET
14. 23 4 Break Due to Execution of a SLEEP Instruction When a SLEEP instruction is executed during simulation the simulator debugger stops execution The following message is displayed when execution is stopped SLEEP Execution can be resumed with a GO STEP STEP_INTO or VECTOR command 5 Break Due to Input of CTRL C Execution can be forcibly terminated by the user during simulation using the above keys The following message is displayed when execution is terminated MANUAL BREAK Execution can be resumed with a GO STEP STEP_INTO or VECTOR command 2 12 Memory Manipulation The simulator debugger provides the COMPARE FILL and MOVE commands as functions to increase debugging ability 1 The COMPARE command compares memory contents It is used for example to compare the results of executions The COMPARE command displays unmatched data 2 The FILL command fills a memory area with initial data It is used to initialize memory prior to program execution 3 The MOVE command copies the contents of a specified memory area to a specified destination area 2 13 Macro Command Combination A macro function is a function that produces new commands by combining multiple commands Macros can be created in the simulator debugger by using the MACRO command Macros can use macro internal variables and macro internal commands Macro internal commands are control commands which define macro internal conditions or which can
15. T Format TRACE lt start instruction index gt lt instruction count gt lt end instruction index gt I A RET Parameters e lt start instruction index gt Specifies the first instruction to display The value indicates the point in the trace buffer at which to start display as a number of instructions back from the end instruction stored in the trace buffer When omitted display starts at the beginning of the trace buffer e lt instruction count gt Specifies the number of instruction to display When both the instruction count and the end instruction index are omitted the end instruction executed is displayed e lt end instruction index gt Specifies the end instruction to display The value indicates the point in the trace buffer at which to end display as a number of instructions back from the end instruction stored in the trace buffer e Options Display content I A I instruction Only instruction addresses and mnemonics are displayed A all The instruction address instruction mnemonic register data and memory access data are displayed When omitted the I option is assumed Function Displays the trace results stored in the trace buffer 163 TRACE Description 1 The following information is displayed e The address of the executed instruction e The mnemonic of the executed instruction e The general registers RO to R15 the control registers SR GBR VBR and the system
16. registers MACH MACL PR and PC e The memory access data read data is displayed as R xxxxxx and write data as W xxxxxx Display range specified by the start instruction index Figure 5 3 shows the contents of the trace buffer when displaying starting at 5 instructions back from the end of the trace buffer This example assumes the command TRACE 5 lt First instruction executed First instruction 5 displayed Display range 1 lt Last instruction executed O lt Breakpoint Trace buffer Figure 5 3 Display Range Specified by the Start Instruction Index 164 TRACE Display range specified by the start instruction index and instruction count Figure 5 3 shows the contents of the trace buffer when displaying 3 instructions starting at 5 instruction back from the end of the trace buffer This example assumes the command TRACE 5 3 lt First instruction executed First instruction gt 5 displayed Display range 4 Instruction count Last instruction gt 3 displayed 2 1 lt Last instruction executed 0 lt Breakpoint Trace buffer Figure 5 4 Display Range Specified by the Start Instruction Index and the Instruction Count Notes 1 The addresses of the executed instructions are stored in the trace buffer during trace data acquisition When displaying the contents of the trace buffer th
17. 129 MAP Notes 1 Always confirm the address of the start address in the memory area with the MAP command before changing the access type 2 An error occurs if an attempt is made to use the MAP command to allocate a memory area that is already allocated 3 An error occurs if an attempt is made to use the MAP command to allocate a memory area that includes any part of the invalid area 4 It is not possible to allocate a memory area that covers multiple memory areas including the internal ROM area the external bus space the internal RAM area and the internal I O space 5 Areas other than those allocated with the MAP command cannot be deleted with the MAP command 6 Areas specified by the MAP command cannot be initialized Examples 1 To allocate addresses H 3000 to H 301F as a read only memory area MP 3000 301F R RET 2 To allocate a 50 byte area starting at address H 4000 as a write only memory area MP 4000 50 W RET 3 To change the access type for memory area allocated from address H O to address H 03FF to write only MP 0 W RET 130 MAP To display the current memory allocation state MP RET lt START gt 00000000 00002000 00003000 00004000 00004050 lt END gt lt ATTR gt lt SECT_NAME gt 000003FF W 000020EF RW SECT1 0000301F R 0000404F W 0000504F RW It is not possible to allocate an area that includes an already allocated m
18. 15 0 Return value File number 2 Unused 4 t Start address of output buffer 6 e Return value output 0 Normal termination 1 Error e File number input The number returned when the file was opened 184 TRAP_ADDRESS e Output buffer start address The start address of the buffer used to hold the output data 185 TRAP_ADDRESS lt Example gt To output one byte of data the character A to the file sample src IMPORT FNUM MOV L PAR_ADR R1 MOV L REQ_COD RO MOV L CALL_ADR R3 MOV L FNUM_ADR R2 MOV B R2 R4 MOV L PAR_ADR R2 ADD L 01 R2 MOV B R4 R2 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L SYS_CALL REQ_COD DATA L H 01280000 AR_ADR DATA L PARM NUM_ADR DATA L FNUM 4 PUTC_BUF RES B 2 RES W 1 DATA L OUTDATA OUTDATA DATA B A END 186 TRAP_ADDRESS 2 5 FGETS lt Function gt Reads in character string data from a file Data is read in until either a newline code or a NULL code is read or until the buffer is full A NULL code is appended to the end of the character string read from the file lt Function code gt H 29 lt Parameter block gt MSB 0 8 15 0 Return value File number 2 Buffer size 4 t Start address of input buffer 6 e Return value output 0 Normal termination 1 EOF detected e File number input The number returned
19. B has the same value as the expression H 34 B 4 4 4 Floating Point Data Floating point constants are either single S or double D precision and have the following syntax n il AM end F Prefix indicating floating point data Cannot be omitted Integer part in decimal Fraction part in decimal Sign is is the default at omission Precision specifier S is the default when the precision specifier is omitted S Single precision D Double precision xx Exponent part in decimal 0 is the default when the exponent specification is HB omitted Examples F 1 S Specifies 1 0 in single precision F 1D 2 Specifies 0 1 x 10 2 in double precision 4 4 5 Character Strings Character strings are handled as data sequences consisting of the ASCII code of each character in turn and are enclosed by double quotation marks To include a double quotation mark in a character string insert two double quotation marks in sequence To include a non text ASCII code surround the numeric constant representing the code in angle brackets Note however that the lt numeric constant gt notation can only be used with the MEMORY and DATA_SEARCH commands Example ABCDEF lt 0A gt Note when the number of characters within the double quotation marks is four or less the string is handled as a character constant 57 4 4 6 File Names File name notations must follow the restrictions on file names imposed by the operating s
20. BRANCH MOV L RO R3 y SET 1 paa gg Eg gg eae O See eo ee RETURN CODE SET ORMAL END 0 R_EXIT SUB L RO RO MOV L RTN_AD_1 R4 MOV L RO R4 y RETURNNING SEQUENCE R_RTN MOV L RTN_AD_1 R2 MONV L R2 RO RTS i LDS L R15 PR LOAD PR POINTER AREA 224 PARM _1 DATA REQ_CD_1 DATA TRP_AD_1 DATA RTN_AD_1 DATA L PARM L H 01230000 L TRAP L RTN_CD STS L ETER BLOCK SI MOV L MOV L MOV L ETTING R4 RO PARM_2 R1 RO R1 Y INPUT AREA ADDRESS GO TRAP REQ_CD_2 RO PARN_2 R1 TRP_AD_2 R3 R3 SET RETURN CODE DELAY LOAD PR RETURN W_RIN SUB L RO RO RTS LDS L R15 PR POINTER AREA r align 4 PARM_2 DATA L PARNM REQ_CD_2 DATA L H 01240000 TRP_AD_2 DATA L TRAP r FILE OPEN F_open E REGISTER SAVING STS L PR R15 r PARAMETER BLOCK SETTING MOV L R5 RO BSR CNV_MODE NOP MOV L FP_ FUNUM_3 R3 MOV B RO R3 CMP PZ RO BF FR_ERROR MOV L R6 RO r OPEN CHAR MODE ARGUNM ARGUM gt MODE 1D DELAY BRANCH SET 1 MODE CONVERSION ERROR FILR NUMBER 225 ARGUMENT_3 ENT_ ENT_ R6 GO TRAP OV FP_FNUM_3 R3 RO R3 R4 R0 FP_FNMA_3 R3 RO R3 RO RO FP_RCOD_3 R3 RO R3 REQ_CD_3 R0O PARM_FP_3 R1 TRP_AD_3 R3 R3 i SET FILE NAME ADDRESS ARGUMENT_1 R4 7 SET CLEAR RETURN CODE AREA REQUEST CODE PARA
21. CAN NOT CLOSE The output CPU information file could not be closed See note 6007 INVALID CPU INFORMATION Errors were encountered in the CPU information file Check the contents of the file and correct the errors 6008 SYNTAX ERROR There was an error in the file specification syntax Enter the file name correctly Note In these cases if the file name was correct the disk may be full or there may be a disk hardware error After checking the disk status re execute the CIA program 247 F 3 2 Keyboard Input Related Error Messages Table F 7 lists the error messages related to keyboard input Table F 7 Keyboard Input Related Error Messages Error No Message Error Description and Recovery Procedure 7001 COMMENT LINE TOO LONG The specified comment line exceeded 127 characters The comment line must be 127 chracters or less 7002 ADDRESS RE USE Address ranges overlap Check the addresses and re enter correctly 7003 ADDRESS SIZE OVERFLOW An address value exceeding the bit size was specified Enter a correct address value 7004 INVALID VALUE A numeric value outside the allowed range was specified Correct the input to specify a value within the allowed range 7005 INVALID CHARACTER A character that cannot be used was input Input a character that corresponds to one of the selection choices 7006 INVALID END ADDRESS An end address smaller than the start address was specified Re enter the end address with the c
22. COUN 2 1 RET DATA BUS SIZE 2 32 RET ROM AREA START ADDRESS RET MAP MENU 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END RET FREE CPU VINEORMATION FERRER CPU SH 7000 93 01 25 SH SAMPL BIT SIZE 55 32 1 No Device Start End State Bus 1 ROM AREA 00000000 OOFFFFFF 32 2 EXTERNAL 01000000 O4FFFFFF 2 8 3 I O AREA 05000000 O5FFFFFF 3 8 4 EXTERNAL 06000000 O7FFFFFF 3 8 5 RAM AREA OF000000 OFFFFFFF T 32 xx EDIT MENU k 1 ADD 2 DELETE 3 COMMENT 4 CIA ABORT CIA END E RET CIA COMPLETED o Description 1 The name of the file to be edited is specified when the CIA program is invoked cpu is supplied if the extension is omitted 2 This item specifies a new file to be created when editing is done If only RET is entered the data will be output to the file specified in item 1 If only the extension is omitted cpu will be supplied The map data is automatically displayed 3 DELETE is specified to delete information to be changed in the edit menu 211 4 The information to be deleted is specified as a map number The state of the map information after the deletion is displayed ADD is specified to input the changed information 6 The input menu is displayed and the memory type is entered in the same manner as that used when creating a new CPU information file The state of the ma
23. CPU register size and the return value address was not specified in the CALL command High Return value area address Argument 1 Address Argument n Low Return value area Since the return value address was not specified a return value area is allocated on the stack and the return value is stored in that area The value of the stack pointer must be set to an appropriate value beforehand since the current stack area registers and memory areas are used during function execution Note that the SAVE_STATUS and LOAD_STATUS commands can be used to restore the system to the simulator debugger state prior to function execution after executing a function with the CALL command Refer to the SH Series C Compiler User s Manual for more information on the function call interface Note If optimization is performed at compilation arguments may be stored in the registers instead of on the stack 81 CALL Examples 1 To call the function func1 with the arguments 1 and 10 and to store the return value at address 5000 CA func1 1 10 5000 RI ET 2 To show the setup required to test the function func shown below The results of the arithmetic operations are stored starting at address H 1800 func2 pi J int p int ly 4 pt 1 35 ed od i Jy as MM E E e i 7 j L test2 obj RET UNDEFINED SYMBOL symbol MP 1000 1000 RET R15 1800 RET
24. CPU type Refer to the SH Series Programming Manual for details of the CPU specifications 2 2 Simulator Debugger Memory Management 1 Memory Map Specification The simulator debugger supports the memory types shown in table 2 1 Table 2 1 Memory Types Memory Type Access Type Debugging Object Program Execution Internal ROM Read only Yes Internal RAM Read write Yes External bus area Read write Yes Internal 1 O area Read write No The SH series CPU memory map is a combination of the above memory types The user must create a CPU information file which correctly specifies the memory map for the CPU used The CPU information analysis program is used to create a CPU information file This file can be used to specify the CPU its type and address bus width and the memory its types the start and end addresses of the memory areas the number of memory access states and the memory data bus width When the simulator debugger is started a memory map corresponding to the user system is created from the specified CPU information file When no file is specified external bus area is assumed 2 Memory Allocation When the simulator debugger is started or when a LOAD command is entered the simulator debugger allocates memory on the host computer for both the SH series debugging object program load area and the vector area Areas other than these are allocated with the MAP command a Vector area When a vector area is allocate
25. D R RET Termination Parameters e lt file name gt Specifies the file to hold coverage data The file temp cov is used as default when the a file name is omitted When the file extension is omitted cov is supplied as default e Options Restart and temporary halt coverage measurement 1 E enable Restarts coverage measurement D disable Temporarily halts coverage measurement COVERAGE N RET E ID Coverage data initialization specification R R reset Initializes coverage data Coverage data storage specification N N not save Function Coverage measurement is terminated without saving the acquired data to a file Starts temporarily stops restarts and terminates coverage measurement data acquisition Description Start Starts the acquisition of coverage data Previously acquired coverage data is lost The addresses of instructions executed by a CALL GO STEP STEP_INTO or VECTOR command following the input of this command are saved as coverage data 87 COVERAGE Tf the specified file exists the information in that file is read in thus resetting the address range If the file name is omitted the current coverage range setting is displayed and acquisition of coverage data begins Restart temporary halt Data acquisition is restarted temporarily halted or re initialized with initialization no change in other settings Termination Ac
26. Debugger 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 4 1 4 2 4 3 5 1 Memory IPs i Example Memory MAP cccsssssscecececsecesccessecesceceseeceaeeeneeceeceeseceeeeesaeeesaeceseecsaeeeaeeeee Stack Addresses Used to Save PC and SR oocococccccoccccnonnconccononnconnonancn noo nocononnn cnn nanccnnnnnos Limitations of C Debugging oconccnocnnonnnonconcnnnconcnnnonnonononnconnon nc ono co nonnn cn nnnnn nn nnnn rn crnncnnnnnos Processing When Satisfying a Break ConditiON ooconcocnnonicnocnnnnonnononnnoncnnonc nn nro noncnncnnnn Execution Time Increase Due to Break Condition Specifications 0 0 0c eee List of Simulation Errors Wii ases Register States at Simulation Error Stop ooooccoconoconoconnonnconncnnconoconocnncnnonnncnnnnnn cnn crnnnoncrnos Simulator Debugger COMIMAN S ooooocccccnnonocnnonnnonnnnnonnnonncnnconnonnn conc ne cono nn cn nennn nn nnnnnnnnonos Operators and Operator Priorities ooooncccnnincnononononnconncono ccoo nc onoconocnncnnonnn cnn nnnn cnn crncnncrnos C Expression Limitations and Workarounds ooooccoccconconoconconccnnconocnncnnnnnnonnnnnn conc rancnnnonos NACI NS Part II CPU Information Analysis Program 1 1 CIA LAr tations A it dees ao Part III Appendix A 1 B 1 C 1 F 1 F 2 F 3 F 4 F 5 F 6 F 7 G 1 Differences between Line Assemble Command and SH Series Cross Assembler Sto Ai in ee ea Assembler Mnemonics Recognized by the Line Assemble Command 0 eee SH7000 Memory
27. TRAP_ADDRESS Sets displays and clears the system call start TA address Examples 1 To record all instructions in the trace buffer following the execution of the following command TC I RET 2 To record only subroutine calls in the trace buffer eG SE CREE TC D RET 4 To store the results of program execution in the trace buffer when instructions are executed by a CALL GO STEP STEP_INTO or VECTOR command t TC AL REL B 348 RET G RET Exec Instructions 97 Cycle 387 PC 00000348 SR 00000000 PR EEEE EERE ERREEN ema SP 0FF00000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFF00000 00000346 MOV L R6 R5 gt T 5 RET 00000340 MOV L 00000000 R4 00000342 ADD L 00000001 R4 00000344 MOV L 0000000A R3 00000346 MOV L R6 R5 170 TRAP_ADDRESS 00000348 MOV L R6 R5 Format Set TRAP_ADDRESS lt instruction address gt RET Display TRAP_ADDRESS RET Clear TRAP_ADDRESS RET Parameter e lt instruction address gt Specifies the system call start address Function Sets displays and clears the system call start address used when the debugging object program uses standard I O or file I O Only one address can be specified Description Set If the b
28. The CONTINUE command can only be used inside a WHILE FOR or DO WHILE loop Example To display the values of addresses H 1000 to H 2000 jumping over i e ignoring addresses whose value is zero FOR ADDR 1000 ADDR lt 2000 ADDR ADDRt1 IF ADDR 0 CONTINUE D ADDR 127 MAP 525 MAP Defines displays modifies and deletes memory MP areas Format Set MAP lt start address gt lt byte count gt lt end address gt 7 R W RW RET Display AP M RET Modification MAP lt start address gt R W RW RET Deletion AP lt start address gt RET Parameters e lt start address gt Specifies the address of the start address in the memory area e lt byte count gt Specifies the number of bytes in the memory area e lt end address gt Specifies the address of the end address in the memory area e Option Access type R W RW R read Specifies the memory area to be read only W write Specifies the memory area to be write only RW read write Specifies the memory area to be read write When omitted the access type is set as follows E Internal ROM area only when defining a memory area R E All other cases RW by by CPU information memory map display M M map Specifies display of the memory map information from the CPU information file 128 Function MAP This command defines sets the memo
29. a R ias 3 1 1 Feature ciclo ista dedos Gaus event EA NAE NEE EIEE EEE dais 3 1 2 Debugging Object Programs sss recconiorsicn iones eeneioe serer EEr Eaa EEEE E esas 4 1 3 Simulation RANTE cia sea 5 Section2 Simulator Debugger Functions cooococconcccnoncnononcnononanonanacinnnccnnnnnss 7 2 1 Environment Specifications nesses e ae e a EEE E EENE 7 2 2 Simulator Debugger Memory Management 0 0 0 0 eeceeeceeceseceeceseeeeeeeeeseeeeeseeeseeees 7 2 3 Loading Debugging Object Programs oooocnncccoccnocioncnoncnnconnconocnncononnncononnnonn non conc rncnn cnn 9 2 4 Setting Register Initial Values Displaying and Changing Register Values 11 2 5 Displaying the Memory Map and Allocating Displaying Changing and Releasing Memory occccnnccconnnnncononononnconnonnconncnnconncn neon cn nnnnn cnn nnnn nan crincnncnnos 12 2 6 Execution and Tri erene e aeaaee spdes cease E E EE O anscnsedeh de beuncs drone E 14 2 7 Exception Processing iseset enirere rrenean is Eer e vocdiabscbescesiedvensssesseavsasvasscdnssepscanass 15 2 8 Standard I O and File I O Processing essseeeseeeseeseeeessseerseerrseeereresrerensesrnserresreserreeene 17 2 9 Saving and Restoring the Simulation StatUS oooonncionnnonnnociononnnonnconocononnnonnnnnnonncnncnncnnos 17 210 C Source Level Debugging scorri oe ene i a aE ar E EEN ian 18 A A Break Eei aTa Ee a K Ae e EEEE ENE ES EE E EE EE 20 2 12 Memory Manipulation esses es a aroni s eoe p EE AEEA AE roS EN E
30. be executed The following macro internal commands are provided WHILE e FOR 24 e DO WHILE e IF ELSE e MBREAK CONTINUE An executing macro command can be stopped by inputting CTRL C There is no limitation on the number of macro calls within a macro the number of nesting levels Refer to section 5 24 MACRO Definition Display Execution and Deletion of Macro Commands for details on the MACRO command 2 14 Command Chains and Saving Execution Results to a File 1 Command Chains Commands can be input from files which are created with a text editor Command files can be specified by the COMMAND_CHAIN command or by a parameter when the simulator debugger is started It is possible to include data that makes use of standard I O processing in command files 2 Saving Execution Results to a File There are two methods for saving simulator debugger execution results to a file the PRINT command and redirection a PRINT command The PRINT command saves to a file all command input and all execution results during the time that saving is specified In addition saving can be temporarily stopped and then restarted b Redirection The results of executing a single command can be saved to a file by using redirection Unlike the PRINT command however command input is not saved There are two redirection specification formats as follows Writing to a new file lt command line gt A gt A lt file name gt Appen
31. be opened Specify the correct file name 239 Table F 4 Error Messages during Command Execution cont Error No Message Error Description and Recovery Procedure 4010 CAN NOT READ The specified file cannot be read Specify the correct file name 4011 CAN NOT WRITE The specified file cannot be written The disk may be full or there may be a disk hardware error Re execute the write after checking the disk status 4012 COMMAND NOT FOUND A non existent command name was specified Specify the command correctly 4013 COVERAGE ALREADY STARTED An attempt was made to start coverage measurement when coverage measurement had already been started Or an attempt was made to change the coverage area setting To measure a differing range of locations terminate the current measurement reset the range and restart the measurement 4014 COVERAGE NOT STARTED Coverage has not been started Check the state of the coverage settings 4015 COVERAGE RANGES EXCEED 16 Up to 16 coverage areas can be specified To add another area first remove any unnecessary coverage areas 4016 COVERAGE RANGE NOT DEFINED An attempt was made to start coverage measurement with no coverage areas defined Specify the coverage areas before starting coverage measurement 4017 DIVIDE BY ZERO A divisor of 0 appeared in an integer expression Modify the divisor to be a value other t
32. comparison data memory area Function Compares the specified range of memory the source data with the comparison data in byte units When data that does not match is found those data items and their addresses are displayed Example To compare the H 500 bytes of data starting at address H 1000 with the H 500 bytes of data starting at address H 2000 and to display the addresses and values of the source data and compared data when data which does not match is found CMP 1000 500 2000 RET source data compared data 00001005 3F 00002005 42 000014FE 00 000024FE 80 85 CONVERT 5 10 CONVERT Calculates expression CV Format CONVERTA lt expression gt RET Parameter e lt expression gt Specifies an integer expression for conversion Function The value of the expression is displayed in binary octal decimal and hexadecimal and as ASCII characters Example To display the result of evaluating the expression 3 5 in binary octal decimal and hexadecimal and as ASCII characters CV_3 5 RET B 00000000 00000000 00000000 00001111 Q 00000000017 D5 H 0000000EF A Note If a symbol is specified in an expression the symbol address is displayed 86 COVERAGE 511 COVERAGE Starts and stops coverage measurement COV Format Start COVERAGE A lt file name gt RET Restart temporary halt initialization COVERAGE E
33. disassembles and displays the contents of memory in the range specified by the start address and the end address or instruction count parameters Description 1 When the end address or instruction count parameter is omitted 16 lines from the start address are disassembled The hexadecimal representation for the two bytes of data is displayed when an illegal instruction is encountered The first address of the instruction the instruction mnemonic the operands and the symbol are displayed Note that the address corresponding to a symbol displayed as a label is the address of the instruction displayed on the line following the symbol After this command is executed pressing the RETURN key again disassembles and displays the next 16 lines until other commands are entered 95 DISASSEMBLE 5 When the SP is specified as a register in PC relative or register indirect with displacement addressing mode the displacement value will be converted to the corresponding automatic variable symbol and the conversion results will be displayed Note Since the DISASSEMBLE command does not recognize delay branch instructions correctly symbol conversion may not be performed correctly Examples 1 To disassemble and display from addresses H 400 to H 406 In the output below sample src SECT 1 is a symbol which corresponds to address H 404 DA 400 406 RET 00000400 MOV W 12 PC RO 00000402 MOV W R1 RO ssample sr
34. e x RR SP 0FFFFFFC w 00000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 R0 7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFFFFC 3 el 08000402 STS L PR R15 5 PC 08000404 SR 00000000 HR HAA AKA KKK KK RARA SP 0FFFFFF8 w 00000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Do R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000004 OFFFFFF8 08000404 MOV L 00000048 PC R4 PC 08000406 SR 00000000 FA FARARARA RA RARA RARA RE SP 0FFFFFFS R 09000020 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 0800000C RO 7 00000000 00000000 00000000 00000000 09000020 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFFF8 Notes 1 Displays 3 instructions from the trace buffer starting 17 instructions back Option SA specifies that all of the saved trace information is to be displayed 2 The executed instructions are disassembled and displayed The contents of the registers after instruction execution 4 R 09000020 indicates that data H 9000020 was read from memory by the instruction 5 W 00000000 indicates that data H O was written to memory by the instruction 40 3 3 14 Symbol Display The following co
35. from address H 1000 to address H 1020 G 1000 1020 RET Exec Instructions 30 PC 00001020 SR O00000000 HH KH OO RR RR SP 05000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 O000FFFF 00000000 00000000 01000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000010 00000000 O000FFFF 00000000 00000000 05000000 0000101E MOV L RO R4 BREAK POINT 109 HELP 5 21 HELP Displays command name and input format HE Format HELP lt command name gt RET Parameter e lt command name gt Specifies the name of the command for which the help message is to be displayed Function Displays the help message for the specified command Description e When a command name is specified the help message for the specified command is displayed e When the command name is omitted a table of commands is displayed 110 HELP Examples 1 To display a table of commands HE RET Assemble Break_Register Break_Access Break_Data Break Break_Sequence CALL Command_Chain CoMPare ConVert COVerage Data_Search Debug_Level DisAssemble Display_CHaracters Display_CoVerage Dump Exec_Mode Fill Go HElp Load Load_Status MAcro MaP Memory MoVe Print Quit RadiX Register ReSet SaVe Save_Status SCoPe Set CoVerage SHow_Calls Step Step_Into StuB SYmbol Trace Trace_Condition Trap_Address TYpe Vector lt register gt 2 To display the syntax of the
36. from the coverage address ranges SCV 1000 RET 149 SHOW_CALLS 5 37 SHOW_CALLS Displays function call SHC Format SHOW_CALLS lt display count gt RET Parameter e lt display count gt Specifies the number of function calls displayed When omitted all function calls are displayed Function Displays the functions called up to arrival at the current address Description 1 Functions are displayed in the reverse order from the order called 2 The display includes the file function and line number of the call and the arguments 3 When the specified display count exceeds the actual function call depth the number of function calls displayed is the actual function call depth 4 The following is displayed when there is no debugging information or when the function was written in assembler e The file function line number and address are displayed e Arguments A is displayed 150 SHOW_CALLS Examples 1 To display the last 3 function calls SHC 3 RET Sfile c func_d 2002 func_e 1 3 0 Sfile c func_c 1004 func_d file c func_h 777 func_c 2 2 To display all functions called up to the current function SHC RET Sfile c func_d 2002 func_e 1 3 0 Sfile c func_c 1004 func_d file c func_hb 777 func_c 2 file c func_a 307 func_b 0 10 1024 file c main 32 func_a 151 STEP
37. it is executed as a slot instruction and when it is executed as a normal instruction 172 TRAP_ADDRESS lt System Call Functions gt The simulator debugger provides functions to simulate system calls to the host system by the debugging object program The table below lists the host system calls that can be used by a debugging object program Table 5 1 System Call Functions Item Function code Function Description 1 1 H 21 GETC Inputs one character from standard input 1 2 H 22 PUTC Outputs one character to standard output 1 3 H 23 GETS Inputs a line of characters from standard input 1 4 H 24 PUTS Outputs a line of characters to standard output 2 1 H 25 FOPEN Opens a file 2 2 H 26 FCLOSE Closes a file 2 3 H 27 FGETC Inputs one byte from a file 2 4 H 28 FPUTC Outputs one byte to a file 2 5 H 29 FGETS Inputs a line from a file 2 6 H 2A FPUTS Outputs a line to a file 2 7 HOB FEOF Checks for end of file 2 8 H 0C FSEEK Moves the file pointer 2 9 H 0D FTELL Returns the current position of the file pointer 173 TRAP_ADDRESS 1 1 Standard I O These functions perform I O from standard I O Character input from standard I O during COMMAND_CHAIN execution is taken from the command file GETC lt Function gt Inputs one character from standard input lt Function code gt H 21 lt Parameter block gt MSB 0 15 0 2 lt Example gt To inpu
38. macro name gt RET is entered the simulator debugger displays a prompt 0001 gt indicating macro definition in progress and waits for input of the macro body The macro body can include multiple simulator debugger commands macro commands and macro internal commands Furthermore 0 to 9 can be used as dummy arguments inside a macro body The dummy arguments are replaced with the actual parameters specified when the macro is called Use the strings 0 to 9 to represent 0 to 9 in character stings or in command line option character strings in BREAK BREAK_ACCESS BREAK DATA BREAK REGISTER or BREAK SEQUENCE command lines Note that no command line syntax checking is performed during macro definition Error checking is performed during macro command execution Macro command definition is terminated by entering RET at nesting depth 0 The definition state of the specified macro command is displayed If the macro name is omitted all the currently defined macro names are displayed When a macro name is specified the macro body i e the contents of the macro definition of the specified macro command is displayed The specified macro command is executed Processing is terminated if an error occurs in the macro command or if the user performs a manual break with CTRL C Although a macro command with the same name as a simulator debugger command takes precedence over the simulator debugger command the simu
39. only the specified address e Options Access type R W RW R read Break on a read from the specified memory W write Break on a write to the specified memory RW read write Break on either a read or a write default Enable disable E D E enable Enables previously set break conditions D disable Disables previously set break conditions e lt command line gt Specifies a command line to be executed when the break occurs To indicate a double quotation mark in a character string insert two double quotation marks in sequence Function This command sets displays and cancels breakpoints based on access to a specified memory address or range 66 BREAK_ACCESS Instruction execution stops when the break condition access of the specified type to the specified memory area is satisfied during program execution due to a CALL GO STEP STEP_INTO or VECTOR command Description Set Sets a breakpoint so that program execution stops on an access of the specified Enable disable Display Cancellation Note type to the specified memory range Up to two memory ranges can be specified Note that breakpoints are automatically enabled when a breakpoint is set Allows breaking to be enabled or disabled without changing the breakpoint settings Displays the breakpoints set with the BREAK_ACCESS command Cancels clears the breakpoints set with the BREAK_ACCESS command If no addresses
40. opened Specify the correct file name 3006 CAN NOT OPEN CPU INFORMATION FILE The CPU information file could not be opened Specify the correct directory and file name 3007 CAN NOT OPEN OBJECT FILE The debugging object program file could not be opened Specify the correct file name 3008 CAN NOT READ A file could not be read Check the contents of the file 3009 COMMAND LINE SYNTAX ERROR There was an error in the command line 237 Table F 3 Error Messages during Startup or Load Command Execution cont Error No Message Error Description and Recovery Procedure 3010 DEVICE TYPE IS NOT CONSISTENT The debugging object program file identifying information the ID that indicates whether the program is for the SH series does not agree with the file identifying information from the CPU information file set by the CIA program Check that the object program is actually an SH series program 3011 ILLEGAL BLOCK TYPE The debugging object program contains one or more errors Correct any errors that occurred in creating the debugging object program 3012 INTERNAL ERROR nnn An internal error occurred Contact your Hitachi Ltd sales representative 3013 INVALID CPU INFORMATION There was an error in the CPU information file Check and correct the CPU information file 3014 INVALID OBJECT FORMAT The input file exceeds the range of debug
41. protect attribute 3 The program attempted to read from a memory area that has the read protect attribute 4 An attempt was made to access an area with no memory Either modify the memory allocation and attributes or correct the debugging object program so that the corresponding memory access error does not occur 5007 INVALID SP INSTRUCTION The program executed the instruction to make R15 SP to point to an address other than 4 byte boundary Correct the debugging object program so that the error does not occur 5008 SYSTEM CALL ERROR A system call error occurred Correct the error s in the contents of the parameter block and or registers RO and R1 246 F 3 CIA Error Messages F 3 1 I O Related Error Messages Table F 6 shows the CIA error messages related to I O Table F 6 I O Related Error Messages Error No Message Error Description and Recovery Procedure 6001 CAN NOT GET MEMORY SPACE The memory for CIA use could not be allocated Check the OS environment and assure that there is adequate memory allocated for CIA use 6002 CAN NOT OPEN INPUT CPU The specified existent CPU information file could INFORMATION FILE not be opened See note 6003 CAN NOT OPEN OUTPUT CPU The specified output CPU information file could INFORMATION FILE not be opened See note 6004 CAN NOT READ A file could not be read See note 6005 CAN NOT WRITE Write to a file failed See note 6006
42. sequence of commands or macro internal commands to be executed when the condition is true Function The DO WHILE loop first executes the macro body and then evaluates the lt expression gt If that value is any value other than zero the macro body is executed again 123 MACRO The macro body is iterated until the lt expression gt evaluates to zero If the value of lt expression gt is zero initially the macro body is executed exactly once Multiple simulator debugger commands or macro internal commands can be included in the lt macro body gt Examples To display the fifth to tenth elements in array ABC NUM 5 DO TYPE ABC NUM 1 NUM NUM 1 WHILE NUM lt 10 4 IF Format IF lt expression gt lt macro body 1 gt ELSE lt macro body 2 gt Parameters e lt expression gt The lt expression gt parameter expresses the condition for execution of lt macro body 1 gt selectively e lt macro body 1 gt The lt macro body 1 gt parameter expresses the sequence of commands or macro internal commands to be executed when the condition is true 124 MACRO e lt macro body 2 gt The lt macro body 2 gt parameter expresses the sequence of commands or macro internal commands to be executed when the condition is false Function The lt expression gt is executed evaluated and if its value is any value other than zero the lt macro body 1 gt is When
43. simulator debugger performs processing identical to that for the input of a STEP_INTO RET command line if a RET is input following the completion of STEP_INTO command execution 154 STEP_INTO Notes If a delayed branch instruction is executed during STEP_INTO command execution execution stops at the end of the instruction following the delayed branch instruction Examples 1 To execute one instruction and then display the mnemonic of the executed instruction and the contents of the registers following the instruction execution SI R RET PC 00000404 SR 00000000 XAKKAKKKAKK KKK KKK KK FH SP 0FE00000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 0000002 00000000 00000000 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0FE00000 00000402 MOV L 0000002E R1 2 To execute three instructions SI 3 RET 00000404 MOV L 0000002E R4 00000406 MOV L FFFFFFFF R3 00000408 ADD L R1 R2 STEP NORMAL END 155 STUB 5 40 STUB Executes command during simulation SB Format Set STUB lt stub start address gt lt return address gt RET Display STUB lt stub start address gt RET Delete STUB lt stub start address gt RET Parameters e lt stub start address gt Specifies the address in the debugging object progra
44. space when the simulator debugger is terminated during COVERAGE command execution i e coverage has not been terminated with a COVERAGE command the following message will be displayed Coverage data could not be saved In such a case check the program execution environment and save the coverage data once again Example To terminate simulator debugger processing O RET 140 RADIX 5 30 RADIX Sets the radix RX Format Set RADIX B O D H RET Display RADIX RET Parameter e Options Radix B Q D H B Q D H Sets the radix to binary Sets the radix to octal Sets the radix to decimal Sets the radix to hexadecimal The radix is set to hexadecimal when the simulator debugger is first invoked Function Specifies the radix for command parameter input Displays the state of the radix setting Examples 1 To display the current radix RX RET Hexadecimal 2 To change the radix to decimal RX D RET RX RET Decimal 141 REGISTER 531 REGISTER Displays register contents R Format REGISTER RET Function Displays the contents of the general registers RO R15 the control registers SR GBR VBR and system registers MACH MACL PR PC Description 1 The same value is displayed for the SP and R15 2 The SR is displayed first as a value and then as the states of each b
45. stops Description 1 Execution is interrupted when either a condition set by a break command is satisfied or when an error occurs However if the D option is specified execution is not interrupted on the satisfaction of a break condition 107 Do 2 When execution is interrupted the instruction execution count in decimal the current register values a disassembled display of the last instruction executed and a confirmation message are displayed 3 If the E option has been specified with the TRACE_CONDITION command the execution history is written to the trace buffer Notes 1 Ifa break address is specified at a point that is not the start address of an instruction the break will not be detected 2 Ifa break address is specified at an instruction following a delayed branch instruction execution stops at the start address of the delayed branch instruction Examples 1 To execute the debugging object program continuously while temporarily ignoring the currently specified break conditions 3 GD RET Exec Instructions 159 PC 00000402 SR 00000000 eR KKK KKK KK KK KK KK KK KK SP 05000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 05000000 00000400 SLEEP SLEEP 108 Do To execute the debugging object program
46. the register size is used as default Data size B W L B byte Byte data W word Word data L long Long word data lt mask gt Only the bits for which the mask is one will be compared When omitted all bits are compared Options Data match differ EQ NE EQ equal Break when the data matches default NE not equal Break when the data differs Enable disable E D E enable Enables previously set break conditions default D disable Disables previously set break conditions 73 BREAK_REGISTER e lt command line gt Specifies a command line to be executed when the break occurs To indicate a double quotation mark in a character string insert two double quotation marks in sequence Function This command sets displays and cancels breakpoints based on data written to the CPU registers Instruction execution stops when the break condition data written to the specified register matches the specified value is satisfied during program execution due to a CALL GO STEP STEP_INTO or VECTOR command When the data value in the BREAK_REGISTER command is omitted the simulator debugger stops execution on any write regardless of the data value to the specified register Description Set Enable disable Display Cancellation Notes The command sets a break condition so that execution stops when the specified register is accessed Note that breakpoints are
47. to display the contents of the registers are specified Note that STUB gt is the prompt used by the STUB command Indicates completion of the setting Confirms the setting The stub execution start address The simulation return address The symbol corresponding to the start address and its line number The symbol corresponding to the return address and its line number 0 JO Uds 0 3 3 16 Coverage Range Display The following command displays the coverage range When no coverage range has been set the code sections of the debugging object program are used as the default value SET_COVERAGE RET coverage area 08000400 08000D83 Notes 1 The starting address for coverage data acquisition 2 The terminating address for coverage data acquisition 3 3 17 Starting Coverage Data Acquisition The following command starts the acquisition of coverage data Since no coverage file is specified the file temp cov is used COVERAGE RET coverage area 08000400 08000D83 42 3 3 18 Setting and Executing Sequential Breakpoints The following command sets a breakpoint so that execution will stop when the debugging object program passes through the 3 specified locations BREAK SEQUENCE 80004BA 80009E8 8000566 RET 1 BREAK SEQUENCE RET 2 st BREAKPOINT 080004BA Ssample c Print_rec 78 2nd BREAKPOINT 080009E8 Ssample c Bin_ascii 217 3rd BREAKPOINT 080
48. when the simulator debugger detects an abnormality simulation error in the debugging object program The simulator debugger execution mode is set to S when first invoked Function This command selects whether execution will continue or stop when an abnormality is detected during debugging object program execution When the execution mode specifier is omitted the current setting of the execution mode is displayed Refer to section 2 11 2 Break due to detection of an execution time error in the debugging object program for more information on abnormalities occurring while executing the debugging object program Description Set Stop mode is recommended for the early stages of debugging with continue mode being useful in the later stages Display STOP is displayed in stop mode and CONTINUE in continue mode 104 EXEC_MODE Examples 1 To set the execution mode to continue mode EM C RET 2 To display the current execution mode EXEC_MODE CONTINUI T E 105 FILL 5 19 FILL Initializes memory area Format Fill lt start address gt lt end address gt lt data item count gt lt initialization data gt lt size gt RET Parameters e lt start address gt lt end address gt lt data item count gt Specifies the range of addresses to be initialized e lt initialization data gt Specifies the data va
49. witdth 32 bits Mode 2 Mode 7 Extended mode with ROM PROM mode H 0x00000 Vect H 0x00000 Vect H 0x003FF eee H 0x003FF le External bus area csO Internal ROM area Bus width 32 bits Bus width 32 bits H 1x00000 H 1x00000 External bus area cs1 cs4 Bus width 8 bits 5590000 Internal I O area HSx00000 Internal I O area Bus width 8 16 bits Bus width 8 16 bits H 6x00000 External bus area H 6x00000 cs6 and cs7 Bus width 8 16 bits H 8x00000 H 8x00000 Internal bus area Internal ROM area Bus width 32 bits Bus width 32 bits H 9x00000 H 9x00000 External bus area cst cs6 Bus width 16 bits H Fx00000 H Fx00000 5 Internal RAM area i Internal RAM area Bus witdth 32 bits Bus witdth 32 bits H FxFFFFF H FxFFFFF Notes 1 The example in section 1 4 1 CPU Information File Creation Program uses mode 0 extended mode without ROM PON 217 The example in section 1 4 2 CPU Information File Creation Program uses mode 2 extended mode with ROM In the SH series external bus spaces do not coexist with the same csn chip select pins Two internal ROM areas exist in modes 2 and 7 are actually the same area in the SH series sallas HS au ul Bale aues ay Ajjenjoe ale pue z sepoul ul SI
50. x3 ease sng eula x3 ease snq eula x3 00000X1 H 00000 L H 00000X1 H 00000 L H suq ze y1pIm sng sq ze y1pIm sng sq 91 yypIM sng sq 8 4 pim sng vale NOY Iua oso eale snq eula x3 0s9 eae sng eula x3 oso eaie sng eula xy3 Pale J0J99A 33 00X0 H Pale 1009A 33 00X0 H gae J0J99A 33 00x0 H Pale J0J99A 33 00X0 H 00000X0 H 00000X0 H 00000X0 H 00000X0 H epow WOud Z epow NOH UM epow papus x3 z Spon WOH oyym pow papus x3 L Spo moy moyym apow papuajx3 0 spol dey 10uraJA 000LHS T O AQEL 218 Appendix D Sample Programs EEE RA A IA A A A AA A A I f FILE NAME IS sample c KK AEKk kkk kkk k kkk kkk kkk kk kkk kkk kkk kkk kk kkk f include stdio h struct recctl 4 short rec_it short rec_ln short rec_no Struct rec ctl rec_ nx y short Print_rec void void Read_rec void void Bin_ascii char p void Ph_read char bp A ee ee E ee ASSEMBLER I O SIMULATION SUBROUTINES So eee e en eB E i es ee ee ee ee ea extern short F_open char name char mode short f_id extern short F_close short f_id extern short Read char p extern void Write char p extern short F_read short f_id char p struct rec_ctl rec_v0 1000 short stop_f phg_pos phg_lng rec_num nxt_f l_rec_no char log_rec 512 phg_rec 1024 char I buk 30 AR esses SSeS n char f_name 80 short f idy shor
51. 0 for wi short 0 wi lt short 16 asc_buf wi char 0x20 hx_p amp hex_buf 0 put_pos short 0 Set 1 byte data Hex dump and ASCII image 1_char char log_rec rec_pos gt gt 4 r_char char log_rec rec_pos amp char 0x0f HEX dump sr rrr Bin_ascii amp l_char Bin_ascii amp r_char hx_ptt 1_char hx_ptt r_char if put_pos 4 3 space gap for 4 bytes 1 hx_p AS Calas NEG A eo A SS if log_rec rec_pos gt 0x7f log_rec rec_pos lt 0x1f asc_buf put_pos chart else asc_buf put_pos log_rec rec_pos pointer increment and counter decrement put_pos rec_pos rec_lng H Bimal print 15225232529 a Se ee hex_buf 36 chart 0x00 asc_buf 16 chart 0x0a asc_buf 17 chart 0x00 Write hex_buf Write yy Write asc_buf Increment the record number for next read 1_rec_no rtncd short 0 h Il r h Il 221 a El El El ES he void sh Le if es ph if es wi wh ya if ek me void char if turn rtncd Name Read_rec Read 1 logical record Func Read 1 logical from physical record buffer Read_rec ort wi Initial record reading check 2 2 2 5 2 s phg_pos 1 Ph_read phg_rec First 256 byte
52. 0000 00000000 00000000 00000000 00000000 080040E MOV L 0000004C PC R2 PC 08000A78 SR O0000000 eRe RAK KKK KKK KK KK KK RR SP 0FFFFFF8 GBR 00000000 VBR 000000000 MACH 00000000 MACL 00000000 PR 08000414 RO 7 00000000 090035AC 08000A78 08000CB8 09003554 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 08000410 JSR R2 PC 08000A78 SR O00000000 kx RRA KKK KK KK KK KK RK KK SP 0FFFFFF8 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 08000414 RO 7 00000000 090035AC 08000A78 08000CB8 09003554 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 08000412 NOP STEP NORMAL END 38 00000000 OFFFFFF8 00000000 OFFFFFE8 00000000 OFFFFFF8 00000000 OFFFFFF8 3 3 12 Single Subroutine Execution The following command executes 7 instructions starting at the current program counter H 8000406 Each subroutine call is executed as a single step STEP 7 RET 08000406 MOV L 0000004C PC R3 08000408 JSR R3 0800040A NOP 0800040C MOV L 00000048 PC R4 0800040E OV L 0000004C PC R2 08000410 JSR R2 08000412 NOP T STEP NORMAL END Note 1 Indicates that a subroutine was executed within the specified range 39 3 3 13 Trace Buffer Display The following command displays the contents of the trace buffer TRACE 17 3 A RET 1 08000400 MOV L R8 R15 2 PC 08000402 SR 00000000 e
53. 0000 0000002E 00000000 0000000A 00000001 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 FFFFFFF8 00000404 ADD L 00000001 R4 PC 00000406 SR00000 000 AAAAAAAAAAAAAAAARARA RAS R SP FFFFFF8 w 00000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 0000002E 00000000 0000000A 00000001 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 FFFFFFF8 166 TRACE_CONDITION 5 43 TRACE_CONDITION TC Sets trace condition and starts or stops trace 167 TRACE_CONDITION Format Start TRACE CONDITION I S E CIB RET Stop TRACE_CONDITION D RET Parameter e Options Instruction type I S I instruction All instructions are recorded in the trace buffer default S subroutine Only subroutine calling instructions BSR and JSR are recorded in the trace buffer The I setting is assumed when this option is omitted Trace start stop E D E enable Starts recording to the trace buffer default D disable Turns off recording to the trace buffer The E setting is assumed when this option is omitted Trace buffer full handling C B C continue Overwrites the previous contents of the trace buffer after the trace buffer overflows B break Interrupts program execution when the trace buffer overflows The C setting is as
54. 00566 Ssample c Print_rec 87 3 4 5 lt COMMAND_LINE gt E RET GO ENTRY sample c Print_rec 7 Notes 1 0 OA nN oO BW NY PC 08000566 SR 00000000 xe HHH KH HK HH KH RR RR SP 0FFFFE40 E GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 08000566 RO 7 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFHAG ssample c 225 BREAK SEQUENCE PC 0800055E SR 0000 0000 AAA AAA AH RARA AR AREA RAIS SO SS SP 0FFFFE40 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 0800055E 8 RO 7 00000000 OFFFFE44 08000030 OFFFFE45 OFFFFE45 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFE40 Exec instructions 156 00000000 OFFFFE44 08000030 OFFFFE44 OFFFFE44 00000000 00000000 00000000 This command instructs the simulator debugger to stop at location H 8000566 the last location when the 3 locations H 80004BA H 80009E8 and H 8000566 are passed in sequence This command displays the sequential breakpoint settings Indicates the setting order The breakpoint address The symbol corresponding to the breakpoint address Command to be executed when the program execution stops at the breakpoint The output for confirming passage through the point set by the STUB command Register display set by the STUB command At this point the sequential break conditions are satisfied and execution stops 43 3 3 19 Coverage
55. 040C SR 00000000 FAR KKK KK RR KK RR SP 0FFFFFF8 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 0800040C RO 7 00000000 090035AC 00000000 08000CB8 09000020 00000000 00000000 ECO et Oe R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFHEFS8 08000ACE LDS L R15 PR BREAK POINT 3 Notes 1 The number of instructions executed 2 The contents of the registers at the point when the program stopped 3 Indicates that the program has stopped at a breakpoint 3 3 11 Single Step Execution After the program has stopped at the breakpoint H 800040C the following command executes 3 instructions one at atime At each step the executed instruction is displayed In this example the instruction following the delayed branch instruction is also executed because the third instruction is a delayed branch instruction 37 STEP_INTO 3 R RET PC 0800040E SR 00000000 PIO RR KK SP 0FFFFFF8 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 0800040C RO 7 00000000 090035AC 00000000 08000CB8 09003554 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Ssample c 38 Read f_name 0800040C MOV L 00000048 PC R4 PC 08000410 SR O00000000 RRA KKK KK RK KK KK KKK KK SP 0FFFFFF8 GBR 00000000 VBR 000000000 MACH 00000000 MACL 00000000 PR 0800040C RO 7 00000000 090035AC 08000A78 08000CB8 09003554 00000000 00000000 R8 15 00000000 00000000 0000
56. 14 R2 00000014 CMP GE L R2 R3 T 00000016 BF 00000404A e The disassembled source program corresponding machine code are displayed e COandCl are displayed e An indicator mark is inserted to the left of the disassembled machine code e Indicator interpretations asterisk Accessed and executed T The true branch was taken F The false branch was taken TF Both branches have been taken period Not executed 100 DISPLAY _COVERAGE 4 To display the coverage option with specifying the N option DCV 0 N1 RET F 0000002C main 009 This example is coverage data for a C program e There are two N options NO and N1 NO displays the line numbers for addresses not executed under CO and N1 displays the line numbers for addresses not executed under Cl e An indicator mark is inserted at column 1 for the C1 display e Indicator interpretations T The true branch was taken F The false branch was taken Not executed 101 DUMP 517 DUMP Displays memory contents Format DUMP lt start address gt lt end address gt lt item count gt 7 B W L S D RET Parameters e lt start address gt lt end address gt lt item count gt Specifies the range of memory to be displayed e Options Data size B W L S D B byte Byte data default w word Word data L long Long word data S single precision Si
57. 56 Ssample c 206 phg_pos 256 Ssample c ZOPE rec_num ssample c Z 09 fsample c 214 void Bin_ascii p i 2 3 Notes 1 The file name and line number of the source code 2 Indicates the coverage information symbolically e Asterisk Indicates that this address was accessed and executed e Period Indicates that this line was not executed e Space A Indicates that there is no machine language corresponding to this line 3 Displays the source code in the coverage range 45 46 Section 4 Simulator Debugger Invocation and Command Input 4 1 Invoking the Simulator Debugger The following command invokes the simulator debugger ssdsh lt debugging object program file name gt di 2 com lt command file name gt cpu lt CPU information file name gt 4 stat lt simulator state file name gt RET 5 Notes 1 sdsh is the command name of the simulator debugger installed on the host computer 2 The file name of the debugging object program loaded when the simulator debugger starts When the file extension is omitted abs is used as the default 3 When the com command line option is specified the simulator debugger reads a command from the file whose name is specified following the equal sign and executes it 4 When the cpu command line option is specified the simulator debugger creates a memory map from the information stored in the CPU information file w
58. 8 COMMAND_CHA N Executes commands from a file ooooncmmminin 83 5 9 COMPARE cococcccconconocnncnnocnnos Compares memory contents oocooccnocnnoconnnonnnonnnaninnncnos 5 10 CONVERT 0 eee Calculates expression cece eeceseeesceseeeeceeeeeeeeseeees 5 11 COVERAGE ue Starts and stops coverage measurement 5 12 DATA_SEARCH 0000 Searches for data ooooccnnononccnnconnnnnnononinonanononinonananonos 5 13 DEBUG_LEVEL 0 Specifies debug level oooononionnnnnicnioniccononoconcnncnncnnnnos 5 14 DISASSEMBLE Disassembles and displays memory contents 5 15 DISPLAY_CHARACTERS Displays character string cooooncnnnnnncnnnnnonnnoncnncinncnnnonoos 5 16 DISPLAY_COVERAGE Displays coverage data oooooccnicnnocnonncononnninncrononnconocnnos SAT DUMP tula Displays memory CONteNtS ococococccocnocnncnnonnnannnancnnnonos 5 18 EXEC MODE ereen Switches execution MOdE oooooococoocncnccococoniconinnnnanananone 19 FILE pesca Initializes Memory ALCA oococooccnocnnoncconnnonnnconononnncnnncnnnos 520 LO iia its Executes instructions continuously eee 3 21 HELP cuca Displays command name and input format 5 22 LOAD tr Loads le mistico bin Mesias atts 5 23 LOAD_STATUS Restores simulator debugger memory and register Slate saint aie Ee ea 5 24 MACRO arahina pnis Defines displays executes and deletes simulator debugger command MacroS oococcnccconconccnnos S29
59. 80200080 00800080 00008080 80808080 80008080 00000000 00000000 0000005F 842B2039 31303830 36313432 35343200 01003031 30300810 10000000 00000470 726F6706 48382F33 3030D886 25400001 00000003 0470726F 6708415F 48382F33 30303931 30383036 31343235 34320000 Figure 3 1 Input File Example input obj This program consists of 5 modules e main Handles loop control of the initialization reading editing and display operations e Print rec Reads edits and displays data Read rec Reads a single record Bin ascii Converts binary data to ASCII e Ph read Inputs data by calling an assembly language routine Note that when executing the sample program an assembly language routine must be written to allow binary data to be read into a C source file 29 3 2 Procedure for Creating the Debugging Object Program This section describes the procedure for creating the debugging object program 1 Source Program Creation The C source program to be debugged is created with a text editor Here we assume that the file containing this C source program is sample c and that the assembler source program file is prog src 2 Object Module Creation The object module is created by compiling the C source program with the SH series C compiler Specify the DEBUG and OPTIMIZE options when compiling the sample program shc sample c debug optimize 0 RET T 2 3 4 Notes 1 shc is the SH series C compiler co
60. CII and other variables are displayed in decimal However a period is displayed for character variables with values that cannot be displayed 197 lt register gt Examples 1 To display the value of the variable abc in hexadecimal TY abc H RET abc 100F 2 To display the value of the variable xyz Since the display format specifier is omitted the value is displayed in decimal TY xyz RET xyz 14770 3 To display the value of the static variable efg TY file c lefg RET file c efg 32768 198 a 548 Invokes sub process Format VECTOR lt vector number gt RET Parameters e lt vector number gt Specifies the interrupt vector number Function Generates the vector address from the vector number and starts exception processing from the contents of the vector address 1 The current PC and SR are saved on the stack 2 The vector address is generated from the vector number and exception processing is initiated from the contents of the vector address Description 1 This command is used to test the operation of exception handlers when exceptions occur 2 The terminating conditions are the same as those for the GO STEP and STEP_INTO CALL commands 3 H O to H FF can be specified as the vector number Notes 1 When the content of the vector area memory address is H O execution halts after steps 1 and 2 2 There are
61. CTOR e Return value outpu t 0 Normal termination 1 Error e File number input The value returned when the file was opened e Offset output The current position of the file pointer as a byte count from the start of the file lt Example gt To determine the current position of the file pointer in the file sample src IMPORT FNUM MOV L PA MOV L RE OV L CA MOV L FN OV B CR MOV L PA ADD L 0 MOV B R4 JSR ER NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L REQ_COD DATA L PAR_ADR DATA L FENUM_ADR DATA L PARM FTELL_BUF RES B RES W RES W END R_ADR R1 Q_COD RO LL_ADR R3 UM_ADR R2 2 R4 R_ADR R2 1 R2 R2 3 SYS_CALL H 010D0000 PARM FNUM Ne N 196 lt register gt 5 47 lt register gt Modifies register content Format TYPE lt variable gt B QID H A Parameters e lt variable gt RET Specifies the variable whose value is to be displayed e Options Display format specifier B Q D H A B Pm 010 Function Display in binary Display in octal Display in decimal Display in hexadecimal Display as an ASCII character Displays the value of the specified variable in the specified format When the display format specification is omitted pointer variables are displayed in hexadecimal character variables are displayed in AS
62. EE SEN 24 2 13 Macro Command Combination cccccccsccesscessnseceseeceseseecesecceecseeeeseseeecseseeessneecsenaes 24 2 14 Command Chains and Saving Execution Results to a Fil8 ononninnnnninnnnnninncnnnnnncnnnonnos 25 2 15 Saving Input Commands to a File esseseesessseseseeerseeerrrrsseeresreresrerestenterrsserreserrsreersrenen 26 2 16 SOS 26 2161 Stub Funct OM 4 8 tees ase con ciento ee e aeaaaee E KSEE E ates dados 26 2 16 2 Coverage Measurement svc csssssesjsesesssssissagbecsecan ag caeescesyecheas sbedatesssaceuspeeesesscan apes 26 Section3 Using the Simulator Debugger ooonocccnnncccooncccnoncnononcnonananonnnccnnnnoss 29 3 1 Sample Program Description ee ee eeecceeeeeceseeeeceseecaeceaecaeceacesecaeeseceeseeseeseeseneeegs 29 3 2 Procedure for Creating the Debugging Object PrograM ooconconocnconnonnncncnannnnnnncnancnnnonos 30 3 3 Simulator Debugger Usage Example ooooonncninnnicnincnonncononnconncnnncnncnnoco nono cnn nnnc cnn cnnncnncnnos 31 3 3 1 Creating the CPU Information File ononcncnnnnicconnnnncnnnnononnnononncnncononnonorononnonoos 31 3 3 2 Loading the Program r a a e E E EART E nana rn EON 32 3 3 3 Memory Map Display and Memory Allocation ooconcononnonnnonnnononnnonacnnnnancnncnnos 33 3 3 4 Displaying Section Load Address and Allocating Memory Areas 0 00 34 3 3 3 Disassembly Display viii iii EEKE 35 3 3 6 Checking Memory Contents 00 0 eee ec eseesceseecsecneecseceseesecssee
63. H 6000000 1 H 700000 Notes 1 Since section B would cross the boundary between external bus areas 1 and 2 if it was loaded following section A it is loaded from the start address of external bus area 2 i e address H 1000000 Similarly section C is loaded from the start address of external bus area 3 i e address H 6000000 so that it does not cross the boundary between external bus areas 2 and 3 Relocatable sections cannot be loaded to the internal I O area 2 Regions allocated when the simulator debugger is started up Figure 2 1 Relocatable Section Load Map 2 Absolute Address Sections Absolute address sections are loaded at the specified address A load error is generated if the absolute address section crosses any of the boundaries between the internal ROM area the external bus area the internal RAM area and the internal I O area This makes it possible to verify that absolute address sections are correctly loaded into the appropriate memory area An error occurs if the load address of either a relocatable section or an absolute section exceeds the 10 CPU addressing range A load error also occurs if an attempt is made to load a program into an invalid memory area an area which does not correspond to the actual memory which the user specified Relocatable sections cannot be loaded to the internal I O area 2 4 Setting Register Initial Values Displaying and Changing Register Values The simulator debugger
64. H EF00000 to H FOFFFFF an error occurs since the memory type changes at address H F000000 The following measures can be used to avoid the above errors Process 1 Review the starting addresses of absolute sections and the section sizes and modify the program so that overlaps do not occur 2 Code programs so that sections with the same name have the same attribute 3 Specify modules that have actual contents 4 Modify the start addresses of absolute section so that section allocation across memory boundaries does not occur Alternatively modify the memory map specified in the CPU information file so that sections to not cross memory area boundaries 234 Appendix F Messages The simulator debugger outputs the following two types of message 1 Information messages These messages inform the user of the simulator debugger execution process 2 Error messages These messages inform the user that an error has occurred F 1 Information Messages F 1 1 Information Messages at Instruction Execution Interruption Table F 1 lists the messages that are displayed when execution is interrupted during instruction execution initiated by a GO STEP STEP_INTO VECTOR or CALL command Table F 1 Information Messages at Instruction Execution Interruption Error No Message Description 1001 BREAK ACCESS Execution was interrupted due to the occurrence lt first location gt lt last location gt of a break acces
65. HELP command HE HELP RET HE HELP command name 111 LOAD 5 22 LOAD Loads file L Format LOAD lt file name gt lt load address gt fOD O M U RET Parameters e lt file name gt Specifies the name of the file to be loaded When the file format is omitted from the file name abs is supplied for debugging object programs and dat is supplied for memory image files e lt load address gt Specifies the address to which the file is loaded If a load position is specified for an absolute load module the specification will be ignored When omitted relocatable load modules will be loaded at H 400 Absolute load modules will be loaded at their load address Memory image files are loaded starting at address H O e Options File format specifier OD O M OD object and debug information Both the machine language and the debugging information are loaded default O object Only the machine language is loaded M memory image file A memory image file is loaded Undefined symbol allocation U U undefined Addresses are allocated for undefined symbols Function This command loads debugging object programs and memory image files including files created with the SAVE command When a memory image file is loaded the load start and end addresses are displayed after loading When the U option is specified a 4 byte area is allocated for each u
66. ISTEP macro command ISTEP 10 RET The value 10 is passed as the parameter STEP To delete the ISTEP macro command MA ISTEP RET Macro Internal Variables Format lt variable name gt Description 1 Variables can be used within macro commands 2 The first character must be Y the second character must be alphabetic and the remaining characters must be alphanumeric 3 The variable name including the must be at least 2 characters and no more than 32 characters in length 4 Variables represent 32 bit unsigned quantities 5 Since macro variables are inherited when a macro call is nested inside a macro definition variables of the same name within both macros are treated as the same variable i e as a global variable 6 Variables can be assigned values using the assignment operator The assignment operator is an operator that can only be used inside a macro body and has the following syntax lt variable gt lt expression gt 119 MACRO The names and usage of pre defined macro internal variables are described below These variables are reference only variables and thus their values cannot be changed by the user SIMSTAT Indicates the simulator stop factor When one of the bits shown in figure 5 2 is 1 the simulator debugger has stopped for the corresponding reason and when a bit is 0 that factor is not the cause of the stop 31 Es BREAK or BREAK_SEQUE
67. Information Display This section lists the coverage information for each of the command options 1 T Option Specification This option displays the CO and C1 coverage values DEBUG_LEVEL S RET 1 DISPLAY COVERAGE Read_rec 14 T RET 2 CO 44 0 3 C1 50 0 4 Notes 1 This command sets the debug level to source code line units 2 This command sets symbol Read_rec as the coverage start address Coverage is performed for 20 lines from the start address The CO coverage value 4 The Cl coverage value 44 2 G Option Specification The G option displays CO coverage over a wide range DISPLAY _COVERAGE Read_rec 14 G RET ssample c 72 void Read_rec Ssample c TIL if phg_pos 1 Ssample c TOR Ph_read phg_rec First 256 bytes Ssample c 80 Ph_read phg_rec 256 First spare 256 bytes ssample c oi s phg_pos short 0 Index initialize Ssample c 82 rec_num short 0 Physical record number initialize ssample c 85 8 phg_lng phg_rec phg_pos 1 sample c 86 if phg_lng lt 0 ssample c aos phg_lng 256 Adjust to unsigned char ssample c oi wi short 0 Ssample c GA while wi lt phg_lng Ssample c 94 log_rec wi phg_rec phg_pos Ssample c or if phg_pos gt 255 Ssample c 200 for wi short 0 wi lt short 256 witt Ssample c 202 phg_rec wi phg_rec wi 256 Ssample c 205 Ph_read amp phg_rec 2
68. LL GO STEP STEP_INTO or VECTOR command Description Set Sets a break condition so that execution stops at the last specified address when the Display Cancellation instructions at the specified addresses have been executed in the specified order Note that a sequence of up to 8 addresses can be specified with this command Displays the breakpoints set with the BREAK_SEQUENCE command Cancels clears the breakpoints set with the BREAK_SEQUENCE command 77 BREAK_SEQUENCE Notes 1 If a breakpoint is set at any address other than the first byte of an instruction the break will not be detected The execution sequence condition is reset at the point that instruction execution is stopped Tf the instruction following a delayed branch instruction is specified as the last instruction address execution stops at the start address of the delayed branch instruction If conditions specified with the BREAK and BREAK_SEQUENCE commands are satisfied simultaneously the command line specified with the BREAK command is executed first Examples 1 To set a sequential breakpoint for addresses H 2000 H 2100 and H 3000 and to execute the REGISTER command after break BS 2000 2100 3000 REGISTER RET Execution will break when execution has passed addresses H 2000 H 2100 and H 3000 Note that passing an address is defined as passing at least once Thus the breakpoint sequence is not rese
69. M AREA ADDRESS GO TRAP RETURN CODE SAVING MODE CONVERS FR_ERROR SUB L OV L OV B EXTU RO RO FP_RCOD_3 R3 R3 RO RO RO RTN_AD_3 R3 FO_RTN RETURN COD q RETURN SEQUENCE RETURN CODE DELAY BRANCH ON ERROR RETURN H FE RO RTN_AD_3 R3 RO R3 RIN_AD_3 R8 r8 RO R15 PR SET RETURN CODE DELAY RETURN LOAD PR FP_FU FP_MO FP_FN FP_RC TRAP NM DE MA OD H 01250000 PARM_FP EGIST align 4 3 3 pes CLOSE ER SAVING STS L PR R15 SAVE PR 226 PARAMETER BLOCK SETTING RETURN CODE SUB 1 OV OV OV 1 R4 RO FP_FNUM_4 R3 RO R3 RO RO FP_RCOD_4 R3 RO R3 REO_CD_4 RO PARM_FR4 R1 TRP_AD_4 R3 R3 FILE NUMBER SET N CLEAR RETUR REQUEST CODE PARAM AREA ADDR GO TRAP ARGUNMENT_1 R4 CODE AREA SAVIN Li L B G 0 RO FP_RCOD_4 R3 R3 RO RO RO RTN_AD_4 R3 RO 13 WORK LOAD RETURN COD SAVE RETURN COD RETURNNING SEQUENCE C_RTN RTN_AD_4 R2 R2 RO R15 PR SET RETURN CODE DELAY BRANCH LOAD PR FP_FNUM_4 FP_RCOD_4 REQ_CD_4 PARM_FP_4 TRP_AD_4 RTN_AD_4 FP_FNUM FP_RCOD H 01060000 PARM_FP STS 1 PR R15 SAVE PR PARAMETER BLOCK SETTING MOV MOV MOV MOV ADD MOV MOV Ll Ls Li Li R4 RO FR_FNUM_5 R3
70. MAP tarada Defines displays modifies and deletes MEMOTLY Area Skireisen eiei i T enira iaeei 5 26 MEMORY eee Modifies memory contents coooooooccocccnconconnnnononaninnanons 5 21 MOVE ies ssssssiseesseiiisvasiesienss Copies memory block ooooocononcnccnccnocncnononanoncnancnnncnos 3 28 PRINT 4 siticcsge cine ge setees os Creates execution history file eee ee ee eeeeeeeeee 9 29 QUIT esc Exits the simulator debugget oooconocnnccnconocnnocnncnconccnos 5 30 RADIX irirna s Sets th radik is sh Pes e rE EE EAEE 5 31 REGISTER oe Displays register contents oooonocccocconnnonconnnannnnnnancnncnnos 5 32 RESET uti rt Resets the simulator debugger oooncnncninnnncnncnicnconnnnss IS SAVE iia Saves memory data to a file oooononinnnnninnnnnnnnncononnncnnos 5 34 SAVE_STATUS oe Saves the current simulator debugger status Mala il MI r SCOPE ip Displays the function that includes the current execution addition 5 36 SET_COVERAGE 0 000 Sets coverage range oo eee ee eeeeseeeee cesses cseesseeseenaee 5 37 SHOW_CALLS ooeec Displays function Call ooocononncnccnonnnononononnnononancnnnnnos 9 38 STEP ascitis Performs step execution in subroutine units 5 39 STEP_INTO ooocccccccccccccncccnn Performs step executlON oooocconooncnoccconnconnonoccnonnnconacnnes 540 STUB eiii Executes command during simulation 541 SYMBOL eee Displays symbol information cece eeeeeeeeee 3 42 TRACE vicios Displays tr
71. Map s s cssisssisssesesseessscesdssvesssosctssss obasdendsshecducieseevessindssasdieateavhsssensbisnes Information Messages at Instruction Execution Interruption ooocccnccnconnconccconnnonnccnnnn no Information Messages during Command AnalySiS ooocccccnoccnonconnnonconnnanono nono noncrancnn conos Error Messages during Startup for Load Command ExecutiONM oonocnncncccnonnncccnnncnncnnnonos Error Messages during Command Execution ooococcoccconconcconconocnnconocononnnnnncnnnnncnncrncnnconos Error Messages during Simulation ooononinnnncnonnnoninncnononnconncnnocnncononnncnnnnnnonn non nono rncnncnnos I O Related Error MesSaresiocnaia mili Keyboard Input Related Error Messages c ceescescecesecenceceneeeseeeeeceeseeeeneceeecnaeeeaeeeee ASCIECode Table initial cosinss Eee oaeee e ae er p o dhs TERE E Eea n EREE Section 1 Overview The SH series simulator debugger provides simulation and debugging functions for SH series microcomputer CPUs and supports efficient debugging of software written in either C or assembly language When used in conjunction with the following software the SH series simulator debugger reduces the effort required for software development SH Series C compiler SH Series cross assembler H Series linkage editor H Series librarian H Series object converter SH Series CPU information analysis program 1 1 Features Since the simulator debugger runs on a host computer software debugging can st
72. NCE BREAK_ACCESS BREAK_DATA or BREAK_REGISTER Error STEP normal end Trace buffer Figure 5 2 Macro Internal Variable YSIMSTAT 120 MACRO Macro Internal Commands 1 WHILE Format WHILE lt expression gt lt macro body gt Parameters e lt expression gt The lt expression gt parameter expresses the condition for macro body execution or iteration e lt macro body gt The lt macro body gt parameter expresses the sequence of commands or macro internal commands to be executed while the condition is true Function The lt expression gt is evaluated and if its value is any value other than zero the macro body is executed The macro body is iterated until lt expression gt evaluates to zero If the value of lt expression gt is zero initially the macro body is not executed even once Multiple simulator debugger commands macro commands or macro internal commands can be included in the macro body Example To display the fifth to tenth elements in array ABC NUM 5 WHILE NUM lt 10 TYPE ABC NUM 1 NUM NUM 1 121 MACRO 2 FOR Format FOR lt expression 1 gt lt expression 2 gt lt expression 3 gt lt macro body gt Parameters e lt expression 1 gt The parameter lt expression 1 gt is evaluated prior to testing the lt macro body gt execution condition e lt expression 2 gt The parameter lt expression 2 gt expresses
73. ND is selected the system writes out the memory map information to the CPU information file and completes CIA processing normally 205 1 4 CIA Sample Sessions This section presents two sample CIA sessions The underlined sections are user inputs 1 Creating a new CPU information file for the SH 7000 mode 0 o cia shmode0 cpu RET lt SH SERIES CIA Ver 1 1 HS0700CICU1SM Copyright C Hitachi Ltd 1992 Licensed Material of Hitachi Ltd xxx NEW FILE CPU MENU 1 SH 7000 1 RET lt BIT SIZE 32 32 RET lt COMMENT 93 01 25 SH SAMPLE RET lt MAP MENU 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END 1 RET lt EXTERNAL START ADDRESS 00000000 RET AAA END ADDRESS OOFFFFFF RET A STATE COUNT 2 3 RET lt 8 DATA BUS SIZE 8 RET lt 9 ES EXTERNAL START ADDRESS 01000000 RET END ADDRESS O4FFFFFF RET STATE COUN 2 2 RET DATA BUS SIZE 2 8 RET EXTERNAL START ADDRESS RET 0 MAP MENU 0 ROM 1 EXTERNAL 2 RAM 3 1 0 END 2 3 RET I O AREA START ADDRESS 05000000 RET ti ND ADDRESS 05FFFFFF_ RET STATE COUN 3 RET DATA BUS SIZE 8 RET
74. R 6 Shift and rotate ROTL ROTR ROTCL ROTCR 10 SHAL SHAR SHLL SHLR SHLLn SHLRn Branch jump BF BT BRA BSR JMP JSR 7 and return RTS Privileged and control register manipulations CLRT CLRMAC LDC LDS NOP RTE SETT SLEEP STC STS TRAPA 216 Appendix C SH Series Memory Maps Table C 1 shows the SH7000 memory maps Table C 1 SH7000 Memory Map Mode 0 Extended mode without ROM Mode 1 Extended mode without ROM H 0x00000 H 0x003FF H 1x00000 H 5x00000 H 6x00000 H 8x00000 H 9x00000 H Fx00000 H EXEFFFF Vector area External bus area csO Bus width 8 bits External bus area cs1 cs4 Bus width 8 bits Internal I O area Bus width 8 16 bits External bus area cs6 and cs7 Bus width 8 16 bits External bus area csO Bus width 8 16 bits External bus area cs1 cs6 Bus width 16 bits Internal RAM area Bus witdth 32 bits H 0x00000 H 0x003FF H 1x00000 H 5x00000 H 6x00000 H 8x00000 H 9x00000 H Fx00000 HIEXEFFFF Vector area External bus area csO Bus width 16 bits External bus area cs1 cs4 Bus width 8 bits Internal I O area Bus width 8 16 bits External bus area cs6 and cs7 Bus width 8 16 bits External bus area csO Bus width 16 bits External bus area cs1 cs6 Bus width 16 bits Internal RAM area Bus
75. RO R3 R14 R8 H 10 R8 R8 RO FR_BUFP_5 R3 NUMBER SET INPUT AREA ADDR SET 227 ARGUMENT_1 R4 ESS MOV L RO R3 i SUB L RO RO MOV L FR_RCOD_5 R3 MOV B RO R3 CLEAR RETURN CODE AREA piace O hte ee RN At a Im ah ted he GO TRAP MOV L REQ_CD_5 RO REQUEST CODE MOV L PARM_FR_5 R1 PARAM AREA ADDRESS MOV L TRP_AD_5 R4 GO TRAP JSR R4 DELAY BRANCH NOP RETURN CODE SAVING SUB L RO RO WORK OV L FR_RCOD5 R4 OV B R4 RO LOAD RETURN CODE EXTU B RORO CMP EQ 0 RO BT FR_SET NORMAL OV H FF RO EOF FR_SET OV L RTN_AD_5 R3 SAVE RETURN COD OV L RO R3 A 4 RETURNNING SEQUENCE FR_RIN OV L RIN_AD_5 R8 OV L R8 RO SET RETURN CODE RTS DELAY RETURN LDS L R15 PR LOAD PR align 4 FR_FNUM_5 DATA L FR_FNUM FR_BUFP_5 DATA L FR_BUFP FR_RCOD_5 DATA L FR_RCOD REQ_CD_5 DATA L H 01290000 PARM_FR5 DATA L PARM_FR TRP_AD_5 DATA L TRAP RIN_AD_5 DATA L RTN_CD A 7 CONVERT MODE STRING TO BE MODE ID NUMBER CNV_MODE STS L PR R15 PR SAVE OV L R8 R15 R8 SAVE OV L SV_R1P R8 OV L R1 R8 R1 SAVE OV L SV_R2P R8 OV L R2 R8 R2 SAVE OV L SV_R3P R8 OV L 3 R8 R3 SAVE OV L SV_R4P R8 OV L R4 R8 R4 SAVE 228 MOV L SV_R5P R8 MOV L R5 R8 MOV L SV_R6P R8 MOV L R6 R8 MOV L SV_R7P R8 MOV L R7 R8 LOAD USER SPECIFICATION AND CONVER R5 SAVE R6 SAVE R7 SAVE
76. S CONFLICTS Only 1 system call start address can be specified Check the specified address by using the TRAP_ADDRESS command 243 Table F 4 Error Messages during Command Execution cont Error No Message Error Description and Recovery Procedure 4057 MEMORY SPACE The size of the memory area is too small INSUFFICIENCY to display all the functions called Check the size of memory available for the simulator debugger size 4058 CAN NOT REFER TO The specified symbols could not be THE SYMBOL referred due to C compiler optimization Specify the address or data for the symbols 4059 ILLEGAL ADDRESS RANGE The specified memory area size is too large SPECIFIED Divide the memory areas and specify each 244 F 2 3 Error Messages during Simulation Table F 5 lists the error messages displayed during simulator debugger simulation of a debugging object program Table F 5 Error Messages during Simulation Error No 5001 Message GENERAL INVALID INSTRUCTION Error Description and Recovery Procedure One of the following conditions caused a general invalid instruction error 1 The program attempted to execute a code that is not an instruction 2 An error occurred during exception processing of general invalid instructions Correct the debugging object program so that the error does not occur 5002 INVALID SLOT INSTRUCTION One of the following conditions caused an invalid slot instruction error 1 The
77. SPARC SH Series Simulator Debugger User s Manual When using this document keep the following in mind 1 2 This document may wholly or partially be subject to change without notice All rights are reserved No one is permitted to reproduce or duplicate in any form the whole or part of this document without Hitachi s permission Hitachi will not be held responsible for any damage to the user that may result from accidents or any other reasons during operation of the user s unit according to this document Circuitry and other examples described herein are meant merely to indicate the characteristics and performance of Hitachi s semiconductor prodocuts Hitachi assumes no responsibility for any intellectual property claims or other problems that may result from applications based on the examples described herein No license is granted by implication or otherwise under any patents or other rights of any third party or Hitachi Ltd MEDICAL APPLICATIONS Hitachi s products are not authorized for use in MEDICAL APPLICATIONS without the written consent of the appropriate officer of Hitachi s sales company Such use includes but is not limited to use in life support systems Buyers of Hitachi s products are requested to notify the relevant Hitachi sales offices when planning to use the products in MEDICAL APPLICATIONS Preface The SPARCstation SH Series Simulator Debugger referred to in this manual as the simulator debugg
78. STATUS command but rather that file is specified at simulator debugger startup 2 The A option cannot be specified from within a command chain file Examples 1 To save the current status of the memory and register in the file testl sav SS testl sav M RET 2 To save the complete current status of the simulator debugger in the file test2 sav SS test2 sav A RET 146 SCOPE 5 35 SCOPE Displays the function that includes the current SCP execution address Format SCOPE RET Function Displays the file and function that include the current value of the program counter This command allows the user to confirm the name of the currently executing function Example To display the file and function that include the current value of the program counter SCP RET Scalc c add32 147 SET_COVERAGE 5 36 SET_COVERAGE Sets coverage range SCV Format Set SET_COVERAGE lt start address gt lt end address gt Setting state display Clear Parameter lt byte count gt RET SET_COVERAGE RET SET_COVERAGE lt start address gt RET e lt start address gt lt end address gt lt byte count gt Specifies the range for which coverage information is to be acquired Function Sets displays and clears the range of addresses over which CO and C1 coverage information is acquired
79. Specification of the units for source line display and of the step count for the step execution command S I N Option Source Line Display S and SI Command Step Units S Source display source line step C source only Line units Instruction and source display instruction step Both C source and machine Machine language instruction units language N No source display instruction step Function Machine language only This command specifies whether high level language debugging is performed or not There are three aspects to high level language debugging as listed below 1 Source line display The display consists of the source program corresponding to the results of command execution The following commands display the source program in their execution results e The disassembly command DA e The trace buffer display command T e The debugging object program execution commands G S SI V 92 DEBUG_LEVEL 2 Step execution units This specification determines whether or not the step execution commands S and ST take the C source line as the step 3 BREAK stop address This command also specifies whether the simulator debugger stops on source line units or machine instruction units when a break condition specified by a BREAK_ACCESS BREAK_DATA or BREAK_REGISTER is detected Description Specification Sets the source program display and step execution unit e S option Only C
80. TEP_INTO SI Performs step execution 40 STUB SB Executes command during simulation 41 SYMBOL SY Displays symbol information 42 TRACE T Displays trace buffer 43 TRACE_CONDITION TC Sets trace condition and starts or stops trace 44 TRAP_ADDRESS TA Sets displays and clears the system call start address 45 TYPE TY Displays variable value 46 VECTOR V Executes from an interrupt vector address 47 lt register gt E Modifies register contents 48 Invokes sub process 49 4 4 Specifying Command Parameters The simulator debugger commands allow parameter specification This section describes the aspects of parameter specification common to all commands Refer to section 5 Simulator Debugger Commands for more information on the command parameters 4 4 1 Expressions Expressions integer expressions consist of terms operators and parentheses Operations are performed in 32 bit unsigned operations and overflows during operation is ignored However divide by zero and floating point operations generate errors 1 Terms The following terms can be used in integer expressions a Numeric constants Numeric constants represent 32 bit integer constants Numeric constants can be prefixed with B Q D or H to represent binary octal decimal or hexadecimal constants respectively When the prefix is omitted the base specified with the RADIX command is used Examples Binary constant B 1010 Octal constant Q 4567 Decimal const
81. The following special symbols can be used for location specification e RIN Return address of a function Usage example GO RIN RET Execution will stop at the point the currently executing function returns END The last address in a file or function Usage example DA file c func END RET This command disassembles and displays the function func from its first location to its last 54 2 Operators Table 4 2 shows the operators that can be used in expressions and their priorities Table 4 2 Operators and Operator Priorities Priorities Symbol Description 1 Structure member operator gt Structure member operator 2 Plus sign unitary operator Minus sign unitary operator Bit inversion unitary operator Pointer unitary operator amp Address operator unitary operator 3 e Multiplication Division 4 Addition Subtraction 5 lt Less than relational operator lt Less than or equal relational operator gt Greater than relational operator gt Greater than or equal relational operator 6 Equal relational operator Not equal relational operator amp Logical and A Logical exclusive or Logical or 10 Assign the left hand side to the right hand side assignment operator Relational operators are used to compare the values on the right and left sides If the comparison is true the value of the operation is H FFFFFFFF an
82. V L REQ_COD RO MOV L CALL_ADR R3 MOV L FNUM_ADR R2 MOV B R2 R4 MOV L PAR_ADR R2 ADD L 01 R2 MOV B R4 R2 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL _ADR DATA L SYS_CALL REQ_COD DATA L H 012A0000 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM FPUTS_BUF RES B 2 RES W 1 DATA L OUTDATA OUTDATA SDATA Hollow world DATA B 0 END 190 2 7 FEOF lt Function gt Checks for end of file lt Function code gt H 0B lt Parameter block gt MSB 0 15 0 Return value File number e Return value output 0 File pointer is not at EOF 1 EOF detected e File number input The number returned when the file was opened lt Example gt To test the file sample src for EOF IMPORT FNUM MOV L O lt DOE EE E JSR NOP STOP NOP SYS_CALL NOP ALIGN PAR_ADR R1 REQ_COD RO CALL_ADR R3 FNUM_ADR R2 R2 R4 PAR_ADR R2 01 R2 R4 R2 R3 4 CALL_ADR DATA L SYS_CALL REQ_COD DATA L H 010B0000 191 TRAP_ADDRESS TRAP_ADDRESS 2 8 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM FEOF_BUF RES B 2 END FSEEK lt Function gt Moves the file pointer to the specified position lt Function code gt H 0C lt Parameter block gt MSB 0 8 15 0 Return value File number 2 Direction Unused 4 Offset upper word 46 Offset lower word e Return value output 0 Normal te
83. X SeaJe NO Y eusajur OML py suid jo0a aes diyo uso awes ay y m JSIX909 JOU OP saoeds snq eulajxa sauas Hs ay ul e WOH UNM apou papua xa z apou sasn webo y uOe a 4 voyeuoju NdO Zp uonoss ul ajduexe ay Z NOY noyim apou papua xa y apou sasn webo g UONEIID a 4 uoeuojul MdO Ly uonoas ul ajduexe ay S9JON 343433X3H 343434 3X34H dddddXx4 H dddddX4H suq ze upm sng suq ze upm sng suq ze y1pum sng suq ze upym sng gae Nvy IeuIa u Bale Nvy eusajul eale Nvy eulaju eale Nvy eulajul 00000X3 H 00000X4 H 00000X4 H 00000X4 H suq 91 yapim sng suq 91 ypim sng suq 91 y1pim sng 9S9 S9 9S9 S9 9S9 S9 reae snq eulajx3 fease sng eula x3 reae snq eula x3 00000X6 H 00000X6 H 00000X6 H 00000X6 H suq ze y1pim sng suq ze y1pim sng suq 91 y1pim sng suq 91 8 UIPIM sng Bale WOH 2ulaju gase sng eusajul oso eae snq eulayx3 0so9 esJe sng eusa x3 00000X8 H 00000X8 H 00000X8 H 00000X8 H SHA 91 8 uypiM sng suq 91 8 UIpIM sng suq 91 8 UIpIM sng S9 pue 9S9 1S9 pue 9S9 S9 pue gso 00000X9 H feare snq jeux 00000X9 H fease sng eua x 00000X9 H fease sng eula x 00000X9 H SHA 91 8 uypim sng SHA 91 8 uypiM sng suq 91 8 U1pIM sng suq 91 8 UIpIM sng eae jeula u eae jeula u tale euzu eae jeula u on al 00000XS H on w 00000XS H Su mI 00000XS H on wi 00000XS H suq 8 yapim sng suq 8 UIpIM sng suq 8 y pim sng pso So pso So pso So Jere snq eusa
84. YS_CALL REQ_COD DATA L H 01230000 PAR_ADR DATA L PARM PARM DATA L INBUF INBUF RES B 80 END 177 TRAP_ADDRESS 1 4 PUTS lt Function gt Outputs a line of characters to standard output A line feed character LF terminates the output line Up to 131 characters can be output on a line If more than 131 characters are output the 132nd character will be converted to a line feed LP lt Function code gt H 24 lt Parameter block gt MSB 0 15 0 2 lt Example gt To output the string Hello world to standard output usually the console OV L PAR_ADR R1 OV L REQ_COD RO OV L CALL_ADR R3 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L SYS_CALL REQ COD DATA L H 01240000 PAR_ADR DATA L PARM PARM DATA L OUTDATA OUTDATA SDATA Hello world DATA B H OA 178 2 1 File I O END TRAP_ADDRESS A file number is returned when a file is opened with FOPEN All following operations on that file including I O and closing are performed using that file number Up to 16 files can be opened at the same time FOPEN lt Function gt Opens a file lt Function code gt H 25 lt Parameter block gt MSB 0 15 0 Return value File number 2 Open mode Unused 4 Start address of file name 6 e Return value output 0 Normal termination 1 Error e File number output The
85. a memory image file memory must be allocated using the MAP command 2 The information loaded by the LOAD_STATUS command differs from that loaded by the LOAD command Examples 1 To load testl abs as the debugging object program L testl abs RET 2 To load test2 dat as a memory image file starting at address H 3000 L test2 dat 3000 M RET lt START gt lt END gt 00003000 000030FF 114 LOAD_STATUS 5 23 LOAD_STATUS Restores simulator debugger memory and register LS state Format LOAD_STATUS lt file name gt RET Parameter e lt file name gt Specifies the name of a file that was used to save the simulator debugger memory and register state If the file name is omitted the file sdsh sav is assumed If the file format is omitted sav is supplied Function The states of memory and the registers are restored to the point when the corresponding SAVE_STATUS command was executed Notes 1 Ifthe memory map differs from that at the point the SAVE_STATUS command was executed the memory and register state is not restored 2 Files saved by specifying the A option with the SAVE_STATUS command must be loaded at simulator debugger startup time Example To load the memory and register state saved in the file testl sav LS testl sav RET 115 MACRO 524 MACRO Defines displays executes and deletes MA simulator debugger com
86. ace buffer ooooooconncnocnocnconncanonononnnononancnncnnos 5 43 TRACE CONDITION Sets trace condition and starts or stops trace 5 44 5 45 5 46 5 47 5 48 TRAP_ADDRESS Sets displays and clears the system call start AddrESS eri 170 IMPE abate fees Displays variable value oooconncnnncnicnoccnonnncncncnnancnn conos 193 VECTOR cuota Executes from an interrupt vector address 195 ESTI oo e a a Modifies register Content ooooconocnoccconnnononnnonnnnnnnancnnncnos 197 DO it Invokes SUb proce oooocccocconnconconnconnonnonn conc rancnncnncrnos 199 Part II CPU Information Analysis Program Section 1 Creating the CPU Information ooocoocccnnncccnoncccnoncnononcnnnonacinnaccnannnos 203 1 1 CIA Pumections iscsi ssstscdesycsssus isc dpesstadsees sd otbt EEE SE E ENE EI aE EEEa SE hp Ee Saia STEES EErEE 203 1 2 Invoking the CIA Program ccs 6 ici nsec dsccteeca sicarios elias Earl e 203 1 3 CIA Usage Procedures and Selection Menus 0 0 0 0 cee ce ceseeeeceseeeeceeeeseceeeeeeseneeeeseneeaee 204 1 4 CIA Sample SESSIONS init ii ari 206 1 5 CIA Limitations sss sedis icono sse pescets diari cus cseadssnstesssesveushspustesssdatedassessesaahdsesthossseee 211 Part III Appendix Appendix A Differences between Line Assemble Command and SH Series Cross Assembler SyNtAX ooooocnnoccccnocccnnonccononccnnnnccnnnos 215 Appendix B SH Series Assembler Mnemonics ccoocccocononcnonnnon
87. address When the instruction at the specified address has been fetched the specified number of times during execution by a CALL GO STEP STEP_INTO or VECTOR command instruction execution is stopped 63 BREAK Description Set Enable disable Display Cancellation Notes Sets a break address and count Program execution stops before the instruction at the break address is executed Up to 8 breakpoints can be set Note that breakpoints are automatically enabled when a breakpoint is set Allows breaking to be enabled or disabled without changing the breakpoint settings Displays the breakpoints set with the BREAK command Cancels clears the breakpoints set with the BREAK command If no instruction addresses are specified all breakpoints set with the BREAK command are removed In this case a confirmation message will be displayed Enter Y to remove all breakpoints or N to cancel the removal 1 Ifa breakpoint is set at any address other than the first byte of an instruction the break will not be detected 2 The execution count is reset at the point that instruction execution stops 3 Ifa breakpoint is set at an instruction following a delayed branch instruction execution stops at the start address of the delayed branch instruction 4 If conditions specified with the BREAK and BREAK_SEQUENCE commands are satisfied simultaneously the command line specified with the BREAK command is executed first
88. aeeseesaecaaeeaesseeaeenaes 250 H 2 How to Install the Simulator Debugger in the Host System eee eseeeeneeeeee 250 H3 Equipment o ii aad 251 HA Special KEYS coito 251 Figures Part I Simulator Debugger 1 1 2 1 2 2 3 1 3 2 5 1 5 2 5 3 5 4 5 5 Methods for Creating Debugging Object Programs oooocccccconnonnconcnononononcnancnancnncrancnn ninos 4 Relocatable Section Load MaPD cooonocnnccnonnnoninoninncnnccnnonnconnconncn non nocononnn cnn nnnn on nnnn ran crincnn caos 10 Initial Register Vall iaa aged tvunny cased Gate ie a N A e EE 11 Input File Example input obj ooooonocnoncnocanacinnconacononnconnconn cono nncononnn cnn nonn nn cnnn ran crncnncnos 29 SH7000 Memory Map Mode 2 seereis enseres eoep peesi non nono nono conoce cnn nnnc ran oe sepesi 31 Command Description Format oooconicnnncnocinoniononononncnnnonnconncononnncononnn cnn nnnn cnn nnn ran crncnnnnos 59 Macro Internal Variable SIMSTAT 000 cece cee ceceeeceseesececeseceecseeeeeseeeeseaeeeeeeaeeees 120 Display Range Specified by the Start Instruction Index ee eeeeeeeeeceeeeeeeeeeeeee 164 Display Range Specified by the Start Instruction Index and the Instruction Count 165 Trace Buffer Contents v cesecssesssssechdvsassssssdetusdegessbasbsousouenstas ssessess sass saisensssspetsouscbonestes 168 Part II CPU Information Analysis Program 1 1 CIA Usage procedure ssri eeens es iiss ees EE e EEEE E E EAEE EEEE EE 204 Tables Part I Simulator
89. ameters when a subroutine call BSR or JSR to the specified location is detected during debugging object program execution The simulator debugger restarts simulation at the instruction following the subroutine call instruction after completion of the I O processing 2 9 Saving and Restoring the Simulation Status 1 Saving Simulation Status The current simulation state can be saved using the SAVE_STATUS command After executing this command the LOAD_STATUS command can be used to return to the simulator debugger status at the time the SAVE_STATUS command was executed Command options can be used to specify the type of saved information The following types of information can be saved e Option M Saves only the current contents of memory and registers e Option A Saves the complete current status of the simulator debugger 2 Restoring Simulation Status The LOAD_STATUS command restores the contents of memory and registers saved when the SAVE_STATUS command was executed Restoring the status saved when the A option was specified is not performed with the LOAD_STATUS command but by a specification at simulator debugger startup However if the current memory map differs from the memory map in use at the time the SAVE_STATUS command was executed an error occurs and the state is not restored 2 10 C Source Level Debugging The simulator debugger also provides functions for debugging programs written in C The most important of thes
90. ant D 1234 Hexadecimal constant H A4FF Note that a leading zero must be inserted at the head of a hexadecimal constant when the first digit is A to F and the H prefix is omitted Example To write H A0 without the prefix use OAO 50 Register values Register value terms represent the current value stored inside the register at the time they are evaluated Register values are zero extended to 32 bit integer values RO R15 SP PC SR GBR VBR MACH MACL PR Symbols Symbols represent an address or constant value The syntax for symbols is shown below symbol member name eSfile name e function name The lt function name gt indicates a C function It is not used with assembler language symbols Although alphanumerics and the and _ characters can be used in symbols as well as function and member names symbols function names and member names must be 32 or fewer characters in length and must start with either a letter the character or the _ character Upper and lower case letters are distinguished Member names express elements of structures or unions Member names are not used with assembler language symbols 51 There are three classes of symbol scope in C global symbols which are valid over the whole program static symbols that are valid in a single file and local symbols that are valid within a function If a symbol is specified the simulator debugger search
91. are specified all breakpoints set with the BREAK_ACCESS command are removed In this case a confirmation message will be displayed Enter Y to remove all breakpoints or N to cancel the removal If conditions specified with the BREAK_ACCESS BREAK_DATA and BREAK_REGISTER commands are satisfied simultaneously the corresponding command lines are executed in that order Examples 1 To seta breakpoint so that execution stops when a read or a write to memory in the range from address H 1000 to H 1100 occurs and to execute the REGISTER command after stopping at the breakpoint BA 1000 1100 RW REGISTER RET 2 To disable the breakpoint at address H 1000 BA 1000 D RET 67 BREAK_ACCESS 3 To display the currently set breakpoints BA RET lt E D gt lt START gt D 00001000 lt END gt lt ATTR gt lt COMMAND LINE gt 00001100 RW REGISTER 4 To clear the breakpoint at address H 1000 BA 1000 RI ET 68 lt SYMBOL gt Sfile c table_a GE 4 BREAK_DATA 5 4 BREAK_DATA Sets displays and cancels breakpoints based on the BD value of memory data Format Set BREAK_DATAA lt break address gt A lt data gt lt size gt A lt mask gt lt real number gt EQ NE lt command line gt RET Enable disable BREAK _DATAA lt break address gt E D RET Display BREAK_DATA RET Cance
92. art without using an actual SH series target system thus reducing overall system development time A designated CPU information file can be used to specify an environment corresponding to any of the memory maps used with the SH series MCUs The simulator debugger provides the following functions which enable efficient program testing and debugging The ability to handle all of the SH7000 CPUs C debugging functions Debugging functions for optimized C programs which may differ from those of non optimized C programs Test functions stub coverage measurement Subroutine execution functions Macros command combinations Tracing instructions or subroutines Functions for stopping or continuing execution when an error occurs during object program execution Standard I O and file I O Acomprehensive set of break functions Saving the execution history to a file Saving command lines to a file and inputting command lines from a file 1 2 Debugging Object Programs The simulator debugger can debug object modules generated by a C compiler or cross assembler and load modules generated by a linkage editor These object modules and load modules are referred to as debugging object programs Figure 1 1 shows the software associated with creating debugging object programs Assembler eli C source program program SH series SH series CPU information cross assembler C comp
93. asurement 12 DATA_SEARCH DS Searches for data 13 DEBUG_LEVEL DL Specifies debug level 14 DISASSEMBLE DA Disassembles and displays memory contents 15 DISPLAY_CHARACTERS DCH Displays character string 16 DISPLAY_COVERAGE DCV Displays coverage data 17 DUMP D Displays memory contents 18 EXEC_MODE EM Switches execution mode 19 FILL F Initializes memory area 20 GO Executes instructions continuously 21 HELP HE Displays command name and input format 22 LOAD L Loads file 23 LOAD_STATUS LS Restores simulator debugger memory and register state 48 Table 4 1 Simulator Debugger Commands cont No Command Abbreviation Function 24 MACRO MA Defines displays executes and deletes simulator debugger command macros 25 MAP MP Defines displays modifies and deletes memory areas 26 MEMORY M Modifies memory contents 27 MOVE MV Copies memory block 28 PRINT P Executes history file 29 QUIT Q Exits the simulator debugger 30 RADIX RX Sets the radix 31 REGISTER R Displays register contents 32 RESET RS Resets the simulator debugger 33 SAVE sv Saves memory data to a file 34 SAVE_STATUS SS Saves the current simulator debugger state in a file 35 SCOPE SCP Displays the name of function at the current execution address 36 SET_COVERAGE SCV Sets coverage range 37 SHOW_CALLS SHC Displays function call 38 STEP S Performs step execution in subroutine units 39 S
94. automatically enabled when a breakpoint is set Up to 8 breakpoints can be set Allows breaking to be enabled or disabled without changing the breakpoint settings Displays the breakpoints set with the BREAK_REGISTER command Cancels clears the breakpoints set with the BREAK_REGISTER command All breakpoints set with the BREAK_REGISTER command are removed if the register is omitted from the break removal form of the command In this case a confirmation message will be displayed Enter Y to remove all breakpoints or N to cancel the removal 1 Ifa break condition is satisfied at a delayed branch instruction execution stops at the branch destination 74 BREAK_REGISTER 2 If conditions specified with the BREAK_ACCESS BREAK_DATA and BREAK_REGISTER commands are satisfied simultaneously the corresponding command lines are executed in that order Examples 1 To seta breakpoint so that execution stops whenever RO is written BR RO RET 2 To set a breakpoint so that execution stops if the value FF is written to register R1 and to execute the REGISTER command after the break BR R1 OFF REGISTER RET 3 To set a breakpoint so that execution stops if any value other than FF is written to register R2 BR R2 OFF NE RET 4 To set a breakpoint so that execution stops if a value whose lower two bits have the value 10 is written to register R10 BR R10 2 3 RET 5 To disable t
95. branch instruction to change PC immediately after the branch instruction was executed An error occurred during exception processing of the invalid slot instruction Correct the debugging object program so that the error does not occur 2 5003 ADDRESS ERROR One of the following conditions caused an address error 1 The value of the PC became an odd number 2 The program attempted to read an instruction from internal I O space An attempt was made to access a long word data at an address other than 4n An attempt was made to access a word data atan address other than 2n VBR and SP are not in multiples of four An error occurred during exception processing of the address error Correct the debugging object program so that the error does not occur 3 245 Table F 5 Error Messages during Simulation cont Error No Message Error Description and Recovery Procedure 5004 EXCEPTION ERROR An error occurred during exception processing Correct the debugging object program so that the error does not occur 5005 ILLEGAL OPERATION Division by zero was caused by a DIV1 instruction Correct the debugging object program so that the error does not occur 5006 MEMORY ACCESS ERROR One of the following conditions caused a memory access error 1 The program attempted to access a memory area that was not allocated 2 The program attempted to write to a memory area that has the write
96. break register condition set 2006 NO BREAK SEQUENCE There is no break sequence condition set 2007 NO FUNCTION CALL No function was called 2008 NO MACRO DEFINITION No macro was defined 2009 NO STUB POINT No stub point was set 2010 NO TRAP ADDRESS The system call start location trap address was not set 236 F 2 Error Messages F 2 1 Error Messages during Startup or Load Command Execution Table F 3 lists the error messages displayed by the simulator debugger during startup and during execution of the LOAD command Table F 3 Error Messages during Startup or Load Command Execution Error No Message Error Description and Recovery Procedure 3001 ADDRESS SPACE DUPLICATED sect The section indicated by sect overlaps with another section Correct the program so that sections do not overlap 3002 CAN NOT GET MEMORY SPACE Memory space required by the simulator debugger could not be allocated Increase memory or modify the debugging object program 3003 CAN NOT GET TABLE AREA The table memory area required by the simulator debugger could not be allocated Increase the user memory area on the host computer 3004 CAN NOT GET TRACE BUFFER The required trace buffer memory area could not be allocated Increase the user memory area on the host computer However commands other than the trace system commands will operate normally 3005 CAN NOT OPEN A file could not be
97. bus area the internal RAM area and internal I O area Divide the area into multiple sections and allocate each section within the boundaries of a region 4002 BREAK ACCESS ADDRESS CONFLICTS There is already a condition set for the location specified with the BREAK_ACCESS command Check the current settings and specify the address correctly 4003 BREAK DATA ADDRESS CONFLICTS There is already a condition set for the location specified with the BREAK_DATA command Check the current settings and specify the address correctly 4004 BREAK POINT CONFLICTS There is already a condition set for the location specified with the BREAK command Check the current settings and specify the address correctly 4005 BREAK REGISTER CONFLICTS There is already a condition set for the register specified with the BREAK_REGISTER command Check the current settings and specify the register correctly 4006 BREAK SEQUENCE CONFLICTS There is already a condition set for the sequence specified with the BREAK_SEQUENCE command Check the current settings and specify the address correctly 4007 CAN NOT ACCESS EXTERNAL MEMORY An address not allocated for the memory map was specified Specify a correct address 4008 CAN NOT CLOSE The specified file cannot be closed If there is inadequate user disk space increase the available disk space 4009 CAN NOT OPEN The specified file could not
98. c SECT1 00000404 OV L 00000012 R3 00000406 ADD L R2 R1 2 To disassemble and display the four instructions starting at address H 400 DA 400 44 RET 00000400 MOV W 12 PC RO 00000404 MOV W R1 RO ssample src SECT1 00000408 MOV L 00000012 R3 0000040A ADD L R2 R1 96 DISPLAY CHARACTERS 5 15 DISPLAY_ CHARACTERS Displays character string DCH Format DISPLAY CHARACTI Parameter ERS lt character string gt RET e lt character string gt Specifies an arbitrary character string Function Displays the specified character string on the screen This command can be used to display messages for example with the STUB command Examples 1 To display SIMULATOR on the screen DCH SIMULATOR RET SIMULATOR 2 To insert the DISPLAY_CHARACTERS command in a STUB command sequence so that it displays its argument during simulation SB 10 R ET STUB gt DCH PASS 10 RET STUB gt R G 8 RET ET PASS 10 The DCH command is executed when the instruction at address H 10 is executed 97 DISPLAY_COVERAGE 5 16 DISPLAY _COVERAGE Displays coverage data DCV Format DISPLAY_COVERAGE lt first address gt lt end address gt lt source line count gt lt instruction count gt TIGID NO N1 RET Parameters lt first address gt lt end ad
99. cases where the range of vector numbers that can be specified in the simulator debugger differs from the range that can be specified with the actual CPU 199 AR Example To start execution at the address specified in vector number 1 VECTOR 1 RET Exec Instructions 159 PC 0000014A SR 00000000 4 RO KH RR SP 0FF00000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 00000000 00000000 0000000A 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 OFF00000 OFF00000 00000148 MOV L R7 R6 BREAK POINT 200 Part II CPU Information Analysis Program Section 1 Creating the CPU Information The simulator debugger uses a CPU information file to load segments according to the memory map for the corresponding SH series CPU and to assure that segments are not loaded crossing memory type boundaries The CPU information file is created using the CIA CPU information analysis program Note that the H series linkage editor can also use the CPU information file to check segment allocation Refer to the H Series Linkage Editor User s Manual for details 1 1 CIA Functions The CIA program provides the following three functions I CPU information file creation Produces the CPU memory map information file for the SH series CPU used CPU information file display Allows the contents of the generated CPU information file to be checked CPU information f
100. cified locations from H O to H FFFFFFF can be used and if a bit size of 32 is specified locations from H O to H FFFFFFFF can be used A comment can be specified to identify the CPU information A comment of up to 127 characters can be specified The bit size and comment are only input when creating a new CPU information file The CIA procedure starts with step 4 Editing when an existent CPU information file is specified Memory map specification The following options are presented as a CPU information input menu Memory map specification is iterated until a period the exit command is specified 0 ROM 1 EXTERNAL 2 RAM 3 I 0 END e Options 0 to 3 specify a memory type and each time one of these options is selected the system prompts for the start address the end address the number of states and the data bus width e When a period is entered the memory map setup menu processing terminates Editing The following options are presented as a CPU information editing menu 1 ADD 2 DELETE 3 COMMENT 4 CIA ABORT CIA END When l ADD is selected the memory map specification of step 3 is performed e When 2 DELETE is selected the system prompts by index number for input of an address range to be deleted When 3 COMMENT is selected the system inputs a new comment line e When 4 CIA ABORT is selected CIA processing is terminated without saving the CPU information file e When CIA E
101. d e lt size gt B byte Specifies that memory is to be modified in byte units W word Specifies that memory is to be modified in word units default L long Specifies that memory is to be modified in long word units When the size specification is omitted word units are used as the default unless the start address was specified with a high level language variable In that case the size will be the size of that variable e lt real number gt Specifies a floating point number e lt character string gt Specifies a character string e Option Size specification B W L S D B byte Specifies byte units W word Specifies word units default L long Specifies long word units S single precision Specifies single precision floating point units D double precision Specifies double precision floating point units 133 MEMORY Function Changes the contents of memory to an arbitrary value Examples 1 To change the contents of one byte of memory at address H 1000 to 3E M 1000 3E B RET 2 To input in interactive form a To modify memory interactively one byte at a time starting at address H 1000 M 1000 B RET 00001000 3E SF RET 00001001 EE RET 00001002 55 25 RET 005 CC__ RET 00001 The following abbreviated commands can be used here in addition to data specification RET only The contents of the immediately following add
102. d 8 levels 4037 NOT A COVERAGE FILE The specified file was not a coverage file Check the file 4038 NO SCOPE SET A function name could not be found due to an unusual value in the PC After checking the value of the PC modify the program to operate normally 4039 NOT A SAVE_STATUS FILE The specified file was not a SAVE_STATUS file Alternatively insufficient information Check the file 4040 SAVE_STATUS OPTION CONFLICT The file cannot be loaded since the options used when saving the file were different Check the file 4041 STUB BUFFER OVERFLOW The STUB command registration buffer overflowed Delete any unnecessary stubs 4042 STUB POINTS EXCEED 16 Up to 16 stub points can be specified Delete any unnecessary stubs and retry the command 4043 SYMBOL NOT FOUND The specified symbol was not registered Specify the correct symbol name 4044 SYNTAX ERROR The command parameters were incorrect Specify the parameters correctly 4045 SYSTEM ERROR lt error number gt py An OS error occurred during execution of a command The specified OS command was not executed Review the system environment 4046 TOO MANY ARGUMENTS Too many arguments were specified in a function call Check the function s specifications 242 Table F 4 Error Messages during Command Execution cont Error No Message Error Description and Recovery Proc
103. d by the debugging object program it must be specified as an absolute address section starting at location H O The simulator debugger allocates addresses H O to H 3FF as the vector area when no absolute address section has been allocated in this area b Stack area Although the stack pointer is set to the address following the end address of the internal RAM no stack area is allocated When there is no stack area allocated within the debugging object program allocate a stack area using the simulator debugger MAP command When there is no internal RAM space the stack pointer will be cleared to 0 When there is a stack area allocated within the debugging object program set the stack pointer either by an instruction included in the program or by a lt register gt command c Undefined symbol area When the U option is specified with the LOAD command a 4 byte area is allocated for each undefined symbol and taken as the symbol s address Undefined symbol areas are allocated to an empty area in either the external bus area or the internal RAM 3 Memory Access Types The memory access type is determined from the memory type corresponding to the load address of the debugging object program The memory access type can be either read only or read write Since it is an error for the debugging object program to write to read only memory it is possible to detect memory access errors The memory access type for each memory area can be chang
104. d if the comparison is false H 00000000 Parentheses can be used to override the operator precedence Assignment operator can only be used within the MACRO command 55 4 4 2 Locations Location expressions are expressions whose values are addresses Instruction locations cannot contain automatic variables or pointer variables The following symbols can be used for locations Variable name label function name file name Symbol addresses EQUATE name Symbol values Note however that symbols defined for registers cannot be used for locations Examples 1000 Indicates location 1000 ABCD Indicates the address of the symbol ABCD in the file associated with the current value of the program counter 100 Indicates the address of line 100 in the file associated with the current value of the program counter 4 4 3 Data Data expressions consist of an expression and a size indicator The syntax for data expressions is shown below lt expression gt lt size gt size B byte 8 bits W word 16 bits L long 32 bits Word is the default size when the size specification is omitted When the value of the expression is larger than the size the overflow digits are ignored i e only the lower order lt size gt digits are valid 56 The following symbols can be used for data Variable name and label Symbol contents Function name and file name Symbol addresses EQUATE name Symbol values Example The data expression H 1234
105. deleted by optimization cannot be debugged 3 Because lines may change places due to optimization the program execution order or the disassembly display may differ from the order of the source listing Example Source listing Simulator disassembly display 12 for i 0 i lt 6 i 14 2 i 1 13 12 for i 0 i lt 6 i 14 2 i 1 17 1_24 15 i _2 16 17 i_ 2 4 In for and while loops disassembly display may be performed twice once at the loop entrance and once at the loop exit 19 2 11 Break Conditions The simulator debugger provides the following conditions for breaking interrupting the simulation of an object program during execution started by a CALL GO STEP STEP_INTO or VECTOR command e Break due to satisfaction of a condition set by a break command e Break due to detection of a run time error in the object program e Break due to overflow of the trace buffer e Break due to execution of a SLEEP instruction e Break due to input of CTRL 1 Break Due to the Satisfaction of a Condition Set by a Break Command There are 5 break commands as follows e BREAK Break based on the location of the instruction executed e BREAK ACCESS Break based on access to a range of memory e BREAK DATA Break based on the value of data written to memory e BREAK REGISTER Break based on the value of data written to a register BREAK_SEQUENCE Break based on a specified execution sequence When a break c
106. ding to an existing file lt command line gt A gt gt A lt file name gt Note that redirection cannot be used with the COMMAND_CHAIN command 25 2 15 Saving Input Commands to a File The PRINT command also provides a function for saving only command input Test re execution can be automated by using this function to create a command file and using that command file with the COMMAND_CHAIN command 2 16 Test Functions 2 16 1 Stub Function During simulation of a object program the simulator debugger can stop execution and execute a specified set of simulator debugger commands each time the program passes a location specified with the STUB command When this execution is completed the simulator debugger returns to simulation of the object program This is referred to as a stub The return location following stub execution can be specified as desired When the stub execution location is not the same as the return location the resulting execution can be seen as stub execution replacing one part of the program simulation This is referred to as stub proxy execution Stub proxy execution is used for example to jump over subroutine processing that has not yet been implemented This allows simulation to be performed even if the program is not completed On the other hand when the return location is the same as the stub location since the simulation returns to the same location after executing the simulator commands this funct
107. displayed if line number information is available NO specifies the addresses not executed under CO coverage and N1 specifies the branches not taken under C1 coverage Description After the DISPLAY_COVERAGE command has been executed once pressing RET again will show the next 16 lines of coverage information until another command is entered Examples 1 To display the coverage data with specifying the T option DCV 0 30 T RET CO 2 87 5 Cl 50 0 2 To display the coverage data with specifying the G option DCV 0 10 G RET This example is a C program ssample c 4 for i 0 i lt 20 i ssample c Ou 3 printf Number is c number i e CO coverage is displayed e The objects of display are C and assembler source programs e An indicator mark is inserted in column 1 e Indicator interpretations asterisk This address was accessed and executed period This address was not executed space No machine instruction was generated for this line 99 DISPLAY_COVERAGE 3 To display the coverage data with specifying the D option DCV 0 D RET 00000000 ADD L HEFFFFFFC R15 ssample c 4 for i 0 i lt 20 i 00000002 MOV L 00000000 R3 00000004 MOV L R3 R15 00000006 BRA 00000010 00000008 NOP 0000000A MOV L R15 R2 0000000C ADD L 00000001 R2 0000000E MOV L R2 R15 00000010 OV L R15 R3 00000012 OV L 000000
108. dress gt lt source line count gt lt instruction count gt Specifies the range of coverage data to be displayed Options Display format specification T G D NO N1 T total Specifies display of both CO and C1 coverage values G general Specifies display of the results in source line units default D detail Specifies display of the results in machine instruction units NO N1 not executed Specifies display of addresses that were not executed Function Displays CO and C1 coverage data When the T option is specified Only coverage values are displayed If only the option is specified i e if the range specification is omitted then the whole coverage range is taken as the object of the coverage values When the G option is specified The coverage results are displayed in source line units When the range specification is omitted display continues from the previous use of the command When the end address or source line count specification is omitted 16 lines are displayed When the D option is specified The coverage results are displayed in machine instruction units When the range specification is omitted display continues from the previous use of the command When the end address or source line count specification is omitted 16 lines are displayed 98 DISPLAY _COVERAGE When the NO or N1 option is specified The addresses of unexecuted instructions are displayed Line numbers will be
109. e Input format for the command NO FF WN FP 59 Q O 00 Description of command parameters and options e Options indicated as start up settings are defaults at start up only As a result specifying these command options creates new default values to be used if the options are omitted next time e Options indicated as default are not influenced by previous specifications if later omitted i e these defaults do not change However in commands such as the DUMP command that continuously display memory the value of the memory start address option is inherited from the previous command specification if omitted Command function Command description Notes on command usage Usage examples 60 ASSEMBLE 5 1 ASSEMBLE Assembles line by line A Format ASSEMBLEA lt start address gt RET Parameter e lt start address gt Indicates the address to store the results of assembly Function This command converts assembly language notations to machine language in line units and stores the results starting at the indicated start address Long word or word integer can be defined by the DATA directive Description 1 When this command is entered the current contents of the specified address are displayed and the command enters interactive mode The display and input format are as follows ASSEMBLE lt start address gt RET lt instruction mnemonic gt address xxxx
110. e contents of the stored address is disassembled and displayed as a mnemonic instruction As a result if memory contents are overwritten between trace data acquisition and trace buffer display the displayed mnemonic can differ from the actually executed instruction The trace buffer can hold 1023 instruction execution cycles of data If the 1023th instruction is a delayed branch instruction the trace buffer can hold 1024 instructions 165 TRACE Examples 1 To display the instruction addresses and mnemonics for the last five instructions stored in the trace buffer T 5 RET 00000100 STS L PR R15 00000102 MOV L 00000000 R4 0000010E ADD L 00000001 R4 00000110 MOV gt L 0000000A R3 00000114 CMP GE L R3 R4 2 To display the instruction address instruction mnemonic register data and memory access data for the H 3 instructions starting five instructions back from the end of the trace buffer T 5 3 A RET 00000400 STS L PR R15 PC 00000402 SR 00000000 PSSS OOO SP FFFFFF8 W 00000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 0000002E 00000000 0000000A 00000001 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 FFFFFFF8 00000402 MOV L 00000000 R4 PC 00000404 SR 00000000 HAHA KAKA KH KK HK HH RAR SP FFFFFF8 w 00000000 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 0000
111. e functions are described below 1 C Source Line Display The C source line is displayed at the time of disassembly display trace display coverage display and step execution However the format will differ depending on options specified by the DEBUG_LEVEL command 2 Single Function and Single Source Line Stepping Function The debugging object program can be executed in units of C source functions subroutines or lines Single function execution is performed using the CALL command and single source line execution is performed using the DEBUG_LEVEL STEP or STEP INTO command 3 Symbol Reference There are three classes of symbol scope in C global symbols which are valid over the entire program static symbols which are valid in a single file and local symbols which are valid within a function When only the name of the symbol is specified symbols will be considered valid in the current file or function indicated by the program counter The valid file and function names can be examined using the SCOPE command Symbols in other files or functions can be examined by stating the name of the file and function explicitly Symbol related information can also be examined using the SYMBOL command Table 2 4 shows debugging limitation when a C program is compiled with optimization Table 2 4 Limitations of C Debugging Items Limitations 1 Local symbols of the current function cannot be referenced 2 Source lines
112. e object program Temporary stop restart and initialization of coverage measurement Coverage data measurement is performed between the start of coverage and coverage termination However temporary stop of measurement restart and initialization of measurement data can be selected with the D disable E enable and R reset COVERAGE command options respectively Display of measurement results The DISPLAY_COVERAGE command is used to display the measurement results Four types of display methods selected by options for different purposes are supported e T option Displays CO and C1 coverage e G option Displays the coverage results in units of source line e D option Displays the coverage results in units of machine language e NOandNl options Displays the addresses of lines that were not executed Coverage termination Coverage is terminated using the COVERAGE command termination specification COVERAGE The measured data is stored in the file specified in the coverage start declaration 28 Section 3 Using the Simulator Debugger This section describes the use of the simulator debugger with a sample program See appendix D Sample Program for a source listing of the sample program 3 1 Sample Program Description The sample program used in this manual dumps each record of an SH series object file Lines of data are read from the file and dumped one at a figure Figure 3 1 shows an example of the input data
113. ed with the MAP command 2 3 Loading Debugging Object Programs The simulator debugger loads debugging object programs in the order that sections appear in the source program The loading method differs depending on whether the section is relocatable or not as described below 1 Relocatable Sections Individual sections are loaded consecutively starting at address H 400 so that they do not cross boundaries between the internal ROM space the internal RAM and the internal I O area Example If a program consists of three relocatable sections use a memory map based on the SH7000 memory map mode 0 with an external bus area set up as shown in table 2 2 Table 2 2 Example Memory Map Memory Type Address Number of States Data Bus Width External bus area 1 H 0000000 to H OFFFFFF 3 BS External bus area 2 H 1000000 to H 4FFFFFF 2 8 Internal I O area H 5000000 to H SFFFFFF 3 8 External bus area 3 H 6000000 to H 7FFFFFF 3 8 Internal RAM H F000000 to H FFFFFFF 1 32 Figure 2 1 shows the sizes and load addresses of the three relocatable sections Address H 0000000 Vector area 4 Section A H 0500400 External bus area 1 IO H 1000000 A F Section B coso IOMA External bus area 2 H 5000000 J Internal I O area H 6000000 T Section C H 6700000 External bus area 3 H 8000000 Y H F000000 Internal RAM area H FFFFFFF Section Load Address Size A H 400 H 500000 B H 1000000 1 H 3500000 C
114. edure 4047 TOO MANY BREAK ACCESS The number of break access conditions exceeded the number supported Up to 2 break access conditions can be set 4048 TOO MANY BREAK DATA The number of break data conditions exceeded the number supported Up to 8 break data conditions can be set 4049 TOO MANY BREAK POINTS The number of breakpoints exceeded the number supported Up to 8 breakpoints can be set 4050 TOO MANY BREAK REGISTERS The number of break register conditions exceeded the number supported Up to 8 break register conditions can be set 4051 TOO MANY MACRO DEFINITION The number of macro definitions exceeded the number supported Up to 64 macros can be defined Delete any unnecessary macros and re input the macro definition that generated the error 4052 TOO MANY MACRO VARIABLE The number of macro variables exceeded the number supported Up to 255 macros variables can be used 4053 TOO MANY SECTIONS The number of memory areas allocated with the MAP command exceeded the number supported Up to 10 areas can be allocated 4054 TOO MANY UNDEFINED SYMBOL There are too many undefined symbols Addresses can not be allocated for any other undefined symbols 4055 TRACE COMMAND NOT AVAILABLE The trace command cannot be used since a trace buffer was not allocated Expand the user environment so that a trace buffer can be allocated 4056 TRAP ADDRES
115. elow cdA usr tool RET e Copying files To copy the simulator debugger files from the cartridge tape to the directory made in the above step enter the command below In this example dev rstO is the name of the cartridge tape drive tarA xvfA dev rst0AsdshAcia RET 250 Setting the start up environment To set the start up environment for the simulator debugger follow the instructions below Add the following command to the file login in the home directory setApath usr tool RET If a path has already been specified add the path name usr tool separated by a space to the path list in parentheses When the Born shell or Corn shell is used Add the following command to the file profile in the home directory PATH usr tool RET exportAPATH RET If a path has already been specified add a colon and the path name usr tool after the path list H 3 Equipment The following equipment is required when using the simulator debugger Host computer SPARC Station OS SunOS release 4 0 3 or later version User memory space 4 Mbytes or over Hard disk drive Cartridge tape drive H 4 Special Keys Two special keys are used by the simulator debugger CTRL C and CTRL CTRL C or CTRL indicates pressing C or while the control key is being pressed To use the simulator debugger first make the following settings with the SunOS stty command stt
116. emory area MP 2000 2FFF RET MEMORY AREA ALREADY EXISTS The access type of a memory area that has not been allocated cannot be changed MP 1050 SR RI ET INVALID ADDRESS 131 MAP It is not possible to allocate a single memory are that covers multiple memory areas For example when the area from H O to H 3FFF is the internal ROM area and the external bus area starts at H 4000 the following command generates an error as shown MP_3F00 40FF RET ADDRESS EXCEEDS MEMORY SPACE BOUNDARY In this case this area must be allocated as two separate areas as shown below MP 3F00 3FFEF RET MP 4000 40FF RET To display the memory map from the CPU information file MP M RET lt KIND gt lt START gt lt END gt lt STATE gt lt BUS gt EXT 00000000 OOFFFFFF 3 8 EXT 01000000 O4FFFFFF 2 8 1 0 05000000 OSFFFFFF 3 8 EXT 06000000 O7FFFFFF 3 8 NOT_A 08000000 OEFFFFFF RAM 0F000000 OFFFFFFF 1 32 132 MEMORY 5 26 MEMORY Modifies memory contents M Format Modify MEMORY lt start address gt lt data gt size lt real number gt lt character string gt RET Interactive form MEMORY lt start address gt B W L S D RET Parameters e lt start address gt Specifies the start address to be modified e lt data gt Specifies the new value to be store
117. er is a software tool that simulates execution of programs for the SH series of single chip 32 bit microcomputers on the SunOS 2 to support program development and debugging This manual gives a general description of the functions and usage of the simulator debugger Related information concerning the SH series microcomputers and their C compiler assembler linkage editor and librarian can be found in the following manuals e SH7032 SH7034 Hardware Manual e SH Series C Compiler User s Manual SH Series Cross Assembler User s Manual e SH Series Linkage Editor User s Manual SH Series Librarian User s Manual Notes 1 SPARCstation is a registered trademark of SPARC International Inc It is developed by the Sun Microsystems Corp 2 SunOS is a trademark of Sun Microsystems Corp Notation The following notational conventions are used in this manual 1 2 AIB means that either A or B must be selected but not both A means that A may be omitted Information to be keyed in by the user is underlined lt CTRL gt lt gt means to press the back slash key while pressing the control key lt CTRL gt lt C gt means to press the C key while pressing the control key RET indicates the return key LF indicates the line feed key A triangle A indicates one or more spaces or tabs Hexadecimal values are preceded by H Example H F81A Contents Part I Simulator Debugger SECHON I Da ian
118. erminates specification 157 STUB 2 To display a table of stub execution addresses SB RET lt ENTRY ADDR gt lt RETURN ADDR gt lt SYMBOL gt 00001000 00001000 file c erada 100 file c eradd 100 00001200 00001200 file c entrya 542 file c entrya 542 3 To display the simulator command set specified for the stub execution command registered at address H 1200 SB 1200 RET entry address 00001200 Sfile c entrya 542 00001200 file c entrya 542 return address command M 5000 FF 4 To delete the stub execution registered at address H 1200 SB 1200 RET 158 SYMBOL 5 41 SYMBOL Displays symbol information SY Format SYMBOL lt file name gt lt function name gt lt symbol gt lt member name gt RET Parameters e lt file name gt Specifies the file in which the referenced symbol is defined lt fu Spec e lt sy Specifies the referenced symbol mbo1 gt s lt me Function Displays symbol information Description nction name gt mber name gt Specifies the member referenced ifies the function in which the referenced symbol is defined The following symbol information is displayed according to the specified parameters e Parameter specification and displayed information In items 1 to 3 in the following table information pertaining to the member will be displayed if a structure
119. error occurs Table 2 7 lists the types of errors the error causes and the action of the simulator debugger if execution continues 21 Table 2 7 List of Simulation Errors Processing in Error Type Error Cause Continuation Mode Memory access error 1 Access to a memory area that has not On memory write been allocated nothing is written on memory read all 2 Write to a memory area having the bits areread sd write protect attribute 3 Read from a memory area having the read disable attribute 4 Access to a memory area where memory does not exist Invalid SP instruction 1 Execution of an instruction that places The simulation R15 SP outside the four byte boundary continues identically MOV B reg R15 to the operation of MOV B R15 REG the device MOV W reg R15 MOV W R15 REG Illegal operation 1 Zero division is executed by the DIV1 The simulation instruction continues identically to the operation of the device If the simulator debugger is in stop mode when a simulation error occurs the simulator debugger returns to command wait mode after stopping instruction execution and displaying the error message Table 2 8 lists the states of the PC and SP at simulation error stop 22 Table 2 8 Register States at Simulation Error Stop Error Type Value of the PC Value of the SP Memory access error Error on instruction read Unchanged The address of the instruction that caused the erro
120. es for it with local symbols in the currently valid function static symbols in the file and global symbols valid in the whole program in that order The simulator debugger allows the following specifications to refer to the same symbols of other level or those included in other functions or files e function symbol Refers to the local symbols in the specified function eSfile symbol Refers to the static symbols in the specified file eS symbol Refers to the specified global symbol The valid file and function names can be determined with the SCOPE command For both file names and symbol names items specified with upper case letters and items specified with lower case letters will be treated as distinct objects Examples main c sym Indicates the symbol sym which appears in the file main c func sym Indicates the symbol sym which appears in the function func TEST Indicates the symbol TEST that is included in the file that the program counter is currently pointing to sym Indicates the global symbol sym Caution The following points require caution when programs written in C and programs written in assembler are linked together When an assembler language subroutine is to be called from a C program the subroutine name in the assembler language program must begin with an underscore _ character 52 Example C source Assembler source Read amp b EXPORT _Read _Read To apply a breakpoint to th
121. ess of the system call is specified with the simulator debugger TRAP_ADDRESS command as follows TRAP_ADDRESS TRAP RET 1 Note 1 Specifies TRAP as the location for the start of the system call 3 3 8 Setting and Checking Breakpoints The following command sets a breakpoint so that the program will stop at location H 800040C BREAK 800040C RET 1 BREAK RET 2 lt E D gt lt ADDR gt lt COUNT gt lt COMMAND LINE gt lt SYMBOL E 0800040C i RSS Ssample c main 38 3 4 5 6 7 Notes 1 Sets a breakpoint at address H S00040C 2 Confirms the breakpoint settings 3 The breakpoint enable or disable condition 4 The location where the breakpoint is set 5 The number of times the breakpoint has been passed 6 Command to be executed when the program execution stops at the breakpoint 7 Indicates the symbol corresponding to the location where the breakpoint is set When there is no corresponding symbol nothing is displayed When there are multiple symbols corresponding to the same address the displayed symbol may be different from the symbol used in setting the breakpoint 36 3 3 9 Starting a Trace The following command starts acquiring trace information TRACE CONDITION RET 3 3 10 Program Execution The following command executes the debugging object program starting at the current value of the program counter GO RET Exec instructions 18 T PC 0800
122. gging object program is deleted and the simulator debugger goes to the no program loaded state Except for settings made with the following commands all settings are cleared and the simulator debugger returns to its initial state e EXEC_MODE e MACRO e RADIX To reset the simulator debugger RS RET 143 SAVE 533 SAVE Saves memory data to a file sv Format SAVE lt file name gt lt start address gt lt end address gt lt byte count gt RET Parameters e lt file name gt Specifies the name of the file to be saved When the file extension is omitted the extension dat is supplied e lt start address gt lt end address gt lt byte count gt Specifies the range of addresses to be saved Function Outputs to a file the contents of memory in the specified range as a memory image Notes 1 Ifthe end address of the memory data exceeds the allocated memory areas only that portion of the data within allocated memory areas is saved 2 The data saved with this command differs from that saved with the SAVE_STATUS command Examples 1 To save the memory data from addresses H 2000 to H 3000 in the file sample lo SV sample lo 2000 3000 RET 2 To save the H 100 bytes of memory starting at address H 3000 in the file samp12 1o SV _ sampl2 lo 3000 100 RET 144 SAVE_STATUS 5 34 SAVE_STATUS Saves the current sim
123. ging object programs Specify the correct file name 3015 INVALID RELOCATION EXPRESSION An invalid relocation expression occurred in the debugging object program Correct any errors that occurred in creating the debugging object program 3016 LOADING FAILED sect The section specified by sect could not be loaded Either modify the CPU information file or modify the start address of the section 3017 RELOCATION SIZE OVERFLOW sect The result of relocating the section indicated by sect exceeded the relocation size Review both the displacement size of the section of the corresponding name in the source program as well as the valid object size 3018 SECTION NUMBER 0 There were no executable sections in the debugging object program Add code and data sections to the debugging object program 3019 UNDEFINED SYMBOL symbol The symbol indicated by symbol was not defined in the debugging object program Correct the program to define the corresponding symbol 238 F 2 2 Error Messages during Command Execution Table F 4 lists the error messages displayed during simulator debugger command execution Table F 4 Error Messages during Command Execution Error No 4001 Message ADDRESS EXCEEDS MEMORY SPACE BOUNDARY Error Description and Recovery Procedure It is not possible to allocate areas that exceed the boundaries of the internal ROM area the external
124. gt B byte Searches for byte sized data W word Searches for word sized data default L long Searches for long word sized data lt mask gt Only bits which correspond to 1 bits in the mask are tested The size of the mask data depends on the size of the search data Options Search step width S lt byte count gt Specifies the search step width in byte units The default search step width is the size of the data Data match differ EQ NE EQ equal Searches for data that matches the search data default E not equal Searches for data that differs from the search data Z 90 DATA_SEARCH Function This command searches for the specified data in the specified memory range When the EQ option is specified the addresses of data which match are displayed When the NE option is specified the addresses of data which differ are displayed When the search step width is specified with the S step option the command searches for data only at addresses separated by the step width starting at the start address Example To search for the value 005E from address H 1000 to address H 14FF Ds 1000 14FF 5E RET address 00001004 00001100 000011A8 91 DEBUG_LEVEL 5 13 DEBUG_LEVEL Specifies debug level DL Format Specification DEBUG_LEVEL S II N RET Display DEBUG_LEVEL RET Parameter e Option
125. han 0 4018 DUPLICATE ADDRESS The specified address was already specified Check the value of the address used 4019 EXPRESSION TOO COMPLEX An expression was overly complex Expressions are overly complex when there are 8 or more parentheses 4020 FLOATING POINT DATA OVERFLOW A floating point overflow occurred in the specified precision Review the precision or the data values 4021 FLOATING POINT DATA UNDERFLOW A floating point underflow occurred in the specified precision Review the precision or the data values 240 Table F 4 Error Messages during Command Execution cont Error No Message Error Description and Recovery Procedure 4022 FUNCTION NOT FOUND The function specified in a CALL command does not exist Check the name of the function 4023 ILLEGAL EXPRESSION There was an error in an integer expression Re input the command with a correct expression 4024 ILLEGAL FLOATING POINT DATA There was an error in the format of a floating point data item Review the format of the floating point data item 4025 ILLEGAL MACRO NAME A name which cannot be specified as a macro name was specified Check the macro name 4026 ILLEGAL SYMBOL FORMAT There was a syntax error in a symbol Re input the command with the correct syntax 4027 INVALID ADDRESS The value used was invalid as an address value Specify a valid value 4028 INVALID DATA The value used was in
126. he breakpoint R1 BR R1 D RI ET 75 BREAK_REGISTER 6 To display the currently set breakpoints note that data and masks are displayed in hexadecimal BR RET lt E D gt lt REGISTER gt lt DATA gt lt EQ NE gt lt COMMAND LINE gt lt MASK gt E RO ooo EQ D R1 000000FF EQ REGISTER E R2 000000FF NE E R10 00000002 EQ 00000003 7 To clear the breakpoint RO BR RO RET 76 BREAK_SEQUENCE 5 6 BREAK_SEQUENCE Sets displays and cancels breakpoints based on a BS specified execution sequence Format Set BREAK_SEQUENCEA lt instruction address gt A lt instruction address gt A lt instruction address gt lt command line gt RET Display BREAK SEQUENCE RET Cancellation BREAK _SEQUENCE RET Parameters e lt instruction address gt Specifies the address es that will form the sequential breakpoint condition lt command line gt Specifies a command line to be executed when the break occurs To indicate a double quotation mark in a character string insert two double quotation marks in sequence Function This command sets displays and cancels a breakpoint based on a specified execution sequence Instruction execution stops when the break condition sequential execution of the specified addresses is satisfied during program execution due to a CA
127. he debugging object program is loaded and the simulator debugger enters the command wait state o sdsh sample abs cpu mode2 RET SH S Copy Lice 3 Notes 1 2 3 ERIES SIMULATOR DEBUGGER Ver 1 1 HSO700SDCU1SM right C Hitachi Ltd 1992 nsed Material of Hitachi Ltd sdsh is the simulator debugger command sample abs is the debugging object program file name The colon is the simulator debugger command prompt 32 3 3 3 Memory Map Display and Memory Allocation The MAP command is used to verify the memory map as follows MAP M RET lt KIND gt lt START gt lt END gt lt STATE gt lt BUS gt NOT_A 00000000 O4FFFFFF 1 0 05000000 O5FFFFFF 3 16 NOT_A 06000000 O7FFFFFF ROM 08000000 O8FFFFFF 1 32 EXT 09000000 OeFFFFFF 3 16 RA 0FO000000 OFFFFFFF 1 32 o 2 2 4 AP 0F000000 OFFFFFFF RET 5 Notes The M option displays the memory map specified in the CPU information file 1 Indicates the type of memory ROM Internal ROM area EXT External bus area NOT_A Unused area T O Internal I O area RAM Internal RAM area 2 The first and last addresses of the memory area 3 The number of states 4 The width of the data bus 5 This command allocates the area from H F000000 to H FFFFFFF as a stack area 33 3 3 4 Displaying Section Load Addresses and Allocating Memory Areas The following commands are used to de
128. he simulator debugger displays the number of instructions executed the contents of the registers the last instruction executed as a disassembled instruction and termination information messages b Single instruction execution When the N or I option is specified with the DEBUG_LEVEL command the execution unit for the STEP and STEP_INTO commands becomes the single instruction The STEP command executes subroutines as a single step Each time a single instruction is executed the mnemonic of the executed instruction is displayed If the R option was specified the contents of the registers after execution is also displayed c Single line execution When the S option is specified with the DEBUG_LEVEL command the execution unit for the STEP and STEP_INTO commands becomes the single line d Single function execution In single function execution the CALL command creates the C language function call stack frame and the simulator debugger executes the function Execution is stopped immediately if an error occurs or if a break condition is satisfied 14 e Execution starting from an interrupt vector address The simulator debugger generates a vector address from the vector number specified with the VECTOR command and initiates interrupt processing Execution continues until a break condition is satisfied or until execution is forcibly terminated by a lt CTRL gt lt C gt When execution stops the simulator debugger displays the nu
129. hich an SH 7000 CPU information file is edited Mode 0 is changed to mode 2 in this session cia shmode0 cpu RET lt 1 SH SERIES CIA Ver 1 1 HSO700CICU1SM Copyright C Hitachi Ltd 1992 Licensed Material of Hitachi Ltd OLD FILE NEW CPU FILE NAME shmode2 RET 2 X CPU INFORMATION CPU SH 7000 93 01 25 SH SAMPLE BIT SIZE 32 No Device Start End State Bus 1 EXTERNAL 00000000 OOFFFFFF 3 8 2 EXTERNAL 01000000 O4FFFFFF 2 8 3 I O AREA 05000000 OSFFFFFF 3 8 4 EXTERNAL 06000000 O7FFFFFF 3 8 5 RAM AREA 0F000000 OFFFFFFF 1 32 kk EDIT MENU k 1 ADD 2 DELETE 3 COMMENT 4 CIA ABORT CIA END 2 RET lt 3 DELETE AP NUMBER 1 RET lt 4 REKK CPU INFORMATION CPU SH 7000 93 01 25 SH SAMPLE BIT SIZE 32 No Device Start End State Bus 1 EXTERNAL 01000000 O4FFFFFF 2 8 2 I O AREA 05000000 OSFFFFFF 3 8 3 EXTERNAL 06000000 O7FFFFFF 3 8 4 RAM AREA 0F000000 OFFFFFFF 1 32 210 1 ADD 2 DELETE 3 COMMENT 4 CIA ABORT CIA END MAP MENU 0 ROM 1 EXTERNAL 2 RAM 3 1 0 ie ND ROM AREA START ADDRESS 00000000 _ RET END ADDRESS OOFFFFFE R E STATE
130. hose name is specified following the equal sign When the file extension is omitted cpu is used as the default 5 The state at the time a SAVE_STATUS command was executed in a previous debugging session can be restored by specifying the simulator state file following an equal sign with the stat command line option When the file extension is omitted sav is used as the default 4 2 Exiting the Simulator Debugger To exit the simulator debugger enter the following simulator command line QUIT RET 47 4 3 Simulator Debugger Commands Table 4 1 lists the simulator debugger commands Table 4 1 Simulator Debugger Commands No Command Abbreviation Function 1 ASSEMBLE A Assembles line by line 2 BREAK B Sets displays and cancels breakpoints based on the instruction execution address 3 BREAK_ACCESS BA Sets displays and cancels break conditions based on memory range access 4 BREAK_DATA BD Sets displays and cancels break conditions based on memory data values 5 BREAK_REGISTER BR Sets displays and cancels break conditions based on register data values 6 BREAK_SEQUENCE BS Sets displays and cancels breakpoints based on specified execution sequences 7 CALL CA Calls a function 8 COMMAND_CHAIN CC Executes commands from a file 9 COMPARE CMP Compares memory contents 10 CONVERT CV Calculates expression 11 COVERAGE COV Starts and stops coverage me
131. ile editing deletion addition Allows the contents of the generated CPU information file to be modified by deletion or addition 1 2 Invoking the CIA Program The format of the command line used to invoke the CIA program is shown below o B SH SERIES CIA Ver 1 1 HS0700CICU1S Ccia lt CPU information file name gt RET 1 2 Copyright C Hitachi Ltd 1992 Licensed Material of Hitachi Ltd 1 2 The CIA invocation command Either an existent or a new CPU information file can be specified When an existent CPU information file is specified the program requests the input of a name for the output CPU information file If the extension is omitted the extension cpu is supplied 203 1 3 CIA Usage Procedures and Selection Menus Figure 1 1 shows the procedure used with the CIA program CIA program invocation 1 CPU selection 2 Bit size and comment input processing Continue 3 Memory map specification processing Exit Continue 4 Editing Exit CIA termination Figure 1 1 CIA Usage Procedure 1 The following is presented as a CPU information menu 1 SH 7000 e When 1 SH 7000 is selected the SH 7000 is specified 204 Bit size and comment input The bit size specifies the number of bits in addresses in the memory map and thus defines the settable range For example if a bit size of 28 is spe
132. iler analysis program et Librarian CPU information file Library file Linkage editor Load module SH series simulator debugger Figure 1 1 Methods for Creating Debugging Object Programs 1 3 Simulation Range 1 The simulator debugger supports the following SH series MCU functions e All executable CPU instructions including delayed branch instructions e Exception processing e General registers control registers and system registers e All address areas Refer to the SH Series Programming Manual for details regarding the delay branch instructions 2 The simulator debugger does not support the following SH series MCU functions Programs which use these functions must be debugged using the SH series emulator e Direct memory access controller DMAC e Watchdog timer WDT e Integrated timer pulse unit ITU e Serial communications interface SCI e A D converter e TO port e Timing pattern controller TPC e Interrupt controller INTC e User break controller UBC Section 2 Simulator Debugger Functions 2 1 Environment Specification The simulator debugger handles SH7000 CPUs When creating a CPU information file use the CPU information analysis program CIA to select the CPU type Details of the CIA program are given in part II CPU Information Analysis Program of this manual The instructions that can be used differ according to the
133. ion SET_COVERAGE e Coverage start declaration COVERAGE file name e Program execution Simulator commands e Temporary stop restart and initialization of the coverage measurement COVERAGE option e Display of measurement results DISPLAY_COVERAGE e Coverage termination COVERAGE a Measurement range specification The SET_COVERAGE command specifies the range of the measurement area Up to 16 coverage areas can be specified The program code sections and no other sections are automatically set as the coverage measurement range when the simulator debugger is started or when an object program object module or load module file is loaded with the LOAD command b Coverage start The start of the coverage function is declared with the COVERAGE command Prior to actually starting measurement the file used to store the measured data is specified with the COVERAGE command If a file which already holds measurement data is specified the measurement range and the measurements stored in that file are read out and used thus allowing the measurement to be continued In this case since the measurement range will be read from the file there is no need to specify the range with the SET_COVERAGE command Furthermore the range from the file takes precedence over any SET_COVERAGE command range setting 27 Program execution When coverage measurement preparations are complete use a GO STEP STEP_INTO CALL or VECTOR command to execute th
134. ion can be used to insert instructions in the debugging object program This is referred to as an insertion stub Insertion stubs can be used for example to insert a patch in a program Up to 16 stubs can be specified 2 16 2 Coverage Measurement The final stages of program development i e the steps immediately prior to release as a product include functional evaluation performance evaluation optimization and quality assurance The simulator debugger supports the coverage method which is a testing technique used for quality assurance The coverage function is a function to investigate whether program testing has covered all the program s functions and to determine if those tests are adequate While there are several coverage techniques this simulator debugger supports CO and C1 coverage CO coverage indicates what sections of the program code have been executed as a percentage of the entire object of measurement C1 coverage indicates as a percentage which branch instructions have been tested for the cases of 26 branch taken and branch not taken for all branch instructions within the object of measurement Furthermore the simulator debugger supported coverage functions not only indicate the results as percentages but can also indicate exactly which lines of code have been executed 1 Coverage Measurement Sequence The coverage measurement sequence and the commands used are as follows Measurement range specificat
135. is Read subroutine either of the following commands can be used e From C BREAK _Read e From assembler BREAK _Read Indirect memory values The contents of an address can be referenced by prefixing the address with an asterisk Examples 1000 Indicates the contents of address H 1000 R1 Indicates the contents of the address pointed to by register R1 Line numbers Line numbers are preceded by a number sign The value of a line number is the address of the first location in the machine language code into which that line was compiled Since line numbers should have consecutive values within a single file they must generally be prefixed by a file name If the file name is omitted the file that includes the current value of the program counter will be used The syntax for line numbers is shown below lt file name gt lt line number gt Line numbers are always expressed in decimal The RADIX command has no influence on the interpretation of line numbers Examples sub c 100 Indicates line 100 in the file sub c 120 Indicates line 120 in the file which includes the current value of the program counter Caution e Line number specification is only valid when debugging information output was specified during compilation Also if the specified line number is a line number for which debugging information was not output an error occurs 53 f Special symbols that can be used as location specifiers
136. isplayed Deletion Deletes the stub execution for the specified address When a stub execution is deleted the replacement or insertion command set is deleted and the original execution sequence is restored When the stub start address is omitted all stub execution addresses are deleted In this case a confirmation message will be displayed Respond Y to delete all stub executions or N to cancel the deletion Notes 1 In the following case the stub will be executed twice e If stub execution is interrupted with a manual break and execution resumed with a GO STEP or STEP_INTO command the stub will be executed twice Therefore do not specify stubs that will generate different results when executed twice e g stubs that increment memory in situations where a manual break will be used 2 The STUB command commands and macro commands cannot be used within a stub 3 If the stub start address is specified after a delayed branch instruction stub execution starts before the delayed branch instruction Examples 1 To specify a command set starting with the MEMORY command to be executed just prior to the execution of the instruction at address H 1200 Simulation will be resumed at address H 1200 after execution of the stub commands SB 1200 RET Sets the stub execution start address to be H 1200 STUB gt M 5000 FF RET STUB gt M Specifies the stub execution commands STUB gt RET T
137. it e Bits with the value 1 The mnemonic of these bits is displayed T Indicates true or false referred to by the MOVT CMP TAS TST BT BF SETT and CLRT instruction or indicates carry borrow over underflow referred to by the ADDV C SUBV C DIVOU S DIV1 SHAR L SHLR L ROTR L and ROTCR L instructions S Referred to by the MAC instruction I Functions as an interrupt mask bit Q M Referred to by the DIVOU S and DIV1 instructions e Bits with the value 0 These bits are displayed as a minus sign Example To display the general and control register values R_ RET PO 02000000 SR 000003F 3 4 eee eee eee es eee eee ee VOLT IT ST SP 0FFFFFF4 GBR 00000000 VBR 00000000 MACH 00000000 MACL 00000000 PR 00000000 RO 7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 R8 15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 OFFFFFF4 142 RESET 5 32 RESET Resets the simulator debugger RS Format RESET RET Function This function resets the simulator debugger When this command is executed the registers the memory the debugging object program and the commands are reset to the following states Registers Memory Debugging object program Commands Example All registers are set to 0 All memory settings are cleared The simulator debugger goes to the memory unspecified state All information concerning the debu
138. it hexadecimal number gt Structure Of SEt ooooocnnnnonionnnonnonnonenos lt 4 digit hexadecimal number gt Register name Cannot be referenced because of C compiler optimization ee REG Symbol type Variable VAR SYMBOL Type information Character type 1 byte integer Integer type 2 byte oe Integer type 4 byte oe Floating point type single precision Floating point type double precision Bit type Enumerated type eeeeeeeeee Structure type Union type coccccccnncnnccnnncnncnnncnnccnnnnnnnno Pointer type All other types eeeseeeeeeeee Size LAB FUN VAL The number of bytes the number of bits for integer types with a bit field type specification is displayed as a 4 digit hexadecimal number Bit offset A 2 digit hexadecimal value is displayed only for integer types with a bit field type specification Undefined status Undefined symbols 0 Any other object s es No display SYMBOL Examples 1 To display information concerning the local symbols from the file sample SY Ssample c RET UIMD ST WS A o 00000038 VAR S BYTE 0015 2 To display information concerning the local symbols from the function main in the file sample SY sample c main RET VS A it SP 0008 VAR S LONG 0004 162 TRACE 5 42 TRACE Displays trace buffer
139. lator debugger command can be executed by preceding the name with a caret Macro commands are executed with the dummy arguments in the macro body replaced with the actual parameters specified in the macro call 117 MACRO Deletion A previously defined macro is deleted If a macro name is specified the macro command defined with that name is deleted If the macro name is omitted all defined macro commands are deleted In this case a confirmation message will be displayed Respond Y to delete all macro commands or N to cancel the deletion Notes 1 Macro display definition and deletion as well as execution of commands are not allowed within macro bodies 2 Re direct cannot be specified for macro command execution Examples 1 To define a macro command MA ISTEP RET 0001 gt PAR 0 RET 0002 gt IF 1000 PAR RET If the value of address H 1000 agrees with the parameter 0003 gt SI RET the STEP_INTO command will be executed 0004 gt ELSE RET If they are not the same the STEP command will be 0005 gt S RET executed 0006 gt RET Termination of the IF internal macro command 0007 gt RET Termination of the macro command definition 2 To display the ISTEP macro command MA ISTEP RET ISTEP PAR 0 IF 1000 PAR SI JELSE S 118 3 4 MACRO To execute the
140. llation BREAK_DATA A lt break address gt RET Parameters e lt break address gt Specifies the address whose contents are to be checked during execution e lt data gt lt size gt Specifies the accessed data Although word is the default size when the break address corresponds to a high level language variable the size of that variable will be used Data size B W L B byte Byte data W word Word data L long Long word data e lt mask gt Only the bits for which the mask is set to 1 will be compared When omitted all bits are compared Note that a mask may not be specified when a real number is specified e lt real number gt Specifies floating point number 69 BREAK_DATA e Options Data match differ EQ NE EQ equal Break when the data matches default E not equal Break when the data differs Z Enable disable E D E enable Enables previously set break conditions D disable Disables previously set break conditions e lt command line gt Specifies a command line to be executed when the break occurs To indicate a double quotation mark in a character string insert two double quotation marks in sequence Function This command sets displays and cancels breakpoints based on data written to memory Instruction execution stops when the break condition data written to the specified memory address matches differs from the specified value is sa
141. lue to be stored lt size gt B W L B byte Initialization is performed in byte units W word Initialization is performed in word units default L long Initialization is performed in long word units When the size specification is omitted word is used as the default unless the start address was specified with a high level language variable In that case the size will be the size of that variable Function The initialization data is stored in the specified memory range Example To clear addresses H 1000 to H 1FFF to zero F 1000 1FFF 0 RET 106 co 5 20 GO Executes instructions continuously G Format GO lt start address gt lt break address gt D RET Parameters lt start address gt Specifies the address from which program execution starts When omitted execution starts from the address specified by the current value of the program counter lt break address gt Specifies the address at which to stop program execution Options Break disable D D disable breaks Breakpoints specified with the break commands are temporarily disabled Function This command executes the debugging object program continuously starting at the specified start address The break address break instruction execution cycle count and break disable option specifications are temporary disabled during GO command execution but are enabled again when execution
142. ly function Table A 1 Differences between Line Assemble Command and SH Series Cross Assembler Syntax Item Line Assemble Command SH Series Cross Assembler Location counter Not allowed Allowed reference Example MOV L H 100 R0 R1 Use of the Not allowed Allowed character to Example Example represent unitary Use 0 10 to specify 10 The notation 10 negation e g MOV L 0 10 RO can be used e g MOV L H 10 RO Use of control Allowed in DATA only Allowed directives Label definition Not allowed Allowed Data value Hexadecimal Decimal default radix Handling of instructions that generate warnings with the SH assembler These instructions are errors and no code is generated Code is generated An instruction following a delay branch instruction is branch instruction Invalid slot Instruction Code is generated During simulation exception processing starts 215 An error occurs and no code is generated Appendix B SH Series Assembler Mnemonics Table B 1 lists the mnemonics that can be used with the simulator debugger s line assemble commands Table B 1 Assembler Mnemonics Recognized by the Line Assemble Command Type Instruction Number of Instructions Data transfer MOV MOVA MOVT SWAP XTRCT 5 Arithmetic ADD ADDC ADDV CPM cond 17 operation DIV1 DIVOS DIVOU EXTS EXTU MAC MULS MULU NEG NEGC SUB SUBC SUBV Logic operation AND NOT OR TAS TAT XO
143. m at which command execution is to be performed e lt return address gt Specifies the address of the address to restart the debugging object program after command execution When omitted the debugging object program is restarted at the lt stub start address gt Function Specifies addresses and commands so that instruction execution is interrupted and command execution is performed at the point that the simulator debugger is about to execute the instruction at the stub start address Also displays and clears the stub execution address and command settings Description Set Specifies the stub execution actions as simulator commands Up to 16 stub command executions can be specified However since the command sequence storage area is limited there are cases where a full 16 stubs cannot be specified When the command STUBA lt stub start address gt RET is input a prompt STUB gt indicating that STUB specification is in progress is displayed and the simulator debugger waits for input of the execution command sequence Command line syntax is not checked during command sequence input Error checking is performed during stub execution 156 STUB Display When the stub start address specification is omitted a table of the stub execution start and return positions specified with the STUB command is displayed When the stub start address is specified the simulator command sequence specified for that start address is d
144. mand macros Format Definition MACRO lt macro name gt RET Display MACRO lt macro name gt RET Execution lt macro name gt lt actual parameter gt lt actual parameter gt RET Deletion MACRO lt macro name gt RET Parameters e lt macro name gt Specifies the name of the macro A macro name must be an alphanumeric string starting with an alphabetic character A macro name must be 32 or fewer characters in length Note that upper and lower case characters are not distinguished Since the following symbols are used as macro internal functions they may not be specified as macro names WHILE FOR DO IF ELSE MBREAK CONTINUE Also note that if a simulator debugger command name is redefined as a macro the macro usage will take precedence e lt actual parameter gt Specifies the parameters passed to the macro To omit an actual parameter specify both the comma delimiting the previous actual parameter and a comma to correspond to the omitted parameter Omitted actual parameters are replaced by NULL during macro expansion 116 Function Definition Display Execution MACRO Defines a macro command Up to 64 macro commands can be defined However since the area used for storing the macro definitions is limited there are cases when a full 64 macros cannot be defined When the command line MACROA lt
145. mber of instructions executed the contents of the registers the last instruction executed as a disassembled instruction and termination information messages 2 Trace When trace is enabled during instruction execution the results of the execution of each instruction are written into the trace buffer The trace buffer can hold the results for up to 1023 instruction executions When the 1023th instruction is a delayed branch instruction the trace buffer can store up to 1024 instruction executions The TRACE CONDITION command enables tracing and the TRACE command displays the acquired trace information The following information is stored in the trace buffer e The values of the general registers RO to R15 SP R15 e The values of the control registers SR GBR VBR e The values of the system registers MACH MACL PR PC e The accessed memory data Note that the TRACE CONDITION command is used to specify the types of acquired instructions traced the tracing start and end points and the processing performed when the trace buffer becomes full In addition the SHOW_CALLS command can display the functions called before arriving at the current execution address SHOW_CALLS displays the line numbers called in reverse order The file name function name line number and arguments of the called functions are displayed 2 7 Exception Processing The simulator debugger generates exception processing corresponding to the TRAPA instruc
146. mmand 2 The file name of the C source program sample c in this case 3 A command line option to the C compiler This option specifies that debugging information is output to the relocatable object program 4 This option specifies the optimization level Refer to the SH Series C Compiler User s Manual for more information Create an object module by assembling the source program prog src with the SH series cross assembler using the following command asmsh prog src debug RET Refer to the SH Series Cross Assembler User s Manual for more information 3 Creating the Debugging Object Program Use the linkage editor to combine the object module output by the C compiler with the object module output by the cross assembler by entering the following command line Be sure to include the EXCLUDE DEBUG and ENTRY options Ink sample prog exclude debug entry _main start P 8000400 start D B dt 9000000 RET 30 Here standard library shclib lib and low level library must be specified as default libraries Refer to the H Series Linkage Editor User s Manual for more information 3 3 Simulator Debugger Usage Example This section describes the command inputs and simulator debugger outputs for a sample simulator debugger session 3 3 1 Creating the CPU Information File A CPU information file which corresponds to the SH series device to be used must be created before using the si
147. mmand displays the information related to the specified symbol from the global area of the load module SYMBOL stop_f RET 1 a A Ee neeuneale 09002F48 VAR S WORD 0002 ee IT AIE 2 3 4 5 6 7 Notes 1 Displays the information related to the symbol stop_f from the global area The symbol The symbol s definition address The symbol type VAR indicates that the symbol is variable Indicates whether the data is signed S indicates that the data is signed Indicates the format of the data WORD indicates that the data is a two byte integer The size of the symbol in byte units YA OB W ND 3 3 15 Automatic Command Execution during Simulation The following command instructs the simulator debugger to execute pre registered simulator commands when an attempt is made to execute a specified location STUB 800055E RET 1 STUB gt DISPLAY CHARACTERS ENTRY sample c Print_rec RET _ STUB gt REGISTER RET STUB gt RET 3 2 STUB RET 4 Zy lt ENTRY ADDR gt lt RETURN ADDR gt lt SYMBOL gt 0800055E 0800055E Ssample c Print_rec 85 ssample c brint_rec 85 5 6 7 8 41 Notes 1 This command instructs the simulator debugger to start stub execution when the instruction at address H 800055E is about to be executed 2 Specifies the stub execution commands Here a command to display a message confirming passage through the stub point and a command
148. mulator debugger Refer to part II CPU Information Analysis Program in this manual Our example uses the memory map for the SH7000 extended mode with ROM mode 2 Figure 3 2 gives an overview of the SH7000 mode 2 memory map Refer to appendix C 1 SH7000 Memory Map for more information H 0000000 UU tecate ctcccs os Son nee Internal ROM area 32 bits 1 state H OFFFFFF H 5000000 Internal I O area 16 bits 3 states H 5FFFFFF H 8000000 Vector area H 9000000 ternal ROM area 32 bits 1 state External ROM area 16 bits 3 states H F000000 H FFFFFFF Internal RAM area 32 bits 1 state Figure 3 2 SH7000 Memory Map Mode 2 The internal ROM areas H 0000000 to H OFFFFFF and H 8000000 to H 8FFFFFF correspond to the same area in the SH series but are treated separately by the simulator debugger To use the internal ROM area ranging from H 8000000 as the vector area specify either of the following 31 1 Copy the data from H 8000000 to H 800000F to the memory starting from H O MAP 8000000 800000F RET MOVE 8000000 800000F 0 RET 2 Write H 8000000 to VBR VBR 8000000 RET Since VBR is not affected by reset interrupts copy the data from H 8000000 to H 800000F to the memory starting from H O by entering the command line as shown in item 1 3 3 2 Loading the Program When the simulator debugger is invoked by the following command line t
149. n 4 FR_BUFP RES L L FILE NAME AREA ADDRESS FR_SIZE DATA W H 100 RESERVED align 4 r RTN_CD RES L 1 RETURN CODE SAVE AREA OPEN MODE CONVERSION TABLE a A A o o e E CNV_TBL DATA L STR_O DATA L STR 1 DATA L STR_2 DATA L STR_3 DATA L STR_4 DATA L STR_5 DATA L STR 10 DATA L STR_11 DATA L STR_12 DATA L STR_13 DATA L STR_14 DATA L STR_15 STER_0 SDATAZ TEN SER SDATAZ w STR_2 SDATAZ Tam STR_3 SDATAZ r STR_4 SDATAZ wt STR_5 SDATAZ a STR_10 SDATAZ EDY 231 STR_11 SDATAZ wb STR_12 SDATAZ ab STR_13 SDATAZ r b STR_14 SDATAZ w b STR_15 SDATAZ a b MODE_TBL DATA W H 0000 DATA W H 0001 DATA W H 0002 DATA W H 0003 DATA W H 0004 DATA W H 0005 DATA W H 0010 DATA W H 0011 DATA W H 0012 DATA W H 0013 DATA W H 0014 DATA W H 0015 E MODE CONVERTER REGISTER SAVE AREA r SV_R1 RES L 1 SV_R2 RES L 1 SV_R3 RES L i SV_R4 RES L 1 SV_R5 RES L 1 SV_R6 RES L 1 SV_R7 RES L 1 CNV_STR SRES 16 CNV_RC RES L 1 i a IN a a a i sD Fae ee e eee END 232 Appendix E Limitations on Debugging Object Programs The following type of programs cannot be loaded as debugging object programs An error message will be displayed on attempts to load such programs Condition 1 Section areas overlap Coding example 1 SECTION SC1 CODE LOCATE 0 RES W 1000 SECTION SC2 CODE DATA 100 Since SC2 is a
150. ndefined symbol and its address is used as the value of the symbol These areas are allocated in the external bus space or internal RAM area and are displayed on the screen 112 LOAD Although the LOAD command allocates the required memory when loading a debugging object program memory is not allocated when loading a memory image file In addition before loading a memory image file memory must be allocated using the MAP command Description The figure below shows the load map for a debugging object program and its undefined symbol area Section 1 Internal ROM area Unused gt lt Section 2 External bus space Undefined symbol area See note Note The address of the area allocated will be filled with the number of undefined symbols The initial settings following the loading of a debugging object program are as follows Memory areas The debugging object program areas and an undefined symbol area are allocated Coverage esee The coverage areas are automatically set to be the code sections The maximum number of areas is 16 Plinio If an entry address was specified in the debugging object program the PC is set to that address Otherwise the PC is set to the start address of the code segment that appeared first Pia nine The SP is set to the last address of the internal RAM area 1 No other registers or flags are set 113 LOAD Notes 1 Before loading
151. ngle precision floating point data D double precision Double precision floating point data Function This command displays in the specified format the block of data from the start address to the end address or for the specified number of data items If the end address is omitted 16 lines are displayed starting at the first address After executing the DUMP command once the next 16 lines of data can be displayed by just pressing RET before entering any other command 102 DUMP Examples 1 To display the memory contents in byte units starting at address H 1000 D 1000 B RET address 0 1 2 3 4 5 6 7 8 9 A B C D E FE ASCII 00001000 FF 00 FF 00 FF 00 FF 00 FF 00 FF 00 FF 00 FF 00 00001070 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 ABCDEFGHIJKLMNOP 2 To display two items of single precision floating point data starting at address H 2000 D 2000 2 S RET address 0 1 2 3 00002000 49 96 B4 38 1 234567S 6 00002004 3F 80 00 00 1 0S 0 103 EXEC_MODE 5 18 EXEC_MODE Switches execution mode EM Format Set EXEC_MODE S C RET Display EXEC_MODE RET Parameter e Options Execution mode specifier S C S stop In this mode execution is stopped when the simulator debugger detects an abnormality simulation error in the debugging object program C continue In this mode simulation errors are ignored and execution continues
152. nnconnonno cono no coronan cnn nnn cra nnnncnncnos 48 4 4 Specifying Command ParametelS ooooonccnocnnonnonnnonnnnnonnnonncnnconncnnnon non no cono nn ocn nan nana ranncnncnnos 50 AAT AEXPrESS ION Sinai 50 O ON SO 56 AASB DD ON 56 4 4 4 Floating Point Datasis 3 scicdsssessesisesssassaidsessd sspetveseseoescigseseosesdiessessseibeapeassonveass 57 4 45 Character SMS ici laicas dl ii 57 O 58 44T Comment Liens 58 4 4 8 Limitations on C Expressions ooconoccocnnoncoonnonnnnnnoncnnncnncnononncon conce conoce cancun cnncnnenns 58 Section 5 Simulator Debugger COMMAN S cocoococnnncccnoncccnoncnononanononannnnaccnnnnns 59 5 1 ASSEMBLE 1 eee Assembles line by line ooooonconcninonicnoconacnncncnnnoncconornss 61 5 2 BREAK asias esterases Sets displays and cancels breakpoints based on instruction execution address eee eee eeeeereeeee 63 5 3 BREAK_ACCESS 0 0 Sets displays and cancels break conditions based on access to a range Of MEMOTY eee eee eeeeeeee eee 66 5 4 BREAK_DATA Sets displays and cancels breakpoints based on the value of memory data ooconccnicnonccocnncncnnnnancnncnnss 69 5 5 BREAK_REGISTER Sets displays and cancels break conditions based on the value of data in a register eee 73 5 6 BREAK_ SEQUENCE Sets displays and cancels breakpoints based on a specified execution Sequence ooooooccccocononcncnncnnnos 77 5 7 CAT nea a a Calls a function sirisser sretnete eint sia 79 5
153. nononcnonccnnnnnnnnon 216 Appendix C SH Series Memory Maps ceeccecesececesececseececeeeeesseeeeneerenas 217 Appendix D Sample Programs sessesseseesseesseesseesseresseeesseesseessersseessseeessees 219 Appendix E Limitations on Debugging Object Programs oooonocccnnncccnnnncnnnnos 233 Appendix F AN 235 Fl Information Messages einir se aae non nc nnn conc cnn cn non nn EER RSE S a 235 F1 1 Information Messages at Instruction Execution Interruption ooocnonnnncnon 235 F1 2 Information Messages during Command AnNalySlS oonccnncnnccnncnoccncnnnnnnononancnnnnnss 236 F2 Error MeCSSaSeS irescccss E EEEE N EEE APEE E EE 237 F2 1 Error Messages during Startup or Load Command Execution eee 237 F2 2 Error Messages during Command Execution ooooococnoccconconononconnnanonnnonn nono rancnnconos 239 F2 3 Error Messages during Simulation ooooonnnnoncnnnconcnnconcnnncnonononononcnnn nana rancrncnncnnos 245 F3 CIA Error Messages oir nne EEEE EEE E EE E EE ia EE E RE 247 F3 1 WO Related Error Messages oooooccocnonnioncnnncononnnonnconncn nono co nonnncnnnnnnonn conc irrisa ES 247 F3 2 Keyboard Input Related Error Messages oooococnoccconionncnnconccnnonnnnnnonnnonn cnn crancnnconos 248 Appendix G ASCH Code Tables cai caine ido it 249 Appendix H Installation ssicis accdsisasessscapessccesscessansacedstsgusnceauhaceavetedeusceasesaceasass 250 H 1 Contents of the Cartridge Tape 00 eee ceeeseceeceseceeceseeeeceseeeeceseee
154. omitted the simulator debugger creates a file in the directory from which the simulator debugger was started with the same name as the debugging object program and the extension prt When the file extension is omitted the extension prt is supplied e Options Append mode specification A A append If a file name was specified the execution history is appended to the specified file When this option is omitted the execution history is stored in the file starting at the beginning of the file Write data selection C C commands When the C option is specified only the input commands are written to the file File output suspend restart E D E enable D disable File output is restarted File output is temporarily stopped 137 PRINT Function This command starts the output of a command execution history to a file When the C option is specified only the input commands are saved to the file Furthermore the file output can be temporarily halted restarted and terminated Description Start Starts the output of an execution history to a file If the specified file exists that file is deleted and a new file is created If the A option is specified the execution history is appended to the end of the specified file Temporary stop restart File output is suspended when the D disable option is specified and restarted when the E enable option is specified Terminate Executi
155. on history output is terminated Notes 1 TheC command option only handles typed input and commands executed from command files are not output 2 When an error occurs in command input or in single line I O processing the input output data is not written to the output file ey 3 Execution results from the file command sub process creation are not written to the output 138 PRINT Examples 1 To specify output of input command and displayed data to the file samplel prt and to start output to that file P samplel prt RET To specify output of only input command to the file sample2 prt and to start output to that file P sample2 prt C RET To append an execution history to the file sample 1 prt P samplel prt A RET a To temporarily suspend execution history output P D RET b To resume execution history output gt P E RET 139 QUIT 5 29 QUIT Exits the simulator debugger Q Format QUIT RET Function Exits the simulator debugger and returns to the OS Description 1 If an execution history file is open it will be closed 2 Ifacommand file is open it will be closed 3 If the COVERAGE command is being executed the results up to the present will be written to the file and that file will be closed Note If the coverage data could not be saved due to e g insufficient disk
156. ondition is satisfied while executing an object program the instruction at the break point may or may not have been executed depending on the type of the break as listed in table 2 5 20 Table 2 5 Processing When Satisfying a Break Condition Command Instruction When Satisfying a Break Condition BREAK Not executed BREAK_ACCESS Executed BREAK_DATA Executed BREAK_REGISTER Executed BREAK_SEQUENCE Not executed When a break condition is specified the simulator debugger program execution time increases Table 2 6 shows which break types can increase program execution time Table 2 6 Execution Time Increase Due to Break Condition Specifications Command Change in Execution Time Due to Break Condition Setting BREAK Not increased BREAK_ACCESS Increased BREAK_DATA Increased BREAK_REGISTER Increased BREAK_SEQUENCE Not increased If a break condition is specified at an address location other than the beginning of an instruction the break condition will not be detected When a break condition is satisfied during object program execution a break condition satisfaction message is displayed and execution stops 2 Break Due to Detection of a Run time Error in the Object Program The simulator debugger supports a simulation error to detect program errors which cannot be detected by the CPU exception generation functions The EXEC_MODE command specifies whether to stop or continue the simulation when such an
157. or union member is specified along with the symbol 159 SYMBOL Item Parameter Specification Displayed Information 1 SYMBOL lt file name gt lt function name gt lt symbol gt Information pertaining to the specified local symbol in the SYMBOL lt function name gt lt symbol gt specified function is displayed 2 SYMBOL lt file name gt lt symbol gt Information pertaining to the specified local symbol in the specified file is displayed 3 SYMBOL lt symbol gt Information pertaining to the specified global symbol is displayed 4 SYMBOL lt file name gt lt function name gt Information pertaining to the local symbols in the specified function is displayed 5 SYMBOL lt file name gt Information pertaining to the local symbols in the specified file is displayed 6 SYMBOL Information pertaining to all symbols that can be referenced currently is displayed 7 SYMBOL symbol name Local symbols in the function static symbols in the file and global symbols are searched for in that order and the first symbol to be detected is displayed Symbol information display format Symbol information is displayed in the following format Symbol Value Symbol type Sign information Type information Size Bit offset 1 2 3 4 5 6 7 Undefined status 8 Description 1 Symbol 2 Value Address esiisa nss lt 8 digit hexadecimal number gt Valte UN lt 8 digit hexadecimal number gt SP A iE SP lt 4 dig
158. orrect value 248 Appendix G ASCII Code Table Table G 1 ASCII Code Table Upper 4 Bits Lower 4 Bits 0 1 2 3 4 5 6 7 0 NUL DLE SP 0 P p 1 SOH DC1 1 A Q a q 2 STX DC2 2 B R b r 3 ETX DC3 3 C S c s 4 EOT DC4 4 D T d t 5 ENQ NAK 5 E U e u 6 ACK SYN amp 6 F V f v 7 BEL ETB 7 G WwW g Ww 8 BS CAN 8 H X h X 9 HT EM 9 Y i y A LF SUB J Z j z B VT ESC K k C FF FS lt L D CR GS M m E SO RS gt N A n F SI US O o DEL 249 Appendix H Installation The following instructions describe how to install the SH series simulator debugger in the host system H 1 Contents of the Cartridge Tape The simulator debugger is provided with a cartridge tape which contains the following files e file type archive file e file name Simulator debugger sdsh CPU information analysis program cia H 2 How to Install the Simulator Debbuger in the Host System To install the simulator debugger in the host system follow the instructions below Underlined sections should be input by the user e Making a directory To make a directory for storing simulator debugger files enter the command below The path name is usr tool in this example mkdirA usr tool RET RET Press the return key A Press the space bar or tab key e Changing the directory To change the current directory to the directory usr tool made above enter the command b
159. p information after the addition is displayed 1 5 CIA Limitations Table 1 1 lists the limitations on data specified using the CIA program The CIA program cannot handle values which exceed these limitations Table 1 1 CIA Limitations Item Limitation Value Notes Input file format CPU information files output by the SH CIA Bit size Only values specified in decimal The specifiable range is from 24 to 32 Address specifications Only values specified in hexadecimal The specifiable range depends on the bit size The range is from H O to H FFFFFF when the bit size is 24 Number of states Only values specified in decimal The specifiable range is from 1 to 65535 Specify the number of states including the wait states when wait states are inserted Data bus width Only values specified in decimal The specifiable values are multiples of 8 between 8 and 65528 Comment length Up to 127 characters Number of map information items Up to 65535 items Note that there may be limitations imposed by the memory capacity of the system on which the CIA program is running Invalid regions are also included in the number of items 212 213 Appendix A Differences between Line Assemble Command and SH Series Cross Assembler Syntax Table A 1 lists the differences between the syntax of the SH series cross assembler and the syntax of the simulator debugger line assemb
160. pecified when the CIA program is invoked This item specifies the CPU type 3 The bit size is specified in decimal The displayed default is taken if the specification is omitted 208 Q0u00o0J300 This line is a comment The comment field is left blank if this line is omitted If more than 127 characters are entered a warning message is displayed and the characters following the first 127 are ignored The memory type is entered as a number corresponding to the input menu The start address of the corresponding memory area is entered in hexadecimal The end address of the corresponding memory area is entered in hexadecimal The number of states for the corresponding memory area is entered in decimal The data bus width for the corresponding memory area is entered in decimal Data entry for the corresponding memory area is terminated with a period The edit menu is automatically displayed when the input menu is terminated a The CPU type specified in item 2 b The comment entered in item 4 c The bit size specified in item 3 d The map number e The memory type specified in item 5 f The start address specified in item 6 g The end address specified in item 7 h The number of states specified in item 8 i The data bus width specified in item 9 This input terminates CIA processing normally The memory map data is written to the file specified when the CIA program was invoked 209 2 A sample session in w
161. quisition of coverage data is terminated and the acquired data is output to the file Specify the N option to terminate coverage data acquisition without saving the data to a file Notes 1 Use the SET_COVERAGE command to confirm the setting state 2 The coverage calculation involves disassembling the program to count instructions Asa result correct values cannot be computed for programs which include data within their code areas Examples 1 To start the acquisition of coverage data COV_ RET coverage area 00001000 000012FF 00001800 00001FEF 88 COVERAGE To load a coverage file and start the acquisition of coverage data COV testl cov RET object file name test abs coverage area 00001000 000012FF 00001800 00001FFF To initialize coverage measurement COV R RET To terminate coverage measurement COV RET 89 DATA_SEARCH 5 12 DATA_ SEARCH Searches for data DS Format DATA_SEARCHA lt start address gt A lt end address gt lt byte count gt A lt search string gt lt search data gt lt size gt A lt mask gt S lt byte count gt A EQ NE RET Parameters lt start address gt A lt end address gt lt byte count gt Specifies the range of the addresses to be searched lt search string gt lt search data gt lt size gt A lt mask gt Specifies the string or data to be searched for lt size
162. r Error during instruction execution The address following the instruction that caused the error Invalid SP instruction The address of the instruction that caused the error Illegal operation The address following the instruction that caused the illegal operation Use the following procedure when debugging programs which include instructions that generate simulation errors a First execute the program in stop mode and confirm that there are no errors except those in the intended locations b After confirming the above execute the program in continuation mode Note If an error occurs in stop mode and simulation is continued after changing the simulator mode to continuation mode the simulation may not be performed correctly When restarting a simulation always restore the register contents general control and system registers and memory contents to the state prior to the occurrence of the error The SAVE_STATUS and LOAD_STATUS commands can be used to save and restore the simulation state during debugging 3 Break Due to Overflow of the Trace Buffer When the B option has been specified with the TRACE_CONDITION command the simulator debugger stops execution when the trace buffer becomes full The following message is displayed when execution is stopped TRACE BUFFER FULL If execution is resumed with a GO STEP STEP_INTO or VECTOR command the trace buffer is overwritten starting from the beginning of the buffer
163. ranch address of an executed JSR or BSR instruction is the same as the address specified with this command normal simulation is not performed but rather the system call indicated by the function code is executed A parameter block and an I O buffer must be allocated within the debugging object program The debugging object program must set up RO and R1 the parameter block and the I O buffer before executing the JSR or BSR instruction Simulation is restarted from the instruction following the JSR or BSR when the system call processing finishes The contents of RO and R1 and the other registers are shown below Since the contents stored in the parameter bock differ for each system call function the parameter block contents are described under each function 171 TRAP_ADDRESS MSB 1 byte 1 byte LSB Register RO H 01 Function code Register R1 Parameter block address Display Displays the state of the system call start address setting Clear Clears the system call start address Notes 1 IfaJSR or BSR instruction is executed following a delayed branch instruction an INVALID SLOT INSTRUCTION error occurs during simulation 2 IfaJSR or BSR instruction executed as a system call the following instruction is executed as a normal instruction and not as a slot instruction Accordingly JSR and BSR instructions must not be followed by an instruction whose execution results differ between the cases when
164. relocatable section it will be loaded starting at address H 400 However this overlaps SC1 causing an error Coding example 2 SECTION SC3 CODE ORG H 1000 MOV L RO R1 ORG H 2000 MOV L RO R2 S D SECTION SC4 CODE LOCATE H 1500 DATA 100 END The section SC3 extends from address H 400 to address H 2401 due to the use of the ORG control statement As a result section SC4 overlaps that section and generates an error Note that is possible to avoid this overlap by specifying an appropriate start address for the relocatable section to the H series linkage editor 2 A section with the same name but with a differing attribute CODE DATA STACK or COMMON exists in another unit Coding example UNIT UNIT2 SECTION SC CODE SECTION SC DATA NOP DATA W 100 END END 233 Since the attributes of SC in unit 1 and SC in unit 2 differ an error occurs 3 An object module or load module has a section size of 0 Coding example SECTION SC COD ND GI zal Since SC has a section size of 0 an error occurs 4 A section is allocated across the boundary between memory areas with differing attributes or an absolute address section is allocated to an invalid area Coding example Assuming an SH 7000 CPU information file SECTION SC CODE LOCATE H EF00000 SDATAB H 20000 0123456789ABCDEF END Although SC is allocated from addresses
165. ress are displayed The contents of the immediately preceding address are displayed A period Terminates the command 134 MEMORY b To interactively modify memory a single precision floating point number at a time starting at address H 2000 M 2000 S RET 00002000 1 413991S 3 F 3 1415922S 1 RET 00002004 1 234567S 5 RET 135 MOVE 527 MOVE Copies memory block MV Format MOVE lt start address gt lt end address gt lt byte count gt lt transfer destination address gt RET Parameters e lt start address gt lt end address gt lt byte count gt Specifies the range of addresses to be copied e lt transfer destination address gt Specifies the address of the transfer destination Function Copies the specified range of memory data to the specified transfer destination Note The transfer destination area must have been allocated in advance with the MAP command Example To copy the H 500 bytes of data starting at address H 1000 to the area starting at address H 2000 MV 1000 500 2000 RET 136 PRINT 5 28 PRINT Creates execution history file P Format Start PRINT lt file name gt A C RET Temporary stop restart Terminate Parameters lt file name gt PRINT E D RET PRINT RET Specifies the file name When the file name specification is
166. rmination 1 Error e File number input The number returned when the file was opened e Direction input 0 The offset specifies the position as a byte count from the start of the file 1 The offset specifies the position as an offset from the current file pointer 2 The offset specifies the position as a byte count from the end of the file e Offset input 192 TYPE 5 45 TYPE TY Displays variable value The byte count to be interpreted as specified by the direction parameter 193 TYPE lt Example gt To move the file pointer in sample src to the H 100th byte from the start of the file IMPORT FNUM MOV L PAR_ADR R1 MOV L REQ_COD RO MOV L CALL_ADR R3 MOV L FNUM_ADR R2 MOV B R2 R4 MOV L PAR_ADR R2 ADD L 01 R2 MOV B R4 R2 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL _ADR DATA L SYS_CALL REQ_COD DATA L H 010C0000 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM FSEEK_BUF RES B 2 DATA B 0 RES B 1 DATA W 0 DATA W H 100 END 194 VECTOR 5 46 VECTOR Executes from an interrupt vector address A4 2 9 FTELL lt Function gt Returns the current position of the file pointer lt Function code gt H OD lt Parameter block gt MSB 0 8 15 0 Return value File number 2 Unused 4 Offset upper word 6 Offset lower word 195 VE
167. rted to hexadecimal and stored in the specified address e ASSEMBLE The instruction mnemonics and operands are converted to instruction codes and stored in the specified address The MEMORY and ASSEMBLE commands continue converting and storing contents to memory updating the storage address each time until a termination symbol is read 5 Releasing a Memory Area Memory areas allocated with the MAP command can be released The simulator debugger commands operate as follows when a memory area is released If a break has been set with a break related command it will be cancelled The LOAD_STATUS command retains the released state The SET_COVERAGE command treats released sections as errors at DISPLAY COVERAGE execution e The TRACE command displays an error during assembly and display 2 6 Execution and Trace 1 Execution Types The simulator debugger supports five ways of executing programs that are being debugged continuous execution single instruction execution single line execution single function subroutine execution and execution starting from an interrupt vector address a Continuous execution The GO command starts continuous execution of the object program Continuous execution starts from the specified starting address or from the current value of the program counter Execution continues until a break condition is satisfied or until execution is forcibly terminated by a CTRL C When execution stops t
168. ry area to be used by the object program displays the state and changes the access type for the memory areas used by the debugging object program Description Set Display Modification Deletion This command is used to allocate memory areas other than those allocated when the debugging object program was loaded Up to 20 memory areas can be allocated with the MAP command Displays the start address end address access type and section names of the allocated memory areas When the M option is specified the CPU information file memory map is displayed The memory map information is displayed in the following format lt KIND gt lt START gt lt END gt lt STATE gt lt BUS gt 1 2 3 4 5 1 Memory type Indicates the memory type with a keyword e ROM Internal ROM area e I O Internal I O area e NOT_A Unused area e EXT External bus space e RAM Internal RAM area 2 Start address The address of the start address in the memory specified by the memory classifier 3 Last address The address of the last address in the memory specified by the memory classifier 4 State count The number of memory access states 5 Bus width The width of the memory data bus This form of the command allows the access type of an already allocated memory area to be changed by specifying its start address This form of the command allows an already allocated memory area to be deleted by specifying its start address
169. s Ph_read phg_rec 256 first spare 256 bytes phg_pos short 0 Index initialize rec_num short 0 physical record number initialize Top of dat It Ps ithe record length 2 25 52 2 3 gt 5 9 3255 g_lng phg_rec phg_pos 1 phg_1ng lt 0 phg_lng 256 Adjust to unsigned char Record extracting Loop a SaaS o hac S Sec eR oar aS short 0 ile wi lt phg_lng log_rec wit phg_rec phg_pos physical record butter arfanging 2 52 5 phg_pos gt 255 Set spare 256 bytes to normal extracting area for wi 0 wi lt short 256 wi phg_rec wi phg_rec wi 256 Read Next spare 256 bytes 22 srs Sasa SSS 9 Sessa Ph_read 8phg_rec 256 phg_pos 256 rec_num Name Bin_ascii Binary gt ASCII conver Func Convert 4 bit binary data to 1 ASCII character Bin_ascii p O p gt char 0x0a 222 EY AY 7 xl p char char 0x41 char 0x0a prs Thc MEN else p char 0x30 Re VQ 9 PARAS A ee SS SS ee SAS x Name Ph_read physical 256 bytes read k Func Read 256 bytes via ASM I O simulation subroutine HS SSS RS SR SS a So SS non el void Ph_read bp char bp char pb 256 pp short pis Pr pal Per yo eno 3 Read loop F_read reads 16 bytes data as 1 line INPUT
170. s condition 1002 BREAK DATA Execution was interrupted due to the occurrence lt break location gt AA lt data gt of a break data condition 1003 BREAK POINT Execution was interrupted due to the occurrence of a breakpoint condition 1004 BREAK REGISTER Execution was interrupted due to the occurrence lt register gt A lt data gt of a break register condition 1005 BREAK SEQUENCE Execution was interrupted due to the occurrence of a break sequence condition 1006 MANUAL BREAK Execution was interrupted due to lt CTRL gt lt C gt 1007 SLEEP Execution was interrupted due to the execution of a SLEEP instruction 1008 STEP NORMAL END Execution due to a STEP or STEP_INTO command completed normally 1009 TRACE BUFFER FULL Execution was interrupted at the point the trace buffer became full since the B option was specified to the TRACE_CONDITION command 235 F 1 2 Information Messages during Command Analysis Table F 2 lists the messages displayed by the simulator debugger during command analysis Table F 2 Information Messages during Command Analysis Error No Message Description 2001 FIXED UNRESOLVED EXTERNAL An address was allocated for an unresolved REFERENCE SYMBOL external reference symbol 2002 NO BREAK ACCESS There is no break access condition set 2003 NO BREAK DATA There is no break data condition set 2004 NO BREAK POINT There is no breakpoint condition set 2005 NO BREAK REGISTER There is no
171. seeeseeeseeeeseseneeees 35 3 3 7 System Call Start Address oooonconnconcconnononocnnonncononnnonornon anno nero nonneonncon a ei 36 3 3 8 Setting and Checking BreakpoldtS oooononninninnnnonconnconconncnnconocnnonnnnnn coronan non ccnncnnos 36 3 3 9 Starting a Trace sas acopla 37 3 3 10 Program Execution isaac ir 37 3 3 11 Single Step ExXECU OM ode ltd ea 37 3 3 12 Single Subroutine Execution 20 eee cseesee cee ceseceeceseesecseeseceeeeeeseeeeeeseneeees 39 3 3 18 Trace Butter Display iia A 40 3 3 14 Symbol Display ion a a e 41 3 3 15 Automatic Command Execution during SimulatiON coononnnonicnonninnocnnannnaninnnnnos 41 3 3 16 Coverage Range Display ooocoocnnncnccnionnocnconcononononncon nono conc no cnnonnn non nnnn ran cnnncnncrnos 42 3 3 17 Starting Coverage Data Acquisition coooonoononcnoncnononnconnconoconcnnncnnonnnnnn conc ran nnncnncnnos 42 3 3 18 Setting and Executing Sequential Breakpoint ooonccnnnnonnocnconnncncnnnonnconcnancnnnnnos 43 3 3 19 Coverage Information Display onncnnnninninninnnnononoccnnonnncnnconocononnn cnn nnnn cnn nnnncnncnnos 44 Section 4 Simulator Debugger Invocation and Command Input 0 47 4 1 Invoking the Simulator Debug get eee cece csceeseceecesecneceseeseeseeeseeeeeeseaeeseseneeees 47 4 2 Exiting the Simulator Debugger eee eee ceeee ce ceseceecseeseceseeseceseeseseeeeeeseneeeeeeneeaes 47 4 3 Simulator Debugger COMIMAN S cocoocncoccnoconnnonnnonnnnnonnconno
172. sert two double quotation marks in sequence 2 Command chain files can be nested up to 8 levels 3 Redirection cannot be specified 83 COMMAND_CHAIN Examples 1 To execute the commands in the auto com command file in sequence CC auto com RI ET P out log s 100 END Execution history is stored in out log The debugging object program is executed for H 100 steps starting at the current PC A comment line 2 To use dummy parameters a The following command file uses dummy parameters RADIX 0 MEMORY 1 100 autol sbt The first parameter 0 is used as the argument to the RADIX command The second parameter 1 is used as the first argument to the MEMORY command b The following command executes the commands in the auto1 sbt command file CC _autol sbt D 1000 RET RX D M 1000 100 The RADIX command is executed with D as the actual parameter The MEMORY command is executed with 1000 as the actual parameter 84 COMPARE 5 9 COMPARE Compares memory contents CMP Format COMPAREA lt start address gt A lt end address gt lt byte count gt A lt comparison memory start address gt RET Parameters e lt start address gt A lt end address gt lt byte count gt Specifies the range of memory the source data to be compared e lt comparison memory start address gt Specifies the start of the
173. source lines are displayed and step execution steps in source line units Start up setting e Toption Both C source lines and machine language are displayed and step execution steps in machine language units e Noption Only machine language is displayed and step execution steps in machine language units Assembly source programs are displayed in the same way while the I option is specified Display Displays the current setting state Note The S and I options cannot be specified for files without debugging information 93 DEBUG_LEVEL Examples 1 To display the setting state DL RET Source Instruction Not display S To set the step unit for the STEP and STEP_INTO commands to machine language instruction units DL I RET S 10 RET Sfilename c 100 a b 1 00000556 MOV L R1 RO 00000558 MOV L R3 R2 sfilename c 101 printf simulator debugger n MOV L R5 R3 94 DISASSEMBLE 5 14 DISASSEMBLE Disassembles and displays memory contents DA Format DISASSEMBLEA lt start address gt A f lt instruction count gt lt end address gt RI ET Parameters lt start address gt Specifies the address from which to start disassembly of memory contents lt instruction count gt Specifies the number of instructions to disassemble lt end address gt Specifies the address at which disassembly is terminated Function This command
174. store the return value This specification creates the stack frame sets up the SP PC and PR registers and executes the function The following values are loaded into the SP PC and PR e SP The SP is automatically decremented by an amount corresponding to the size of the area allocated e PC The PC is set to the entry address of the specified function e PR The PR indicates the current PC address 79 CALL The format of the stack frame is as follows 1 Stack frame when a register is used to pass the return value This format is used when the register is equal to or larger than the size of the returned data High f Address Low When the function completes and returns the return value is copied from register RO to the specified address However if no return value storage address is specified the value is not copied 2 Stack frame when the return value is passed to the specified address This format is used when the size of the return value is greater than the CPU register size and the return value address was specified in the CALL command High Address Low The return area address is set to the return value address specified in the command line Argument 1 Argument n Return value area address Argument 1 Argument n 80 CALL 3 Stack frame when the return value is passed on the stack This format is used when the size of the return value is larger than the
175. sumed when this option is omitted Function Specifies the conditions for storing the results of instruction execution in the trace buffer during debugging object program execution due to a CALL GO STEP STEP_INTO or VECTOR command 168 TRACE_CONDITION Description 1 The following items are stored in the trace buffer e The general registers RO to R15 the control registers SR GBR VBR and the system registers MACH MACL PR and PC e The memory access data 2 The trace buffer is initialized at trace start 3 The trace buffer is organized as a ring buffer with storage for 1023 instructions When the B option is specified and when 1023 instructions for trace information have been stored instruction execution is halted and the simulator debugger returns to the command wait state However note that if the 1023th instruction is a delayed branch instruction the simulator debugger enters command wait state when the 1024 instructions of trace information has been acquired When the C option is specified if 1024 or more instructions have been executed the buffer is overwritten starting at the beginning Figure 5 5 shows the contents of the trace buffer A Instruction 1 lt The instruction Execution order executed first 1023 instructions Instruction n lt The instruction executed last Y Figure 5 5 Trace Buffer Contents 169 TRAP_ADDRESS 5 44
176. supports the following SH series registers e General registers RO to R15 SP R15 e Control registers SR GBR VBR e System registers MACH MACL PR PC 1 Initial Register Values Figure 2 2 shows the initial values when the simulator debugger is started up Register name RO R14 R15 SP SR GBR VBR MACH L PR PC 32 bits R14 SP SR GBR VBR MACH MACL it PC Initial value H 00000000 H 00000000 Internal RAM last address 1 1 H 00000000 H 00000000 H 00000000 H 00000000 H 00000000 H 00000000 Entry point address 2 Notes 1 The address following the last address of internal RAM is loaded into R15 When there is no internal RAM R15 is set to H 00000000 2 The entry point address is the address within the section specified either by the assembler END directive or the ENTRY option of the linkage editor The start address of the first section of code is used if no entry point is specified If there is no code section this resister is set to 0 Figure 2 2 Initial Register Values 11 2 Displaying and Changing Register Values The REGISTER command is used to display and confirm the contents of the global control and system registers The lt register gt command is used to change the values of these registers 2 5 Displaying the Memory Map and Allocating Displaying Changing and Releasing Memory 1 Displaying Section Addresses and the Memor
177. t f_no void main Make the file name prompt Write File Name please Read f_name Try to open INPUT file _ F_open will return 0 n successful The number is file ID PE 1 Open failed 2052 Se f no short 0 f_id F_open f_name rt f_no Initialization 2 3 2 9 stop_f shortt 0 Loop control phg_pos shortt 1 Record extract index 1 No data nx f shortt 0 EOF marker l_rec_no shortt 0 Record counter Loop of record read print process Print_rec will return 1 when ending data had been processed 219 ey a a x A while stop_f 0 stop_f Print_rec Completed Close and exit O eH F_close will return 0 successful E 1 unsuccessful F_close f_no Name Printf_rec Read and print records Func Read and printf 1 logical record short Print_rec es Les FER Fi E SAE Ja as short wi put_pos rec_pos rec_lng rtncd char hex_buf 100 asc_buf 100 1_char r_char il_char ir_char hx_p Read 1 record Read_rec sets the data to log_rec array Read rec Save Record IT ID Length and record number rec_v0 1_rec_no rec_it char 0x7f log_rec 0 rec_v0 1_rec_no rec_ln
178. t one character from standard input usually the keyboard OV L PAR_ADR R1 OV L REQ_COD RO OV L CALL_ADR R3 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L SYS_CALL REQ_COD DATA L H 01210000 PAR_ADR DATA L PARM PARM DATA L INBUF 174 TRAP_ADDRESS INBUF RES B 2 END PUTC lt Function gt Outputs one character to standard output lt Function code gt H 22 lt Parameter block gt MSB 0 15 0 2 lt Example gt To output the character A to standard output usually the console OV L PAR_ADR R1 MOV L REQ_COD RO MOV L CALL_ADR R3 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L SYS_CALL C REQ_COD DATA L H 01220000 PAR_ADR DATA L PARM PARM DATA L OUTDATA OUTDATA DATA B A END 175 TRAP_ADDRESS 176 TRAP_ADDRESS 1 3 GETS lt Function gt Inputs a line of characters from standard input A line feed character LF terminates the input line Up to 79 characters can be input in a line If more than 79 characters are input the eightieth character will be converted to a line feed LP lt Function code gt H 23 lt Parameter block gt MSB 0 15 0 2 lt Example gt To input one line from standard input usually the keyboard MOV L PAR_ADR R1 OV L REQ_COD RO MOV L CALL_ADR R3 JSR R3 NOP STOP NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L S
179. t when an address is executed more than once To display the currently set sequential breakpoint BS RET 1ST BREAK POINT 00002000 file c lentry_add 36 2ND BREAK POINT 00002100 file c entry_sub 58 3RD BREAK POINT 00003000 file c entry_mult 102 lt COMMAND LINE gt REGISTER To clear the sequential breakpoint BS RET 78 CALL 5 7 CALL Calls a function CA Format CALLA lt function name gt lt argument gt lt argument gt A lt return address gt RET Parameters e lt function name gt Specifies the name of the function to be simulated lt argument gt These parameters specify the arguments to the function The arguments are pushed onto the stack in order from right to left Expressions which represent data values including floating point values can be used as arguments Data items are stored on the stack in the specified size Up to 63 arguments can be specified When arguments are omitted zero 0 is assumed e lt return address gt Specifies the address to store the return value Function This command creates the stack frame required by C language functions and calls the specified function It can be used for testing individual functions Execution stops if an error occurs or a break condition is satisfied Description Usage The command line specifies the arguments to be passed to the function and the address to
180. termine at what addresses the program sections are loaded and to change the section attributes MAP RET lt START gt lt END gt lt ATTR gt lt SECT_NAME gt 08000400 08000D83 R P 09000000 09000064 RW D 09000068 090035AB RW B a 090035AC 09003663 RW dt 0F000000 OFFFFFFF RW ba 1 2 3 MAP 5000000 SFFFFFF RW RET 5 eT MAP RET lt START gt lt END gt lt ATTR gt lt SECT_NAME gt 05000000 OSFFFFFF RW 08000400 08000D83 R P 6 09000000 09000064 RW D 09000068 090035AB RW B 090035AC 09003663 RW dt 0F000000 OFFFFFFF RW Notes The MAP command displays the currently allocated memory areas 1 The first and last address of each section The section attribute R Read only W Write only RW Read write 3 The section name Sections without a name include the vector area and those allocated by the MAP command 4 The memory areas 08000400 to 08000D83 is section P 09000000 to 09000064 is section D 09000068 to 090035AB is section B 090035AC to 09003663 is section dt 0F000000 to OFFFFFFF is stack area allocated with the MAP command 5 This command allocates memory area 6 The MAP command verifies the allocated memory areas 34 3 3 5 Disassembly Display The following command disassembles 16 lines and displays the result When option I is specified by the DEBUG LEVEL command DISASSEMBLE 8000478 RET
181. th executing the subroutine as though it were a single step S 5 RET 00000000 00000002 00000004 00000006 00000008 STEP NORMAL STS 1 MOV JSR NOP LDS END E PR R15 Q000000C PC R3 file c func subl R15 PR 153 STEP_INTO 5 39 STEP_INTO Performs step execution SI Format STEP_INTO lt step count gt R RET Parameters lt step count gt Specifies the number of instruction execution steps H 1 to H 7FFFFFFF When omitted 1 step is executed Options Register content display R R register Displays the contents of the registers after instruction execution Function Executes instructions one at a time starting at the current program counter for the specified number of steps Description 1 Each time an instruction is executed the mnemonic of the executed instruction is displayed If the R option was specified the contents of the registers are displayed after instruction execution The step unit is set to the source line unit at startup time but can be changed to the machine language instruction level with the I or N option to the DEBUG_LEVEL command When a function is called within the program the called function is also executed one step at a time Execution is halted if a condition set by a break command is satisfied or if a simulator debugger error occurs The cause of the halt is displayed when execution stops The
182. the lt macro body gt execution or iteration condition e lt expression 3 gt The parameter lt expression 3 gt is evaluated after lt macro body gt execution e lt macro body gt The lt macro body gt parameter expresses the sequence of commands or macro internal commands to be executed when the condition is true Function The FOR loop executes lt expression 1 gt and then evaluates lt expression 2 gt If that latter value was any value other than zero the FOR loop executes the lt macro body gt and then lt expression 3 gt The lt macro body gt and lt expression 3 gt are iterated until lt expression 2 gt evaluates to zero If the value of lt expression 2 gt is zero initially the lt macro body gt is not executed even once Multiple simulator debugger commands macro commands or macro internal commands can be included in the lt macro body gt 122 Examples MACRO 1 To display the fifth to tenth elements in array ABC FOR TYPE UM 5 NUM lt 10 ABC NUM 1 NUM NUM 1 2 To operate identically to the loop in example 1 NUM 5 FOR NUM lt 10 TYPE ABC NUM 1 NUM NUM 1 3 DO WHILE Format DO lt macro body gt WHILE lt expression gt Parameters e lt expression gt The lt expression gt parameter expresses the lt macro body gt iteration condition e lt macro body gt The lt macro body gt parameter expresses the
183. the value is zero if the optional ELSE clause is present lt macro body 2 gt will be executed otherwise nothing is executed Multiple simulator debugger commands or macro internal commands can be included in lt macro body 1 gt and lt macro body 2 gt Examples 1 To display the v alue of address H 2000 if its value is any value other than zero TE 2000 13 0 Y D 2000 2 To display the value of address H 2000 if its value is any value other than zero and if its value is zero to display the value of address H 2100 JELSI IF 2000 0 D 2000 E D 2100 125 MACRO 5 MBREAK Format MBREAK Function When an MBREAK command is executed the enclosing WHILE FOR or DO WHILE loop is interrupted and control exits one level of iteration nesting Notes The MBREAK command can only be used inside a WHILE FOR or DO WHILE loop Example To display the values of addresses H 1000 to H 2000 and to terminate the display if the value zero is encountered FOR ADDR 1000 ADDR lt 2000 ADDR ADDR 2 D ADDR IF ADDR 0 MBREAK 126 MACRO 6 CONTINUE Format CONTINUE Function When a CONTINUE command is executed execution of the enclosing WHILE FOR or DO WHILE loop is interrupted and control proceeds to evaluation of the lt expression gt for a WHILE or DO WHILE loop or to the evaluation of lt expression 3 gt for a FOR loop Note
184. tion general illegal instructions slot illegal instructions and address errors Other exception processing is supported as simulates exception processing by the VECTOR command Exception processing simulation is performed in the following sequence When the EXEC MODE command select continuous mode 1 The simulator debugger detects the exception generated during instruction execution 2 PC and SR are saved in the stack area If an error occurs during the saving operation the simulator debugger stops exception processing indicates occurrence of an exception processing error and enters command input wait state 3 The start address is read out of the vector address corresponding to the vector number If an error occurs during this read operation the simulator debugger stops exception processing indicates occurrence of an exception processing error and enters command input wait state 4 Instruction execution is simulated from the start address If the start address was O the simulator debugger stops exception processing indicates occurrence of an exception processing error and enters command input wait state When the EXEC MODE command selects stop mode The simulator debugger executes the above steps 1 to 3 and stops Note In the SH series the stack address which saves the PC and SR during exception processing differs depending on the access size the type of memory and the bus width The addresses used by the simulator deb
185. tisfied during program execution due to a CALL GO STEP STEP_INTO or VECTOR command Description Set Sets up to 8 breakpoints based on the data value written to memory Note that breakpoints are automatically enabled when a breakpoint is set Display Displays the breakpoints set with the BREAK_DATA command Cancellation Cancels clears the breakpoints set with the BREAK_DATA command If no arguments are specified all breakpoints set with the BREAK_DATA command are removed In this case a confirmation message will be displayed Enter Y to remove all breakpoints or N to cancel the removal Note If conditions specified with the BREAK_ACCESS BREAK_DATA and BREAK_REGISTER commands are satisfied simultaneously the corresponding command lines are executed in that order 70 Examples 1 BREAK_DATA To set a breakpoint so that execution stops when word size data with the value 10 is written to address H 2000 and execute the REGISTER command after stopping at the breakpoint BD 2000 10 W REGISTER RET To set a breakpoint so that execution stops when byte size data with a value other than 20 is written to address H AFOO BD OAFOO 20 B NE RET To set a breakpoint so that execution stops when a byte size data whose lower 2 bits have the value 10 is written to BD OFFOO 2 B address H FFOO 3 RET To disable the breakpoint at address H 2000 BD 2000 D RET
186. ugger to save PC and SR are shown in table 2 3 These can be used to easily determine the values of PC and SR at the time of exception processing Table 2 3 Stack Addresses Used to Save PC and SR Type of Register Stack Address PC The address of SP 8 when the exception processing occurs SR The address of SP 4 when the exception processing occurs 16 2 8 Standard VO and File I O Processing The simulator debugger supports standard I O and file I O processing so that the object program can perform I O from standard I O usually the console and keyboard or from disk files The following 13 I O processing types are supported e Single character input from standard input e Single character output to standard output e Single line input from standard input e Single line output to standard output e Single byte input from a file e Single byte output to a file e Single line input from a file e Single line output to a file e File open e File close e File pointer reference e File pointer move e EOF end of file check The TRAP_ADDRESS command is used to implement these functions The user writes a subroutine branch instruction BSR or JSR to a special location for I O in the object program The program is then executed by the simulator debugger with that special location specified by the TRAP_ADDRESS command after starting the simulator debugger The simulator debugger performs I O processing with the contents of RO and R1 as par
187. ulator debugger status in a SS file Format SAVE_STATUS lt file name gt MIA RET Parameters lt file name gt Specifies the name of the file in which to save the simulator debugger status If the file name is omitted the file sdsh sav is used If the extension is omitted the extension sav is supplied Options Data saved M A M memory and registers The status of the memory and registers is saved default A all The complete state of the simulator debugger is saved Function Saves the current status of the simulator The status of the simulator debugger immediately following the execution of this command can be restored by executing the LOAD_STATUS command Description 1 Use with the M option Only the status of the memory and registers is saved This command is useful for example when program errors are expected during execution by the GO STEP or STEP_INTO command If the status of the simulator debugger is saved prior to execution with the GO STEP or STEP_INTO command then the status can be restored after an error occurs Use with the A option The complete state of the simulator debugger is saved This form of the command is useful to resume program debugging from a particular point after exiting and restarting the simulator debugger 145 SAVE_STATUS Notes 1 When the A option is specified the resultant status file is not loaded with the LOAD_
188. unsigned char log_rec 1 rec_v0 1_rec_no rec_no rec_num Make IT characters a il_char char rec_v0 1_rec_no rec_it gt gt 4 ir_char char rec_v0 1_rec_no rec_it amp Ox0f Bin_ascii 8i1_char Bin_ascii 8ir_char Make record length characters 1_buf 15 il_char 1_buf 16 ir_char Print header IT and length 5555 7555 Write l_buf Ending record check Ending record IT is Ox7F if rec_v0 1_rec_no rec_it char 0x7f rtncd short 1 return rtncd Not a endinf record Edit and print each 16 bytes rec_lng short rec_v0 l_rec_no rec_ln short 2 length adjust rec_pos short 2 data position for wi short 0 wi lt short 36 hex_buf wit char 0x20 buffer initial for wi short 0 wi lt short 16 c_buf wi char 0x20 clear hx_p amp hex_buf 0 PES put_pos short 0 1 line position 220 Le JER Tes JER LPS F3 fos while rec_lng gt 0 if put_pos 16 buffer full with 16 bytes print them via asm I O simulation hex_buf 36 char 0x00 Terminal NULL asc_buf 16 char 0x0a Terminal LF and asc_buf 17 char 0x00 NULL Write hex_buf Write ae ere Write asc_buf a Ws BY Ue es rR aaa ca aa eT a a for wi short 0 wi lt short 36 hex_buf wi char 0x2
189. valid as an address value Specify a valid value 4029 INVALID MNEMONIC An instruction mnemonic specified to the ASSEMBLE command was incorrect Input a correct mnemonic 4030 INVALID OPERAND The specified instruction operand was incorrect Input a correct operand 4031 LINE NUMBER NOT FOUND The specified line number could not be found Check the line numbers in the source program 4032 MACRO BUFFER OVERFLOW The macro registration buffer overflowed Delete any unnecessary macros 4033 MACRO VARIABLE NOT FOUND An attempt was made to reference a macro internal variable whose value had not been set Modify the macro to reference the macro internal variable only after its value has been set 4034 MEMORY AREA ALREADY EXISTS The specified memory area was already allocated It is also possible that the address specification was incorrect Check the memory area allocations with the MAP command and then specify a correct value 241 Table F 4 Error Messages during Command Execution cont Error No Message Error Description and Recovery Procedure 4035 MEMORY AREA NOT EXIST The specified memory area has not been allocated Allocate memory areas with the MAP command as necessary and then specify memory areas that have already been allocated 4036 NESTING OF COMMAND_CHAIN EXCEEDS 8 The command chain nesting exceeded 8 levels Revise usage of the COMMAND_CHAIN command so that the nesting level does not excee
190. value to be used in all processing following the open 179 TRAP_ADDRESS Open mode Input OO 32 fxr 01 3 y 02 Ma O a 04 wt O S e Man LO Web 11 wb Ds Tap T3 2 rb 14 wb ES gt Mabe These modes are interpreted as follows Open for reading Open for writing Open for appending write starting at the end of the file Open for reading and writing Open an empty file for reading and writing a Open for reading and appending b Open in binary mode 25 9 5 Start address of file name The first address in the area that holds the file name 180 lt Example gt To open the file sample src EXPORT FNUM MOV L PAR_ADR R1 MOV L REQ_COD RO MOV L CALL_ADR R3 JSR R3 NOP SLOR NOP SYS_CALL NOP ALIGN 4 CALL_ADR DATA L SYS_CALL REQ COD DATA L H 01250000 PAR_ADR DATA L PARM PARM FOPEN_BUF RES B 1 FNUM RES B 1 DATA B O0 RES B 1 DATA L FNAME FNAME SDATA sample src DATA B 0 END FCLOSE lt Function gt Closes a file lt Function code gt H 06 lt Parameter block gt 181 TRAP_ADDRESS TRAP_ADDRESS MSB 0 8 15 0 Return value File number e Return value output 0 Normal termination 1 Error File number input The number returned when the file was opened lt Example gt To close the file with the file number 2
191. when the file was opened e Buffer size input The size of the area for storing data A maximum of 256 bytes can be stored e Input buffer start address input The start address of the buffer for storing input data 187 TRAP_ADDRESS lt Example gt To read character string data from the file sample src IMPORT FNUM MOV L PAR_ADR R1 OV L REQ_COD RO MOV L CALL ADR R3 OV L FNUM_ADR R2 OV B R2 R4 OV L PAR_ADR R2 ADD L 01 R2 MOV B R4 R2 JSR R3 NOP STOP NOP SYS_CALL NOP CALL_ADR DATA L SYS_CALL REQ_COD DATA L H 01290000 PAR_ADR DATA L PARM FNUM_ADR DATA L FNUM PARM RES B 2 DATA W 256 DATA L INBUF OUTDATA RES B 256 END 2 6 FPUTS lt Function gt Writes character string data to a file The NULL character terminating the character string is not written to the file lt Function code gt H 2A 188 TRAP_ADDRESS lt Parameter block gt MSB 0 8 15 0 Return value File number 2 Unused AO eA 6 Start address of output buffer e Return value output 0 Normal termination 1 Error e File number input The number returned when the file was opened e Output buffer start address input The start address of the buffer used to hold the output data 189 TRAP_ADDRESS lt Example gt To write the character string Hello world the file sample src IMPORT FNUM MOV L PAR_ADR R1 MO
192. y Map The addresses where the debugging object program is loaded can be confirmed by using the MAP command to display the section addresses In addition the MAP command M option can be used to display the memory map from the CPU information file specified at simulator debugger start up 2 Memory Area Allocation The MAP command is used to allocate vector areas and stack areas and to allocate memory areas which have not yet been allocated by the debugging object program The following conditions must be satisfied when allocating an area otherwise an error will occur e The allocated area must not overlap a previously allocated section e The allocated area must not cross over the boundary between two different memory types e The allocated area must not include any part of an invalid area The MAP command can allocate a maximum of 20 memory areas 3 Displaying Memory Contents The memory contents can be displayed by using the DUMP or DISASSEMBLE command e DUMP The memory contents of the specified address range are displayed as hexadecimal and ASCII data or in floating point format e DISASSEMBLE The memory contents of the specified address range are displayed as instruction mnemonics and operands An error is generated if an unallocated area is specified as the memory area 4 Changing the Contents of Memory The contents of memory can be changed by using the MEMORY or ASSEMBLE command e MEMORY The input values are conve
193. y intr CTRL C sty quit CTRL CTRL C When the special key CTRL C is entered command execution stops immediately and the simulator debugger returns to the command wait state 251 Ex 1 Ex 2 Ex 3 Note During execution of the user program by a CALL STEP STEP_INTO or VECTOR command CTRL C stops the program execution are returns the simulator debugger to the command wait state While the contents of memory or the trace buffer are being displayed by a DUMP or TRACE command CTRL C stops the command execution and returns the simulator debugger to the command wait state During execution of a command file by a COMMAND_CHAIN command CTRL C stops the command execution and returns the simulator debugger to the command wait state During interactive command input CTRL C does not return the simulator debugger to the command wait state nn To exit the interactive command input state enter CTRL Y The special key CTRL terminates the simulator debugger and returns it to the SunOS command wait state Note When CTRL is entered SunOS creates the core file core on the current directory 252
194. ystem File names can be optionally enclosed in double quotation marks 4 4 7 Comment Lines Lines beginning with a semicolon are treated as comment lines by the simulator debugger The simulator debugger takes no action for comment lines 4 4 8 Limitations on C Expressions Table 4 3 lists the limitations on C expressions used in command parameters Table 4 3 C Expression Limitations and Workarounds No Limitation Workaround 1 Arrays are limited to 2 dimensions Acquire the starting address of 3 dimensional or greater arrays with the SYMBOL command and then specify the address by computing the index with an expression 2 Parentheses are limited to 8 nesting Simplify the structure of the parameter to reduce levels the number of parentheses 3 Pointers and arrays are limited to Simplify the data structures or specify the 8 levels reference with an address Pointers otr Arrays a b c d e f g h 011111111 58 Section 5 Simulator Debugger Commands This section provides detailed descriptions of the individual simulator debugger commands Figure 5 1 shows the command description format used in this section Format 6 Parameter 7 Function 8 Description 9 Note 0 Example q Figure 5 1 Command Description Format The numbered items in the above format are described below Section number Command name Command abbreviation Command function Command nam
Download Pdf Manuals
Related Search
Related Contents
363.12492-M843s-Manual del usuario i.Serie - Helmer Samsung SGH-I700 Инструкция по использованию Manual de Usuario - Innovamer Comunicaciones 6 digits IN-18 BIG Nixie Clock . Best seller! CentreCOM x210シリーズ リリースノート Copyright © All rights reserved.
Failed to retrieve file