Compile time prompt:
F:\...\XX.M51
File has been changed outside the editor, reload?
------
Solution:
Regenerate the project and generate STARTUP.A51.
(2) L15 repeated calls
***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 not reentrant. When the function is running, it may be interrupted by an interrupt, which may change the result and 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 be reentrant after a period of time.
However, the corresponding data will not be lost).
The second reason is that the memory area used for local variables and variables (let's translate it this way, arguments, [independent variables, variable-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, in the first warning, the function WRITE_GMVLX1_REG is defined in D_GMVLX1.C or D_GMVLX1.A51, and it 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 that the function does not occupy any memory (assuming only registers are used), you can completely ignore this warning.
If the function occupies memory, it should be excluded from overlay analysis using the linker OVERLAY directive, for example:
OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1 ! *)
The above directive prevents the memory area used by this function from being overwritten by other functions. If this function calls other functions, and these functions are also called elsewhere in the program, you may want to exclude these functions from overlay analysis. This OVERLAY directive enables the compiler to remove the above warning message.
If the function can be called while it is executing, the situation becomes more complicated. There are several approaches you can take:
1. Disable interrupts when the main program calls this function. You can use the #pragma disable statement when the function is called to achieve the purpose of disabling interrupts. You must use the OVERLAY instruction to remove the function from the coverage analysis.
2. Copy two copies of the function code, one to the main program and the other to the interrupt service program.
3. 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 will slow down the execution of reentrant functions.
(3) L16 no call
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_COMPARE?TESTLCD
Note: Some functions in the program, such as COMPARE (or fragments), have never been called before (during debugging), or there is no statement to call it at all.
This warning should be preceded by a message indicating which function is causing the problem. It should be fine with some simple adjustments. Ignoring it is not a big deal.
Solution: Remove the COMPARE() function or use conditional compilation #if …#endif to keep the function and not compile.
(4) L10 and L16 "Main program name is wrong (or there is no main program)"
In the program:
void main (void)
Compilation tips:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?MIAN?MAIN
*** WARNING L10: CANNOT DETERMINE ROOT SEGMENT
Program Size: da
---
Revise:
The main program is missing (actually a typo), change mian to main
(5) The L16 main program does not use the previously defined functions
The previously defined function is not used in the main program, and the following is displayed during compilation:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DELAY?MAIN
(6) Generate SRC statement before L210 program
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
---------
For setting problems, just disable #pragma src in the program.
(7) C206 function is not defined
This function is not defined
MAIN.C(15): warning C206: 'delay1': missing function-prototype
(8) C141 Less semicolon
Part of the program:
{
pval = P1 /* Read P1 into pval */
P3 = pval; /* Write pval to P3 */
}
Compilation error:
MAIN.C(22): error C141: syntax error near 'P3'
Correction: Add ";" after P1
(9) C129 assembly and C suffix issues
For example, write a small program like this and save it as c0.c. When compiling, error c129 appears, miss; before 0000;
If you save it as: c0.asm, this error will not occur. If you save it as c, the c51 compiler will be called first and compiled according to the requirements of the c language, so an error will occur. You can refer to some books that specifically introduce the keilc compiler;
(10) C101 and C141 on 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','0x3 b','0x37','0x2f','0x1f','0x1e','0x1d','0x1b','0x17','0x0f','0x0e','0x0d','0x0b','0x07' ,'0x06','0x05','0x03','0x02','0x01','0x00'};
But the compilation always fails, and the error prompt 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 quotes '...'
(11) C100, C141 and C129 programs have Chinese punctuation
An error occurred when compiling with Keil, as follows: D:\KEIL\C51\INC\REG52.H(1): error C100: unprintable character 0xA1 skipped
There are many errors as above, 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 the reg52.h header file comes with Keil (see below), so why does it report an error?
----
Answer: There are Chinese punctuation marks in the program. Just rewrite it in English.
(12) Confusion of numbers and letters in A45 assembly
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
---------
Notice:
The letter "O" and the number "0". This is where the main mistake is.
You entered the letter "O" instead of the number "0".
(13) C141 error
Tip 001.C(23): error C141: syntax error near 'unsigned'
The statement before this line "bit flag_Key_Service_song=0" is missing a semicolon
(14) C129 error
Tip 001.C(22): error C129: missing ';' before 'flag_Key_Service_song'
In the definition, "bi flag_Key_Service_song=0;"
Change to bit
Previous article:128*64 LCD uses the program of "MCU internal display buffer"
Next article:Keil C51 program debugging process
- Popular Resources
- Popular amplifiers
- Introduction to Artificial Intelligence and Robotics (Murphy)
- Practical Applications in Digital Signal Processing (Richard Newbold)
- Introduces the CAN interrupt structure function of C167CR and the application of the standard CAN interrupt structure
- Author: wei liu Summary: simulation of binary and non-binary bch decoder MATLAB Release: R1
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
- P22-009_Butterfly E3106 Cord Board Solution
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Please give a comprehensive analysis of the advantages and disadvantages of i.MX8QuadMAX and RK3399PRO
- Review Weekly Report 20211115: 1 day left to apply for Fudan Micro FM33LG0, Pingtou Ge smart voice, Anxinke PB-02 unboxing, etc.
- 【E840-DTU】MQTT sending and receiving test
- Who should I turn to for help when I need help with domestic FPCB manufacturers?
- uasyncio basic tutorial (English)
- Are there any netizens in our forum participating in the 2021 STM32 China Summit Hackathon 24-hour challenge?
- [RT-Thread Reading Notes] Week 3: Entering the World of RT-Thread - Threads, Clocks
- Autonomous Robot Design Using ROS and mmWave Sensors
- Please help me check, after the PCB copper is applied, a lot of errors are reported: Unrouted net constraint.
- FPGA implementation of high-speed dedicated GFP processor.pdf