Today, after I changed one of my programs into multiple files, the following alarm appeared: not in formal parameter list.
I searched for a long time but couldn't solve the problem. Later, I found someone else's solution to the same problem on the Internet. It was caused by a missing semicolon in a function declaration in the header file. I immediately checked my own program and found that a semicolon was missing as well. After adding the semicolon, the compilation and linking passed.
The following is the article I reprinted that solved the problem:
error C132: "****" not in formal parameter list
It took me nearly half an hour to find the error, and finally found that it was because a semicolon was missing in a function declaration in the header file, causing the parameter declared immediately below it not in the formal parameter list. I wrote it down here so that I don't forget it later, and it is also for everyone to share. The error code is as follows:
I listed the function declarations in the function declaration as follows:
void Display_Normal();
void Display_Reset()
void Display_Year() ; void Display_Month()
;
void Display_Day();
void Display_Week();
void Display_Hour();
void Display_Minute();
void Display_Second();
Here are some other common error prompts:
1. The first error message
***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: ?C_C51STARTUP
This warning indicates that the linker has found a function that may be called simultaneously by the main function and an interrupt service routine (or a function that calls an interrupt service routine), or by multiple interrupt service routines at the same time.
One of the reasons for this problem is that this function is a non-reentrant function. When the function is running, it may be interrupted by an interrupt, which may change the result and may cause some variable conflicts (that is, cause some data in the function to be lost. Reentrant functions can be interrupted by ISR at any time and 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 (for the time being, arguments, [independent variables, variables-values, used to determine the value of a program or subroutine]) is overwritten by the memory area of other functions. If the function is interrupted, its memory area will be used, which will cause memory conflicts in other functions. For example, the first warning indicates that the function WRITE_GMVLX1_REG is defined in D_GMVLX1.C or D_GMVLX1.A51 and is called by an interrupt service routine or a function that calls an interrupt service routine, the function that calls it is VSYNC_INTERRUPT in MAIN.C. Solution: If you are sure that the 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), then you can completely ignore this warning. If the function occupies memory, you should use the linker OVERLAY directive to exclude the function from overlay analysis, for example: OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1 ! *) The
above directive prevents the memory area used by the function from being overwritten by other functions. If the function calls other functions, and these functions are also called elsewhere in the program, you may want to exclude these functions from overlay analysis as well. This OVERLAY directive enables the compiler to remove the above warning message. If the function can be called during its execution, the situation becomes more complicated.
In this case, the following methods can be used:
A. Disable interrupts when the main program calls the function. You can use the #pragma disable statement to achieve the purpose of disabling interrupts when the function is called. The OVERLAY directive must be used to remove the function from the coverage analysis.
B. Copy the code of the function twice, one to the main program and the other to the interrupt service routine.
C. Set the function to be 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 configured in the STARTUP.A51 file. This method consumes more RAM and slows down the execution of reentrant functions.
2. The second error message *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_COMPARE?TESTLCD Explanation: Some functions (or segments) 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 is no big deal to ignore it. Solution: Remove the COMPARE() function or use conditional compilation #if …..#endif to keep the function and not compile.
3. Warning 280: 'i': unreferenced local variable
Description The local variable i is not accessed in any way in the function
Solution Eliminate the declaration of the variable i in the function
4 Warning 206: 'Music3': missing function-prototype
Description The Music3() function has not been declared or has not been declared externally, so it cannot be called by other functions.
Solution Write the statement void Music3(void) at the beginning of the program to declare it. If it is a function of other files
, write it as extern void Music3(void), that is, declare it externally.
5 Compling: C:\8051\MANN.C
Error: 318: can't open file 'beep.h'
Description During the compilation of C:\8051\MANN.C program, main.c used the instruction #include "beep.h",
but it could not be found.
Solution Write an include file of beep.h and save it in the working directory of c:\8051
6 Compling:C:\8051\LED.C
Error 237:'LedOn':function already has a body
Explanation The LedOn() function name is defined repeatedly, that is, there are more than two identical function names.
Solution: Correct one of the function names so that all function names are independent.
7 ***WARNING 16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_DELAYX1MS?DELAY
Description The DelayX1ms() function will occupy program memory even if it is not called by other functions.
Solution Remove the DelayX1ms() function or use conditional compilation #if …#endif to keep the function and not
compile it.
8 ***WARNING 6 :XDATA SPACE MEMORY OVERLAP
FROM : 0025H
TO: 0025H
Explanation The 0025H address of the external data ROM is defined repeatedly.
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 there are other variable names defined at 0x25 and correct them.
9 WARNING 206:'DelayX1ms': missing function-prototype
C:\8051\INPUT.C
Error 267 :'DelayX1ms ':requires ANSI-style prototype C:\8051\INPUT.C
Explanation 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 not declared.
Solution: After writing the content of DelayX1ms, it must be declared or declared externally. It can
be declared as external in the include file of delay.h to facilitate other functions to call it.
10 ***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
Description The program calls the MUSIC function but does not add the extension file C of the function to the project file
Prj for compilation and linking.
Solution: Set the MUSIC3 function in MUSIC C and add MUSIC C to the project file.
11 ***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
Explanation The address range of the data storage space is 0~0x7f. When the number of public variables and local variables in a
function is set to SMALL, the local variables will first use the working registers R2~R7 for temporary storage. When the memory is insufficient
, the data type space will be used for temporary storage. When the number exceeds 0x7f, the address will be insufficient.
Solution: Change the public variables defined as data type to idata type.
Previous article:Storing information in the watchdog in the microcontroller
Next article:WARNING 15 (MULTIPLE CALL TO SEGMENT)
- 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
- BlueNRG-1 chip
- Bluetooth 5 New Features and Applications
- GD32F130 will immediately enter the serial port interrupt after the serial port idle interrupt is turned on
- LIS2MDL array PCB board for magnetic nail navigation AGV car
- MSP430 clock problem
- 【Repost】Master these five methods to make your MCU easily low power
- Asking for advice: Question about TMS320C5509A low power mode
- MATLAB offline seminar | Assisting the development of artificial intelligence and electronic products (March 30, Nanjing)
- Dear seniors, please help me choose a chip
- [EasyARM-RT1052 Review] + Serial port idle reception to implement modbus host