Expand
When the Keil C51 compiler compiles a program, it generates a list file with the extension LST, also known as a listing file.
This file contains a wealth of information about the compilation process. The file consists of multiple sections, of which the Symbol Listing and Module Information sections are particularly useful for users to analyze and debug programs. The following is an explanation of the order in which each section appears in the listing file:
1. Page Header
Each lst file has a header containing the compiler version number, source file name, date, time, and page number. Example:
C51 COMPILER V7.20 MEASURE 10/01/2004 14:05:05 PAGE 1
2. Command Line
The command section shows all the commands passed when Keil IDE calls the C51 compiler. For example:
C51 COMPILER V7.20, COMPILATION OF MODULE MEASURE
OBJECT MODULE PLACED IN Measure.OBJ
COMPILER INVOKED BY: C:KeilC51BINC51.EXE Measure.c HOLD(128,
-0,0) OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECT
-EXTEND CODE LISTINCLUDE SYMBOLS
3. Source Code
The source code section shows each source program line and its line number.
The COND directive can control whether the conditional compilation code (the code within the scope of #if) is listed in the source code segment, and the NOCOND directive can control whether the conditional compilation code is listed in the source code segment.
Users can use the LISTINCLUDE directive to display the contents of files included in #include in the source code segment. By default, the contents of files included in #include are not displayed.
Example source code snippet:
53 char code ERROR [] = "n*** ERROR: %sn"; 54 55 #define PERIOD -250 56 #define WRONGINDEX 0xffff 57 58 59 /* The following function is called from */ 60 /* the interrupt service routine. */ 61 /* Save current measurements in save_record */ 62 63 64 #pragma REGISTERBANK (1) 65 66 static void save_current_measurements (void) { 67 1 save_record[sindex++] = current; 68 1 if (sindex == SCNT) sindex = 0; 69 1 if (sindex == savefirst) { 70 2 if (++savefirst == SCNT) savefirst = 0; 71 2 } 72 1 } 73 74 75 /* Timer 0 interrupt service function */ 76 /* executes each 250 usec @ 12 MHz Crystal Clock */ 77 78 void timer0 (void) interrupt 1 using 1 { 79 1 80 1 unsigned char i; 81 1 82 1 if (measurement_interval) { 83 2 save_current_measurements (); 84 2 measurement_interval = 0; 85 2 }
4. Assembly Listing
The assembly code segment contains the assembly code generated by compiling the C language program. The CODE instruction can control the LST file to generate the assembly code segment.
Assembly code snippet example:
; FUNCTION save_current_measurements (BEGIN) ; SOURCE LINE # 66 ; SOURCE LINE # 67 0000 0500 R INC sindex+01H 0002 E500 R MOV A,sindex+01H 0004 AE00 R MOV R6,sindex 0006 7002 JNZ ?C0064 0008 0500 R INC sindex 000A ?C0064: 000A 14 DEC A 000B FF MOV R7,A 000C 120000 R LCALL L?0079 000F A809 MOV R0,AR1 0011 FC MOV R4,A 0012 7D01 MOV R5, #01H 0014 120000 R LCALL L?0077 ; SOURCE LINE # 68 0017 E500 R MOV A,sindex+01H 0019 B4E80A CJNE A,#0E8H,?C0001 001C E500 R MOV A,sindex 001E B40205 CJNE A,#02H,?C0001 0021 E4 CLR A 0022 F500 R MOV sindex,A 0024 F500 R MOV sindex+01H,A 0026 ?C0001: ; SOURCE LINE # 69 0026 E500 R MOV A,sindex+01H 0028 B5001B R CJNE A,savefirst+01H,?C0004 002B E500 R MOV A,sindex 002D B50016 R CJNE A,savefirst,?C0004
5. Symbol Listing
The symbol list segment contains the variable information defined in the source program file, such as variable name, category (SFR, structure, typedef, static, public, auto, extern), storage space, data type, offset, number of bytes occupied, etc. The SYMBOLS instruction controls the LST file to generate the symbol list segment.
Example of a symbol list segment:
NAME CLASS MSPACE TYPE OFFSET SIZE ==== ===== ====== ==== ====== ==== P4 . . . . . . . . . . . . SFR DATA U_CHAR 00E8H 1 P5 . . . . . . . . . . . . SFR DATA U_CHAR 00F8H 1 BD . . . . . . . . . . . . ABSBIT ----- BIT 00DFH 1 current. . . . . . . . . . PUBLIC DATA STRUCT 0000H 11 ERROR. . . . . . . . . . . PUBLIC CODE ARRAY 0416H 16 sindex . . . . . . . . . . PUBLIC DATA U_INT 000BH 2 clock. . . . . . . . . . . * TAG * ----- STRUCT ----- 5 hour . . . . . . . . . . MEMBER ----- U_CHAR 0000H 1 min. . . . . . . . . . . MEMBER ----- U_CHAR 0001H 1 sec. . . . . . . . . . . MEMBER ----- U_CHAR 0002H 1 msec . . . . . . . . . . MEMBER ----- U_INT 0003H 2 size_t . . . . . . . . . . TYPEDEF ----- U_INT ----- 2 menu . . . . . . . . . . . STATIC CODE ARRAY 00C7H 847 ADCON. . . . . . . . . . . SFR DATA U_CHAR 00D8H 1 mdisplay . . . . . . . . . STATIC DATA BIT 0001H 1 interval . . . . . . . . . PUBLIC DATA STRUCT 0014H 4 interval . . . . . . . . . * TAG * ----- STRUCT ----- 4 min. . . . . . . . . . . MEMBER ----- U_CHAR 0000H 1 sec. . . . . . . . . . . MEMBER ----- U_CHAR 0001H 1 msec . . . . . . . . . . MEMBER ----- U_INT 0002H 2 wchar_t. . . . . . . . . . TYPEDEF ----- CHAR ----- 1 _getkey. . . . . . . . . . EXTERN CODE PROC ----- ----- BSY. . . . . . . . . . . . ABSBIT ----- BIT 00DCH 1 _toupper . . . . . . . . . EXTERN CODE PROC ----- ----- _printf. . . . . . . . . . EXTERN CODE PROC ----- ----- _set_interval. . . . . . . EXTERN CODE PROC ----- ----- _read_index. . . . . . . . STATIC CODE PROC 0000H ----- buffer . . . . . . . . . AUTO DATA PTR 0000H 3 index. . . . . . . . . . AUTO DATA INT 0003H 2 args . . . . . . . . . . * REG * DATA U_CHAR 0007H 1 measurement_interval . . . STATIC DATA BIT 0002H 1
6. Module Information
The module information segment provides the size information of various storage areas used in the source program file, for example:
MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 902 ---- CONSTANT SIZE = 1062 ---- XDATA SIZE = 8184 ---- PDATA SIZE = ---- ---- DATA SIZE = 24 8 DATA SIZE = ---- 15 BIT SIZE = 3 ---- END OF MODULE INFORMATION.
7. Warnings and Errors
The LST file saves the errors and warnings generated during the compilation process in the warning and error sections. These messages are the same as the prompts displayed on the screen during compilation.
Previous article:Limitations of the C51 compiler in KEIL
Next article:KEIL C51 general register parameter passing rules
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- EEWORLD University ---- Verilog HDL digital integrated circuit design principles and applications
- Aigtek power amplifier application in wireless controlled stage lighting spot cutting system
- Pulse transformer ET product problem
- 【Qinheng RISC-V core CH582】USB keyboard input
- This electronic clock program question
- EEWORLD University ---- Live Replay: Security Series 20 - Configuring MPU Security in Your Factory
- Vicor white paper download - Bidirectional power: The driving force behind the "quiet" change in the world
- Analysis of self-oscillation and negative voltage generation circuits. Please help me
- MSP430 implements 800Hz buzzer and stopwatch
- [HC32F460 Development Board Review] 05. Recognition and processing of matrix buttons