#error clnk Debugsolar_charger.lkf:1 segment .text size overflow, indicating that the code segment overflows. At this time, because the STM8L firmware library is used, some unnecessary functions are compiled. You can try to comment out some unnecessary functions. If there are no functions that can be commented, you can try to select code optimization and compress the code in the project setting.
The most common problem is that when using a library, the code is prompted to exceed the memory range.
The amount of code is not large, but the compiler clearly indicates that the code exceeds the memory range. Why is this happening?
The main reason is that in order to handle errors properly, assert codes are added in the library file. At the same time, in order to provide all functional functions, there are many unused functions in the middle. However, in STM8L, although these useless functions are not connected to the execution code in the end, they are in the generated .o files. Since CxSTM8 judges the total size of .o before connection, rather than the size of the executable code after connection, although our code is very small, due to the excessive amount of unused code and error handling code in the library, the total size of the .o files before connection exceeds the range, causing the compiler to not connect. (Of course, it is also possible that the connection was made, but the executable file generated after the connection exceeded the requirement in size, so no executable file was generated. However, after commenting out some useless functions, the connection was successful, so it was judged that the connection was not made.)
In this case, not using library functions will inevitably reduce development efficiency. Using library functions will cause the generated code to exceed the memory size. At this time, the compromise is to still use library functions, but:
Comment out unused functions in the library;
Comment out some unnecessary assert statements in library functions;
Make some simple library functions into macro definitions and call them directly;
Avoid unnecessary code and reduce redundant code. (Be careful with assert codes)
Previous article:[STM8S Getting Started 1]: STM8SF103 compilation environment installation
Next article:STVD+COSMIC can't open file crtsi0.sm8 when compiling the project
- 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
- Bidirectional thyristor circuit wiring problem
- CMS32F033SS24 wireless charging and security chip
- Selection and application of DCDC module power supply
- Basic Concepts of Wireless Communication
- Download: Qorvo "Basics of Power Management"
- [National Technology N32G457 Review] 4. Serial port 2 DMA interrupt reception and transmission
- When a person gets an electric shock, is the current more harmful or the voltage more harmful?
- TMS320C6748 Development Board——EDMA
- Variable assignment in Verilog parallel statements
- [National Technology N32G430] 7. CAN test