Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 308
 2012 Microchip Technology Inc.
Here are some examples.
The option -FIND=3412@0-7FFF/2w will detect the code sequence 1234h when 
aligned on a 2 (two) byte address boundary, between 0h and 7FFFh. w indicates that 
a warning will be issued each time this sequence is found.
In this next example, -FIND=3412M0F00@0-7FFF/2wt”ADDXY”, the option is the 
same as in last example but the code sequence being matched is masked with 000Fh, 
so HEXMATE will search for any of the opcodes 123xh, where x is any digit. If a 
byte-mask is used, is must be of equal byte-width to the opcode it is applied to. Any 
messaging or reports generated by HEXMATE will refer to this opcode by the name, 
ADDXY as this was the title defined for this search.
If HEXMATE is generating a log file, it will contain the results of all searches. -FIND 
accepts whole bytes of HEX data from 1 to 8 bytes in length. Optionally, -FIND can be 
used in conjunction with REPLACE or DELETE (as described below).
8.6.1.8
-FIND...,DELETE
If the DELETE form of the -FIND option is used, any matching sequences will be 
removed. This function should be used with extreme caution and is not normally 
recommended for removal of executable code.
8.6.1.9
-FIND...,REPLACE
If the REPLACE form of the -FIND option is used, any matching sequences will be 
replaced, or partially replaced, with new codes. The usage for this sub-option is:
-FIND...,REPLACE=Code [mMask]
where:
• Code is a little endian hexadecimal code to replace the sequences that match the 
-FIND
 criteria.
• Mask is an optional bit mask to specify which bits within Code will replace the 
code sequence that has been matched. This may be useful if, for example, it is 
only necessary to modify 4 bits within a 16-bit instruction. The remaining 12 bits 
can masked and be left unchanged.