Keil Logo

ARM: Project Using RTX5 Library Fails, But Works with RTX5 Source


Information in this knowledgebase article applies to:

  • Keil RTX5 5.2.0 (from CMSIS pack 5.1.0)

SYMPTOM

I am using Keil RTX5 in my project as library and notice, that my application randomly crashes. When I switch in the Manage Run-Time Environment dialog to the Keil RTX5 source variant, then the application runs without this problem. What is the reason for this?

CAUSE

Problem is, that the library includes the code to configure the SysTick as the RTX timer source and also calls NVIC_SetPriority() as part of that. This function is used inline and also depends on a macro __NVIC_PRIO_BITS, which is taken from the chip specific header file.
Different devices have different number of priority bits implemented. The RTX library was build for the "ARMCM3" device, which defines __NVIC_PRIO_BITS = 3. Your device probably has more priority bits implemented. So incorrect priorities get configured. That is, the SysTick gets a higher priority than SVCALL, which must not happen. As a consequence, this causes random runtime errors.
You can verify the problem during a debug session by inspecting the Peripherals -> Core Peripherals -> Nested Vectored Interrupt Controller (NVIC) dialog.

RESOLUTION

For now, use the Keil RTX5 source variant in your project, as so the __NVIC_PRIO_BITS macro value will also be compiled with the currently correct value for the selected device.

STATUS

This is fixed in Keil RTX5 version 5.2.1, which was released with CMSIS pack 5.1.1.

SEE ALSO

Last Reviewed: Monday, November 2, 2020


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.