Key Points of C Knowledge in embedded software work

Source: Internet
Author: User

Chen guodong (sinojelly@163.com) 2008/08/08 draft 2009/10/6 content sorting, re-layout many friends may be learning C, but did not actually participate in the embedded software project, on the industrial application of C-related knowledge is not understand. This article was originally intended to guide new employees. Now, I share it with you, hoping to help learners preparing for the embedded software field. This is mainly an outline of learning, but it only explains some important knowledge points. There are still many chapters that do not have specific content. You need to check the materials and search for details, if you are interested in improving it, contact me and send me the content you think you want to add. If you have any thoughts/questions during reading, please feel free to contact me. Thank you!1. Basics1.1. Data Types, operators, and expressionsRecommendation: C Language Algorithm priority 650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'onclick =" window. open ("http://blog.51cto.com/viewpic.php? Refimg = "+ this. src)" src = ".../attachment/200910/200910061254800716527 .jpg" border =" 0 "alt =" "/> emphasis: implicit type conversion in operations. 650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'onclick =" window. open ("http://blog.51cto.com/viewpic.php? Refimg = "+ this. src)" src = "../attachment/200910/200910061254800785858 .jpg" border =" 0 "alt =" "/>1.2. C language program structure sequence, branches, and loops)1.3. Use of arrays and functions1.4. Usage of pointers1.5. Preprocessing command1.6. bitwise operations1.7. File Operations2. Improve2.1. Basic vxWorks knowledgeCauses and Solutions of task mutex and synchronization task deadlock priority flip problem binary semaphores and mutex semaphores2.2. Tornado use and debugging skills
2.3. VC use and debugging skills
2.4. Basic Makefile knowledge
2.5 Basic PC-lint knowledgeRecommendation: SmartLint help file, PC-lint entry and improvement. This article is a comprehensive introduction to PC-lint-related knowledge from the foundation of 0.2.6. Basic Algorithms and ImplementationsImplementation of sorting algorithms and complexity analysis fast sorting and Bubble Sorting) use of the qsort Function2.7. Understand the basic principles of TCP/IP2.8. Program Structure Design PrinciplesAvoid repeating the benefits of encapsulation to understand the basic idea of object-oriented design and the basic features of Object-oriented Application in C language: differences between encapsulation, inheritance, and polymorphism object-oriented and process-oriented: the process-oriented design focuses on algorithms and the relationship between objects. Object-Oriented Design Principles: encapsulation changes. Disable modification and open extension. Dependency inversion. Dependency abstraction, rather than dependency. Use object-oriented methods in C language: 1. use object-oriented ideas to design better program structures, such as encapsulation changes. 2. Simply put, a class encapsulates member variables and member methods. Therefore, you can use struct to encapsulate member variables and function pointers to simulate class behavior. Skyeye, a software that simulates embedded system running in China, is developed in this way .)2.9. Compilation and running environment knowledgeBasic Principles of program compilation and linking: Register usage and stack structure of PPC/ARM2. 10. deep understanding of the pointer Concept2. 11. Structure memory Layout. Large-end and small-end CPU2. 13. byte alignment2. 14. Tips for macro definition2.14.1. Definition of common macros_ FILE _ indicates the FILE path _ LINE _ indicates the row number.2.14.2. macro definition use prohibitionsMacro-defined parameters cannot be auto-increment or auto-increment expressions.2.14.3. usage of "#" in macro definition1. '#' indicates 'stringize. The subsequent variables are replaced by strings included in double quotation marks. For example: # define display (x) show (long) (x), # x) then display (abs (-5); will be replaced with: show (long) (abs (-5), "abs (-5)"); note that there are quotation marks. 2. '#' is the 'token-paste 'operator. The subsequent variables are merged with the previous strings to form a new token. example: # define printvar (x) printf ("% d \ n", variable # x) printvar (3 ); will be replaced with printf ("% d \ n", variable3); # Only merge strings to form a token without quotation marks. problem: define a macro UNREF so that UNREF (Var) is expanded to (void) Var.2.14.4. macro definition in Makefile2.14.5. macro definition in PC-lint Option2.14.6. macro expansion rulesProblem: You can define a software version as a macro definition in Makefile and use the version number in the code. How can I implement a version number of the string type in the code?2. 15. Functions with Variable Parameter count2. 16. The address cannot be obtained for local variables.After being optimized by the compiler, local variables are likely to be stored in registers, rather than memory. registers cannot take addresses.2.17.sprintf/strcpy function defects and Solutions2. 18. Usage of bit Domains2. 19. methods to prevent repeated inclusion of header files2.20.C language limitations and Software Industry DevelopmentC language operations are flexible, but problems such as program memory leakage, Invalid Pointer access, and stack out-of-bounds are emerging in the C language, and C language does not support object-oriented, systems built in process-oriented mode generally have "complicated", "fragile", "strong coupling between modules", and "difficult to modify, take the lead and take the lead" systems built in C language, the most fundamental rule of software is constant change. Such software systems are constantly changing and becoming more vulnerable until maintenance is finally impossible. C # launched by Microsoft is a new language created by absorbing the essence of other languages on the basis of C ++. In many aspects, it improves the defects and shortcomings of C language, the discovery of many problems is advanced to the compilation phase. For example, the expression after if in C can be a value assignment, which is often not found during compilation and is a fatal error during running, C # The design of the language itself avoids this problem. It stipulates that if can only be followed by a bool expression. Of course, C/C ++ is the most widely used for embedded development, but we can learn more about new technologies in the industry, broaden the horizon, improve the software level, and avoid the C language traps to develop better software.3. Book recommendation3.1. Getting Started
Typical C tutorial. chm audio ebook C language programming tan haoqiang Data Structure3.2. AdvancedC and pointer, C traps and defects, C expert programming, Head. First Design Model

This article is from the "Jelly software technology blog" blog, please be sure to keep this source http://sinojelly.blog.51cto.com/479153/209752

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.