keilC51 compilation common errors and warnings

For example, can netizens who are interested in compilation errors collect the error information you often encounter and propose a final solution to summarize them for sharing!

(1) L15 repeated call
***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP

This warning means that the connector found that a function may be the main function Called simultaneously with an interrupt service routine (or a function that calls the interrupt service routine), or called by multiple interrupt service routines at the same time.
One reason for this problem is that this function is not reentrant function when the function is run it may be interrupted by an interrupt from
so that results vary and may cause some variable forms of conflict (ie, cause If some data in the function is lost, the reentrant function can be interrupted by ISR at any time, and it can run again after a period of time, but the corresponding data will not be lost).
The second reason is that the memory area used for local variables and variables (translated in this way, arguments, [argument, a value of argument, used to determine the value of the program or subroutine]) is covered by the memory area of ​​other functions, if If this function is interrupted, its memory area will be used, which will cause
memory conflicts withother functions.

For example, in the first warning, the function WRITE_GMVLX1_REG is defined in D_GMVLX1.C or D_GMVLX1.A51. It is
calledby an interruptservice routine or a function that calls the interrupt service routine. The calling function is VSYNC_INTERRUPT, in MAIN.C .

Solution:
If you are sure that two functions will never be executed at the same time (the function is called by the main program and interrupts are disabled), and the function does not occupy memory (assuming that only registers are used), you can completely ignore this warning .
If the function occupies memory, the linker OVERLAY command should be used to remove the function from the overlay
analysis, for example:
OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1! *) The
above command prevents the function from being used The memory area is covered by other functions. If other functions are called in this function, and these are called in
other places in the program, you may need to exclude these functions from the overlay analysis. This OVERLAY instruction
enables the compiler to remove the above warning message.
If the function can be called during its execution, the situation becomes more complicated. At this time, the following methods can be used:
1. The interrupt is prohibited when the main program calls the function, and the #pragma disable statement can be used when the function is called to achieve the purpose of prohibiting interrupts. The
OVERLAY instruction must be used to remove the function from the coverage analysis.
2. Copy two copies of the function code, one copy to the main program, and the other copy to the interrupt service routine.
3. Set the function to reentrant. For example: void myfunc(void) reentrant { ... }


This setting will generate a reentrant stack, which is used to store function values ​​and local variables. When using this method, reentrant stack must be configured in the STARTUP.A51 file. This method consumes more RAM and will reduce the execution speed of the reentrant function.

(2) Prompt that there is no M51 file. When
compiling, it prompts:
F:\...\XX.M51
File has been changed outside the editor, reload?
------

Solution:
Regenerate the project and generate STARTUP.A51.

(3) L16 no call
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_COMPARE?TESTLCD

Description: Some functions in the program such as COMPARE (or fragment) have never been called before (during debugging) , Or there is no
statement to call it at all.
There should be a message before this warning message indicating which function caused the problem. Just make some simple adjustments
. It's no big deal to ignore it.
Solution: Remove the COMPARE() function or use conditional compilation #if… ..#endif to keep this function and not compile.

(4) L10 and L16 "Wrong name of the main program (or no main program)" In the
program:
void mian (void)
Compile prompt:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?MIAN?MAIN
*** WARNING L10: CANNOT DETERMINE ROOT SEGMENT Program Size: data=8.0 xdata=0 code=9
---

Modification:
missing main program (In fact, it is a clerical error), change mian to main

(5) The L16 main program does not use the previously defined function. The
main program does not use the previously defined function. When compiling, it displays:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY?MAIN


(6)L210
Build target'Target 1'assembling
STARTUP.A51...
compiling test.C...
linking...
BL51 BANKED LINKER/LOCATER V6. 00-SN: K1JXC-94Z4V9
COPYRIGHT KEIL ELEKTRONIK GmbH 1987-2005
"STARTUP.obj",
"test.obj"
TO "test"
*** FATAL ERROR L210: I/O ERROR ON INPUT FILE:
EXCEPTION 0021H: PATH OR FILE NOT FOUND
FILE: test.obj
Target not created

---------
setting problem, shield it in the program #pragma src is enough

(7) C206 function is not defined
The function is not defined
MAIN. C(15): warning C206:'delay1': missing function-prototype(8)C141 Less semicolon
Part of the program:
{ pval = P1 P3 = pval; } Compile prompt error: MAIN.C(22): error C141: syntax error near'P3' Correction: P1 followed by ";" (9) C129 assembly and C suffix problem, such as writing such a small program, save it as c0 .c, error c129, miss; before 0000 appears when compiling; if you save as: c0.asm, this error will not occur , if you save as c, first call the c51 compiler and compile according to the requirements of the c language, so an error occurs; You can refer to some books that specifically introduce the keilc compiler; (10) C101 and C141 on the issue of array quotation marks













The following array is defined:
unsigned char
a[36]={'0xfe','0xfd','0xfb','0xf7','0xef','0xdf','0xbf','0x7f','0x7e', '0x7d','0x7b','0x77','0x6f','
0x5f','0x3f','0x3e','0x3d','0x3b','0x37','0x2f','0x1f','0x1e ','0x1d','0x1b','0x17','0x0f','0x0e','
0x0d','0x0b','0x07','0x06','0x05','0x03','0x02' ,'0x01','0x00'};
but it always fails when compiling , the error message is as follows:
Build
target'Target 1'compiling shaomiao.c...
SHAOMIAO.C(3): error C101:''0': invalid character constant
SHAOMIAO.C(3): error C141:syntax error near'xfe'
SHAOMIAO.C(3): error C101:''}': invalid character constant
Target not created

Solution: remove the'...' quotation marks

(11) C100 and C141 and C129 programs have Chinese punctuation
Errors occur when compiling with keil, as follows: D:\KEIL\C51\INC\REG52.H(1): error C100: unprintable character 0xA1
skipped Same as above, there are many errors, and D:\KEIL\C51\INC\REG52 .H(2): error C141: syntax error near'#'
D:\KEIL\C51\INC\REG52.H(2): error C129: missing';' before'<'

but reg52.h header file is keil The built-in (see below), why would it report an error?
----
Answer: There are Chinese punctuations in the program, just rewrite it in English

(12) A45 Compilation with numbers and letters confused
MOV PO,A ;put on next 11
...
MOV RO,#0FFH; 14
MOV R1,#OFFH; 15
...
DJNZ RO,DLY_LP ;19
MOV R0,#OFFH; 20
...
after compilation:
ledtest.asm(11): error A45: UNDEFINED SYMBOL (PASS-2)
ledtest.asm(14 ): error A45: UNDEFINED SYMBOL (PASS-2)
ledtest.asm(15): error A45: UNDEFINED SYMBOL (PASS-2)
ledtest.asm(19): error A45: UNDEFINED SYMBOL (PASS-2)
ledtest.asm(20): error A45: UNDEFINED SYMBOL (PASS-2)
Target not created

---------
Note: the
letter " O" and the number "0". The main fault is here.
The number "0" should be entered, and you entered the letter "O".

(13)  Warning 280: 'i' :unreferenced local variable
indicates that the local variable i has not been accessed in the function. Solution Eliminate the declaration of the i variable in the function. 2 Warning 206: 'Music3' :missing function-prototype
Description Music3 () function have not been declared or not declared as external calls to other functions can not be
resolved method will be described void Music3 (void) write in the forefront of the program if it is declared as a function of the other files to write
to extern void Music3 (void) , It is an external declaration

3 Compling: C:\8051\MANN.C
Error: 318: can 't open file' beep.h 'It
means that main.c is used in the process of compiling C:\8051\MANN.C Instruction # i nclude "beep.h", but
But I can’t find the solution to the problem. Write an include file of beep.h and save it in the working directory of c:\8051

(14) Compling:C:\8051\LED.C
Error 237: 'LedOn' :function already has a body

means that the LedOn() function name is repeatedly defined, that is, there are more than two same function names.
Solution Fix one of the function names so that the function names are independent

15)***WARNING 16:UNCALLED SEGMENT,IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_DELAYX1MS?DELAY

shows that DelayX1ms() function will not be called by other functions and will occupy the program memory space. Solution Remove DelayX1ms() function or use conditional compilation #if… ..#endif, you can keep this function and not Compile

(16) ***WARNING 6 :XDATA SPACE MEMORY OVERLAP
FROM: 0025H
TO: 0025H

Explain that 0025H of the external data ROM repeats the definition address.
Solution The definition of the external data ROM is as follows: Pdata unsigned char XFR_ADC _at_0x25
The name of the XFR_ADC variable is 0x25, Please check if other variable names are also defined at 0x25 and correct it

(17) WARNING 206: 'DelayX1ms': missing function-prototype
C:\8051\INPUT.C
Error 267:'DelayX1ms': requires ANSI-style prototype C:\8051\INPUT.C

shows that the DelayX1ms function is called in the program but the function is not defined, that is, the program content is not written or the function is defined but the
solution is not declared . Write DelayX1ms Announce or make an external announcement after the content is written. It can be declared as external in the include file of delay.h so that other functions can be called

(18) ***WARNING 1:UNRESOLVED EXTERNAL SYMBOL
SYMBOL:MUSIC3
MODULE:C:\8051\MUSIC .OBJ(MUSIC)
***WARNING 2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL:MUSIC3
MODULE:C:\8051\MUSIC.OBJ(MUSIC)
ADDRESS:0018H

shows that the program has called the MUSIC function but did not include the extension of the function. File C is added to the project file Prj for compilation and connection.
Solution Set MUSIC3 function in MUSIC C and add MUSIC C to the project file

(19) ***ERROR 107:ADDESS SPACE OVERFLOW
SPACE: DATA
SEGMENT: _DATA_GOUP_
LENGTH: 0018H
***ERROR 118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: VOLUME
MODULE: C:\8051\OSDM.OBJ (OSDM)
ADDRESS: 4036H

Explain that the address range of data storage space is 0~0x7f, when the number of public variables and local variables in functions, if the storage mode is set to SMALL, then local variables First use the working registers R2~R7 for temporary storage. When the memory is not enough, the
data type space will be used for temporary storage. When the number exceeds 0x7f, the address will be insufficient. The
solution will be to modify the public variables defined by the data type. It is the definition of idata type


(20).***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?_WRITE_GMVLX1_REG?D_GMVLX1
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP
***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?_SPI_SEND_WORD?D_SPI
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP
***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2:
CALLER2: ?C_C51STARTUP

This warning indicates that the linker finds that a function may be called by the main function and an interrupt service routine (or a function that calls the interrupt service routine) at the same time, or by multiple interrupt service routines at the same time.

One reason for this problem is that this function is not reentrant function when the function is run when it might by a
interrupt interrupted, so that the result of changes in the variables and may cause some forms of conflict (ie, cause If some data in the function is lost, the reentrant function can be interrupted by ISR at any time, and it can run again after a period of time, but the corresponding data will not be lost).

The second reason is that the memory area used for local variables and variables (translated in this way, arguments, [argument, a value of argument, used to determine the value of the program or subroutine]) is covered by the memory area of ​​other functions, if If this function is interrupted, its memory area will be used, which will cause memory conflicts with other functions.
For example, in the first warning, the function WRITE_GMVLX1_REG is defined in D_GMVLX1.C or D_GMVLX1.A51.
It is called by an interrupt service routine or a
function that calls the interrupt service routine. The calling function is VSYNC_INTERRUPT, in MAIN.C .

Solution:
If you are sure that two functions will never be executed at the same time (the function is called by the main program and interrupts are disabled),
and the function does not occupy memory (assuming only registers are used),
you can ignore this completely caveat.
If the function occupies memory, you should use the linker OVERLAY command to remove the function from the
overlay analysis, for example:
OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1! *) The
above instruction prevents the memory area used by this function from being overwritten by other functions. If other functions
are called in this function, and these are called elsewhere in the program,
you may need to also exclude these functions from the overlay analysis. This OVERLAY instruction
enables the compiler to remove the above warning message.

If the function can be called during its execution, the situation becomes more complicated. At this time, the following methods can be used
:
1. The interrupt is prohibited when the main program calls this function, and the #pragma disable statement can be used when the function is called to achieve
the purpose of prohibiting interrupts. The function must be
removed from the coverage analysis using the OVERLAY instruction .
2. Copy two copies of the function code, one copy to the main program, and the other copy to the interrupt service routine. 3. Set the function to reentrant. For example:
void myfunc(void) reentrant { ... } This setting will generate a reentrant stack, which is used to store function values ​​and local variables. When using this method, the reentrant stack must be in STARTUP. Configured in A51 file. This method consumes more RAM and will reduce the execution speed of the reentrant function. (21). *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_COMPARE?TESTLCD








Explanation: Some functions (or fragments) in the program have never been called before (during debugging), or there is no
statement to call it at all.
There should be a message before this warning message indicating which function caused the problem. Just make some simple
adjustments. It's no big deal to ignore it.
Solution: Remove the COMPARE() function or use conditional compilation #if… ..#endif to keep this function and not
compile.

Guess you like

Origin blog.csdn.net/weixin_38293850/article/details/108031830