This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX51 Tiny and Reentrancy

What is the effect of an RTX Tiny context switch (via specifying a non-zero TIMESHARING value in Conf_tny.A51) on non-reentrant functions?

I would assume that functions documented as reentrant will be OK, but is it safe to assume all non-reentrant functions within the scope of a task will allocate their own non-overlayed segment? What about compiler-generated library calls...specifically floating point? Are these immune to a mid-process context switch invoked by RTX Tiny?

  • What is the effect of an RTX Tiny context switch (via specifying a non-zero TIMESHARING value in Conf_tny.A51) on non-reentrant functions?

    RTX51 Tiny supports multiple tasks. Each task may call functions you create and functions from the C library.

    The only problem you get into with reentrancy is when you call non-reentrant functions from more than 1 task. If that is required, then you must do something to protect these routines' data. That can be as easy as declaring the functions using the reentrant keyword or as complex as locating the function's data area outsize of overlay analysis and then protecting the function from reentrancy by disabling interrupts.

    You should get a linker warning about reentrancy and functions being called from multiple tasks.

    The following pages in the manual may provide more information about round robin and stack manipulations by the OS:

    http://www.keil.com/support/man/docs/tr51/tr51_rrobin.htm

    http://www.keil.com/support/man/docs/tr51/tr51_stackmgmt.htm

    The following knowledgebase article shows how to use a library function like printf in multiple tasks in your application.

    http://www.keil.com/support/docs/690.htm

    Note that this knowledgebase article uses semaphores in RTX51 (not tiny). IF this looks like a good approach for your situation, you can add semaphores to RTX51 Tiny using the information found in the following knowledgebase article:

    http://www.keil.com/support/docs/2568.htm

    Jon