Keil Logo

C51: Using SETJMP and LONGJMP with Code Banking and RTX51


Information in this article applies to:

  • C51 Version 7.00

QUESTION

Can the setjmp and longjmp functions be used in code banking programs and/or RTX51 programs?

ANSWER

The setjmp and longjmp functions may be used in code banking programs as long as the setjmp and longjmp target located within the same code bank or the common area. Problems arise when jumping from a code bank to the common area or when jumping from the common area to a code bank.

The same rules apply for RTX51 programs. Additionally, the setjmp and longjmp target must be located in the same task context. It is impossible to jump from one task to another since different tasks use different stacks.

It is not safe to use setjmp and longjmp with RTX51 Tiny since this operating system performs dynamic stack swapping.

MORE INFORMATION

  • Refer to longjmp in the Cx51 User's Guide.
  • Refer to setjmp in the Cx51 User's Guide.

Last Reviewed: Thursday, February 25, 2021


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.