I recently looked at the Baidu bracelet open source project and found that all the algorithms were encapsulated into a lib file. This is the first time I have learned to call it in Keil.
The question arises: Why should it be made into a lib library?
1. In order to keep the key source code written by some solution companies from being public, but at the same time the library files need to be able to be called normally by others, encapsulating them into a lib format is a good method.
2. It is very time-consuming to compile some project files. For example, when compiling UCGUI and ST official libraries, due to the large number of files, it may take one or two minutes to compile once. At this time, you can package them into a library. When compiling the project, the library files will not be compiled again, saving a lot of time.
The only downside is that you can't use the right-click "go to Definition 'XXX'" to directly find the source file definition. But generally, others package it into a lib after testing.
Production method: Taking UCGUI as an example
Step 1: Open a project that has passed the test. (If there is an error in the code in the library file to be packaged, it will not be usable after being packaged into a library. This step is critical)
After the test is successful, delete the unnecessary parts, as shown below.
Step 2: Open KEIL MDK ->Project->Option for target...->Output and select Create Executable:.... option.
Step 3: Recompile and you can find the *.lib file in the directory where the Hex file was originally generated.
Open the original project, just remove the original .c file and add the .lib file to use it (the program call must include all the header files of the c file in the lib file).
Special attention should be paid to the fact that the Lib files should be divided into smaller parts, and two functions that have no calling relationship should not be placed in the same C file. It is best to place a function that has no calling relationship in a separate .c file. This is to avoid alarms when the application calls the lib library in Keil.
Previous article:STM32 learning notes hardware SPI reading and writing and polarity setting
Next article:STM32 study notes: standby wake-up
- 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
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- C2000 built-in comparator error sources and correction methods--F28004x, F2807x, F2837x
- Problems with burning programs
- Common problems and countermeasures for CCS commissioning
- Analysis of the working principle of anti-interference filter
- 【TMS320 frequency measurement】First post for newbies! TMS320F28369D Launchpad unboxing + knowledge popularization
- PiSugar Battery - Raspberry Pi Zero Portable Power Platform
- What is the relationship between ijk and timing? Or is it generated by software?
- Huada
- Introduction to the Powerpad function of the sharing chip
- Configuration and precautions of COFF in Buck LED driver chip with COFT control mode