STM32: How to use JLINK ULINK JTAG to view the execution time of a certain instruction in KEIL /MDK

Publisher:beta13Latest update time:2019-01-17 Source: eefocusKeywords:STM32  JLINK  ULINK  JTAG Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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


Keywords:STM32  JLINK  ULINK  JTAG Reference address:STM32: How to use JLINK ULINK JTAG to view the execution time of a certain instruction in KEIL /MDK

Previous article:STM32: STM32 learning record 1: MDK basic data types and code optimization
Next article:STM32: STM32 library function configuration

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号