method one:
In order to ensure that the correct program running time is read in MDK, the trace items of the emulator must be set.
Take ULink2 as an example:
(1) In the project's "Option for Target..." target option interface, select the "Debug" tab to enter the debug settings interface, select "Cortex-M3-ULIK2" as the emulator, and then click the "Settings" button on the right to enter the ULINK settings interface.
(2) Click the "Trace" tab to enter the trace settings interface. Enter your CPU frequency in the edit area to the right of "Core Clock:". For example, your actual CPU operating frequency is 72MHz.
(3) The value of "Core Clock" determines the frequency at which MDK calculates the instruction cycle. Since the default value of "Core Clock" is 10MHz, if this value is not changed, MDK calculates the running time of each instruction at a frequency of 10MHz. Only by changing it to the actual frequency value can the correct instruction cycle be obtained.
(The chip model I use is: stm32f100CB, its system clock is 24MHZ)
(4) Return to the Kei debugging interface. When debugging in Keil, you can see Internal under Proect Workspace on the left. You can see that sec is the time. Execute breakpoint debugging to calculate the time.
Before starting to write to flash: Note that the time is Internal ->sec: 2.13051933
After executing the flash write command, note that the time is Internal ->sec: 2.15888279
Compare the difference before and after: That is the time to write flash: 0.02836346s = 28.3546ms !!!
Method 2: View through an oscilloscope; (I use JTAG but cannot track statement execution time in real time, so this method can be used)
Add the method of setting a certain pin level to the test statement, and set the breakpoint. The oscilloscope captures the duration of the high level---as shown in the code part above
Previous article:STM32: STM32 learning record 1: MDK basic data types and code optimization
Next article:STM32: STM32 library function configuration
- 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
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- [Silicon Labs Development Kit Review] +Serial port printing PDM stereo microphone SPK0641HT4H-1 data
- Are there any activities regarding exchanging chip coins for download points?
- MII RMII RGMII GMII
- Tips Summary: A Guide to Bitwise Operations
- Wi-Fi architecture and future development of Wi-Fi standards
- Problems encountered when opening old version with new version of IAR and solutions
- There is a problem with the PCB copper layout, please help!
- [Project source code] [Modelsim FAQ] Analysis and Synthesis should be completed
- Guidance system test
- How effective is the ESP32 face recognition development board ESP-EYE?