Recently, When I encountered a problem in the integrated project, I did not pay attention to it at first, but then I found out that it was myProgramI can't burn it into the chip, after checking the manual, I found that the flash of the New Tang cortex-m051 is only 8 KB, after my program is compiled, the binfile actually has 16 KB, my program has only over 1300 lines of comments. How can it be so big?
I don't know what the problem is, so I began to cut down the program and delete some programs that can be desired or not (that is, some parts that will be more humane after the program is required ), some strange things happened when I deleted four printf files and reduced the number of binfiles from 16 KB to 13 KB. So I deleted all printf files, the program is reduced to 11 kb. Later, in a very small program, a printf function call exceeded 4 kb of space.
As a function makes my program so much bigger, I'm curious, so I went to look at the prototype of this function, in the New Tang cortex-m0 in the end how to encapsulate, unfortunately, I did not find it, so I did not care about other programs. on July 15, December 16, the New Tang dynasty will come to Nanjing for a lecture tour. Then I will ask them clearly, I will share the answer with you later.
For embedded programming, the space of each byte is so precious. I hope you can use printf with caution during programming. Although this function is really convenient, it is not enough space, you can use send_to_pc () in the UART function provided by the system to send a byte to the computer through the serial port.