![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
Objective Real-Time Software on the ADSP21XXTREE ver. 1.1, ADSP Code Analyzer.IntroductionTREE is a DOS utility, for use with Analog Devices ADSP Assembler code. TREE finds all the labels in an assembler file and generates trees of calls and jumps, to provide insight into the operation of inadequately documented assembler code. TREE goes a long way to shedding light on unfamiliar code. It also provides pretty printed output for documentation use in the source files. OperationThe problem with assembler code is that all labels appear equal, while some are more equal than others... It can be very difficult and frustrating to find out whether a label is only there for aesthetic purposes, whether it it is a jump target, or the start of a procedure. TREE analyzes all labels in an ADSP assembler file and constructs four output files from the label database:
All these files are ASCII plain text columnar data and each output file has its merit, but the usefulness depends upon the type of mess you have to analyze. Legend:
If the code is properly written, but undocumented, you only need to look at the .cal or .prt files, to find out where the procedures start and who is calling whom. The .prt file can then be used to document the source. If however, the code is a ball of spagetti, you have to consult the .lbl or .xrf files, for a more complete picture of what you are up against. UseageTREE is intended to be command line or batch file driven. Use the DOS dir command to create a batch file called t.bat.
Edit the list of files in t.bat and then run TREE on all assembler files in rapid succession using this batch file.
This example shows a properly constructed procedure. It has no redundant labels and no spagetti cross links to other procedures or patches. The trees always show all instances of jumps and calls, in the order in which they occur in the source file. Run TREE on a bad piece of spaghetti code and you'll be amazed at what you'll learn about the file structure. You can use the procedure header blocks in the .prt files to document your source code. Fill in the description and constraints fields as you learn more about the code, for future reference. AssumptionsIn order to achieve high speed of operation, TREE makes a few assumptions. It assumes the code is logically organized. That is, a procedure should not be distributed in the form of random blocks all over the file. We have seen this kind of garbage, but it is the rare exception. If the code is that brain dead, it should be rewritten! TREE processes the source file in a top down fashion and will therefore associate pieces of jump table code, with the procedure immediately above it, which is usually a fair assumption. TREE will also associate dead code, that is, procedures that were written but never called, with the procedure immediately above it, since it can only positively identify a piece of code as a procedure, if there is a .ENTRY stamement, or if it is called from somewhere in the file. |
|
Copyright © 1996-2008, Aerospace Software Ltd., GPL. |