列表文件在C(.LST) [英] List File In C (.LST)
问题描述
编译一些code后,编译器会生成一堆文件。我统计过,符号,调用树,错误,列表,调试和exe文件。我已经想通了各种办法,除了列表文件。是什么列表文件的功能。它是为用户或计算机/嵌入式系统本身?
After compiling some code, the compiler generates a bunch of files. I have statistics, symbols, call tree, errors, list, debug and exe. I have figured out what each means, except for the list file. What is the function of the list file. Is it for the user or the computer/embedded system itself?
推荐答案
列表文件的确切内容由所使用的工具和芯片略有不同。
The exact contents of the list file varies slightly by tool and chip being used.
该文件的主要部分将是C源$ C $ C到汇编指令已经由编译器执行的翻译。这是调试code和翻译一定的客源$ C $ C构造时检查编译器的效率非常有用。在每个克莱因下面的例子中给出一个线路号和后列出的汇编。 (这个例子是针对AVR32处理器)。
The major part of the file will be the translation of the C source code into assembly instructions that has been performed by the compiler. This is useful for debugging the code and to check on the efficiency of the compiler when translating certain source code constructs. In the example below each Cline is given a line number and the assembler listed after. (this example is for the AVR32 processor).
171 /**********************************************************
172 * Test for a receive interrupt
173 **********************************************************/
174 if ( USART_CHANNEL[ Channel ] -> CSR.rxrdy )
000008 F8051502 LSL R5,R12,0x2
00000C ........ MOV R7,LWRD(USART_CHANNEL)
000010 EA17.... ORH R7,HWRD(USART_CHANNEL)
000014 EE0C0027 ADD R7,R7,R12<<0x2
000018 6E0C LD.w R12,R7[0x0]
00001A ........ MOV R6,LWRD(Serial_Receive_Queue)
00001E EA16.... ORH R6,HWRD(Serial_Receive_Queue)
000022 785B LD.w R11,R12[0x14]
000024 A19B LSR R11,0x1
000026 C0B2 BRCC ??USART_Process_Interrupt_1:C
这显示为十六进制值......以上是未在编译时已知地址,他们将在链接时解析的符号。
The HEX values that are shown as "...." above are addresses that are not known at compile time, they are symbols that will be resolved at link time.
该列表文件通常还将下达关于code规格,内存要求和模块被编译的堆栈使用的一些统计数据。再次IAR工具为AVR32
The list file will also typically give some statistics regarding the code size, RAM requirements and the stack usage for the module being compiled. Again IAR toolset for the AVR32
字节最大堆栈用量:
Function CSTACK
-------- ------
Serial_Ports_Initialise 36
-> gpio_enable_module 36
-> usart_init_rs232 36
-> Indirect call 36
-> Indirect call 36
-> Indirect call 36
-> Indirect call 36
Serial_Transmit_With_Length 20
-> xQueueGenericSend 20
-> vTaskDelay 20
USART0_INT_Handler 0
-> USART_Process_Interrupt 0
USART1_INT_Handler 0
-> USART_Process_Interrupt 0
USART2_INT_Handler 0
-> USART_Process_Interrupt 0
USART_Process_Interrupt 32
-> xQueueGenericSendFromISR 32
-> xQueueReceiveFromISR 32
Segment part sizes:
Function/Label Bytes
-------------- -----
Serial_Receive_Queue 24
Serial_Transmit_Queue
USART_CHANNEL 12
USART0_INT_Handler 8
USART1_INT_Handler 8
USART2_INT_Handler 12
USART_Process_Interrupt 112
Serial_Ports_Initialise 172
USART_Channel_In_Use 56
USART_GPIO_MAP
USART_OPTIONS
Serial_Transmit_With_Length 116
?<Initializer for USART_CHANNEL> 12
??USART1_INT_Handler??handle 4
Others 24
400 bytes in segment CODE32
56 bytes in segment DATA32_C
12 bytes in segment DATA32_I
12 bytes in segment DATA32_ID
24 bytes in segment DATA32_Z
28 bytes in segment EVSEG
4 bytes in segment HTAB
24 bytes in segment INITTAB
400 bytes of CODE memory
100 bytes of CONST memory (+ 24 bytes shared)
36 bytes of DATA memory
Errors: none
Warnings: 1
有也将产生插入code的相关线路的任何错误消息或警告。
There will also be any error messages or warnings generated inserted at the relevant line of code.
因此,列表文件可以作为估算堆栈和内存使用的辅助工具,虽然栈的使用是一个非常棘手的问题,在任何嵌入式系统,并看到由编译器产生的汇编级code
The List file can therefore be used as an aid to estimate stack and memory usage, although stack usage is a highly intractable problem in any embedded system and to see the assembler level code produced by the compiler.
从经验来看,使用源代码级调试工具时,列表文件不是特别有用 - 通常这显示了相关的拆解code直接
From experience, the list file is not particularly useful when using a source level debugging tool - generally this shows the relevant disassembled code directly.
这篇关于列表文件在C(.LST)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!