Keil Logo

µVISION DEBUGGER: SOURCE LEVEL DEBUGGING OF LIBRARY CODE


Information in this article applies to:

  • MDK-ARM all versions
  • Keil C51 Compiler All Versions
  • Keil C251 Compiler All Versions
  • Keil C166 Compiler All Versions

QUESTION

I have created a library, which will be used by other projects. Is it possible to have source-level debugging into this library code, while working with it in other projects?

ANSWER

Yes. This is possible, however, the library source code must be available.

Taking the CMSIS RTX v4.x library file 'RTX_CM4.lib' as an example, when you include this 'RTX_CM4.lib' in your project and want to have source-level debugging into the CMSIS RTX source code in the debug session of µVision, please follow these steps:

  1. When building the library, in this case the 'RTX_CM4.lib' file, enable 'Debug information' under Options for Target - Output. In order to have more debug info and be able to set breakpoints, this library should be built with the optimization level -O0. The µVision project to rebuild the 'RTX_CM4.lib' file can be found under C:\Keil\ARM\PACK\ARM\CMSIS\4.5.0\CMSIS\RTOS\RTX\SRC\ARM\ , after you installed the CMSIS Pack.
  2. When using this library into your own project, in this case the 'RTX_CM4.lib' file, after each debug session is started, before running the application, use the SET SRC debug command to tell the µVision Debugger where the source code of 'RTX_CM4.lib' can be found. e.g.
    SET SRC = C:\Keil\ARM\PACK\ARM\CMSIS\5.4.0\CMSIS\RTOS\RTX\SRC
    
    The SET SRC debug command shown above can be also written into a debug.ini file and set it under Options for Target - Debug - Initialization File, so that it will be automatically loaded every time when you start a debug session.
NOTE: At the point of writing this article, 5.4.0 was the latest CMSIS pack. In the future users should use the latest CMSIS pack available.

MORE INFORMATION

  • Refer to SET in the µVision User's Guide.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, January 2, 2019


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.