tailieunhanh - Hệ thống nhúng - Chương 4
Tham khảo tài liệu 'hệ thống nhúng - chương 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Lesson 3 : NUMBERS Flight plan: In this lesson we will review all the numerical data types offered by the MPLAB® C30 compiler. We will learn how much memory the compiler allocates for the numerical variables and we will investigate the relative efficiency of the routines used to perform arithmetic operations by using the MPLAB SIM Stopwatch as a basic profiling tool. This experience will help you choose the “right” numbers for your embedded-control application, understanding when and how to balance performance and memory resources, real-time constraints and complexity. Preflight checklist MPLAB IDE, Integrated Development Environment MPLAB SIM, software simulator MPLAB C30 compiler (Student Version) The flight MPLAB C30 User Guide The flight unsigned long i,j,k; main () { i = 0x1234; // assign an initial value to i j = 0x5678; // assign an initial value to j k = i * j; // perform the product and store the result in | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Lesson 3 : NUMBERS Flight plan: In this lesson we will review all the numerical data types offered by the MPLAB® C30 compiler. We will learn how much memory the compiler allocates for the numerical variables and we will investigate the relative efficiency of the routines used to perform arithmetic operations by using the MPLAB SIM Stopwatch as a basic profiling tool. This experience will help you choose the “right” numbers for your embedded-control application, understanding when and how to balance performance and memory resources, real-time constraints and complexity. Preflight checklist MPLAB IDE, Integrated Development Environment MPLAB SIM, software simulator MPLAB C30 compiler (Student Version) The flight MPLAB C30 User Guide The flight unsigned long i,j,k; main () { i = 0x1234; // assign an initial value to i j = 0x5678; // assign an initial value to j k = i * j; // perform the product and store the result in k } Assembly code On optimization (or lack thereof) In fact, the compiler does not see things this clearly—its role is to create “safe” code, avoiding (at least initially) any assumption and using standard sequences of instructions. Later on, if the proper optimization options are enabled, a second pass (or more) is performed to remove the redundant code. During the development and debugging phases of a project, though, it is always good practice to disable all optimizations as they might modify the structure of the code being analyzed and render single-stepping and breakpoint placement problematic. Testing Set the cursor on the first line containing the initialization of the first variable, and perform a Run To Cursor command to let the program initialize and stop the execution just before the first instruction we want to observe. Open the Watch window (“View→Watch”) and select WREG0 in the SFR selection box, then click on the “Add SFR” button. Repeat the operation for .
đang nạp các trang xem trước