📄 readme
字号:
READMEvAVRdisasm - Version 1.2 - 2007/01/06Vanya A. Sergeev - <vsergeev@gmail.com>================================================================================Table of Contents1. ABOUT vAVRdisasm2. LICENSE3. COMPILING vAVRdisasm4. USING vAVRdisasm5. Ghetto Address Labels6. Shortcomings7. Source Code8. Sample Disassembly Outputs ================================================================================1. ABOUT vAVRdisasm================================================================================vAVRdisasm is an AVR program disassembler. It supports all 136 AVR instructions as defined by the Atmel AVR Instruction Set, revision 0856E-AVR-11/05.This single-pass disassembler can handle Atmel Generic, Intel HEX8, and Motorola S-Record formatted files containing valid AVR program binaries.vAVRdisasm features a handful of formatting options, including: - Printing the instruction addresses alongside disassembly, enabled by default - Printing of the destination comments of relative branch/jump/call instructions, enabled by default - Ghetto Address Labels (see "Ghetto Address Labels" section) - Formatting data constants in different bases (hexadecimal, binary, decimal) - .DW data word directive for data not recognized as an instruction during disassembly.vAVRdisasm should work on most *nix platform, including a Cygwin environment.vAVRdisasm was written in C by Vanya A. Sergeev - <vsergeev@gmail.com>, and tested with the GNU C Compiler.2. LICENSE================================================================================vAVRdisasm is released under the GNU General Public License. You should have received a copy of the GNU General Public License along with this program; see the file "COPYING". If not, visit http://www.gnu.org or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.3. COMPILING vAVRdisasm================================================================================Simply by running,$ make in the vAVRdisasm project directory should compile vAVRdisasm on most*nix systems, including a Cygwin environment. The Makefile is configured to use GCC to compile vAVRdisasm.vAVRdisasm should have no problem being compiled with "gmake".4. USING vAVRdisasm================================================================================vAVRdisasm prints its disassembly output to stdout.* File Input: For most purposes, just type $ ./vavrdisasm <AVR program file> Example: $ ./vavrdisasm sampleprogram.hex vAVRdisasm will auto-recognize Atmel Generic, Intel HEX8, and Motorola S-Record files by their file extensions, but if it fails to do so, use the the -t or --file-type option to specify the file format. Example: $ ./vavrdisasm -t generic sampleprogram The file type argument to the option can be "generic", "ihex", or "srecord" for Atmel Generic, Intel HEX8, or Motorola S-Record formatted files, respectively.* Options --data-base-... vAVRdisasm will default to formatting data constants in base hexadecimal. However, data constants can be represented in a different base with one of the following options: --data-base-hex, --data-base-bin, and --data-base-dec.* Options --no-... By default, vAVRdisasm will print the instruction addresses alongside disassembly and destination comments for relative branch, jump, and call instructions. These formatting options can be disabled with the --no-addresses and --no-destination-comments options.* Options -l or --address-label For usage information on the -l or --address-label option see the "Ghetto Address Labels" section.* Options -h or --help, -v or --version The -h or --help option will print a brief usage summary, including supported program options and file types. The -v or --version option will print the program's version number.If you encounter any program bugs or problems, please notify the programauthor by email: Vanya A. Sergeev - <vsergeev@gmail.com>.5. Ghetto Address Labels================================================================================vAVRdisasm supports a unique formatting feature: Ghetto Address Labels, which few, if not any, single-pass disassemblers implement.With the -l or --address-label option and a supplied prefix, vAVRdisasmwill print a label containing the (ideally) non-numerical supplied prefix and the address of the disassembled instruction at every instruction. Also, all relative branch, jump, and call instructions will be formatted to jumpto their designated address label.This feature enables direct re-assembly of the vAVRdisasm's disassembly.This can be especially useful for quick modification of the AVR program assemblycode without having to manually format the disassembly or adjust the relativebranch, jump, and call distances with every modification to the disassembly.The -l or --address-label option overrides the default printing of theaddresses alongside disassembly. Destination comments can still be used.Example:$ ./vavrdisasm -l "A_" sampleprogram.hexvAVRdisasm's disassembly will include address labels that will look like thisA_0000:. For sample disassembly outputs by vAVRdisasm, see the"Sample Disassembly Outputs" section.6. Shortcomings================================================================================vAVRdisasm does not disassemble and display alternate versions of the sameencoded instruction (i.e. showing "eor" in additon to "clr"). This technicallymeans that the "cbr" instruction can never be displayed in the disassembly because the "andi" instruction precedes it in priority.vAVRdisasm does not display the original opcode of the disassembled instruction.The original opcode can be convenient for some disassembled instructions thatwere actually meant to be data words (.DW).These feature do not affect the accuracy of the disassembler's output, and may be supported in future versions of vAVRdisasm.7. Source Code================================================================================vAVRdisasm's source code is heavily commented, because this disassembler wasalso a personal learning project of the author.Operand prefixes (such as "R" for register operands or "$" for data operands)can be customized in the format_disasm.h header file. Field width spacing of the addresses printed alongside disassembly, and thedestination relative address comments can be customized in the ui_disasm.csource file.The output file (default is stdout) can be changed in ui_disasm.c source file.vAVRdisasm uses libGIS, a free Atmel Generic, Intel HEX8, and Motorola S-Record Parser Library to parse formatted files containing AVR program binaries. libGISis available for free under a Public Domain license at:http://www.frozeneskimo.com/electronics/libgis-free-atmel-generic-intel-hex-and-motorola-s-record-parser-library/libGIS is compiled into vAVRdisasm--it does not need to be obtained separately.8. Sample Disassembly Outputs================================================================================These disassembly samples, produced by vAVRdisasm, are of the program code in the "Novice's Guide to AVR Development" article of the Atmel ApplicationsJournal.$ ./vavrdisasm sampleprogram.hex 0: rjmp .0 ; 0x2 2: ser R16 4: out $17, R16 6: out $18, R16 8: dec R16 A: rjmp .-6 ; 0x6$ ./vavrdisasm --no-destination-comments sampleprogram.hex 0: rjmp .0 2: ser R16 4: out $17, R16 6: out $18, R16 8: dec R16 A: rjmp .-6$ ./vavrdisasm --no-addresses sampleprogram.hexrjmp .0 ; 0x2ser R16out $17, R16out $18, R16dec R16rjmp .-6 ; 0x6$ ./vavrdisasm --no-addresses --no-destination-comments sampleprogram.hexrjmp .0ser R16out $17, R16out $18, R16dec R16rjmp .-6$ ./vavrdisasm -l "A_" sampleprogram.hex.org 0x000A_000: rjmp A_002 ; 0x2A_002: ser R16A_004: out $17, R16A_006: out $18, R16A_008: dec R16A_00A: rjmp A_006 ; 0x6$ ./vavrdisasm -l "A_" --no-destination-comments sampleprogram.hex.org 0x000A_000: rjmp A_002A_002: ser R16A_004: out $17, R16A_006: out $18, R16A_008: dec R16A_00A: rjmp A_006The program sample above is modified slightly to illustrate vAVRdisasm's abilityto represent data constants in different bases.$ ./vavrdisasm --data-base-bin sampleprogram2.hex 0: rjmp .0 ; 0x2 2: ser R16 4: out $17, R16 6: ldi R16, 0b00100011 8: out $18, R16 A: dec R16 C: rjmp .-6 ; 0x8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -