ARM Technical Support Knowledge Articles

DIRECT ACCESSING OF P2

Applies to: RTX51 Real-time Kernel

Answer


Information in this article applies to:


SYMPTOMS

We are using RTX51 and we have noticed that it accesses P2 directly for some reason. Due to the nature of our particular custom 8051 we need P2 for I/O. Why is RTX51 accessing P2 and can it be configured to not do it?

CAUSE

RTX51 accesses P2 when you start using reentrant functions with fast tasks. It uses P2 to access different pages of PDATA where fast task reentrant stacks are located.

It is not possible to disable this operation of RTX51.

RESOLUTION

The only option is to avoid using reentrant functions. If you have functions that are called from more than one task then there are a couple of things you can try (depending on your project):

  1. Protect the function from being called while it is executing. You can do this with semaphores for example. You will then need to disable the linker warnings using the DW directive.
  2. Make multiple copies of the function and use one for each task. While this can make maintaining the code harder, there is a method you can use to write a single function and automatically generate mutliple copies. For example:
    // FILE TWOFUNCS.C
    
    #define func func1
    #include "FUNC.C"
    #undef func
    #define func func2
    #include "FUNC.C
    
    // FILE FUNC.C
    
    unsigned char func(unsigned char x)
    {
      return x + 1;
    }
    

    Include TWOFUNCS.C in your project, not FUNC.C. The function 'func' ends up as two identical copies called 'func1' and 'func2'.

MORE INFORMATION

Refer to pages 118-120 of the RTX51 User's Guide (04.98) for more information on the XDATA/PDATA memory usage of RTX51.

SEE ALSO

Article last edited on: 2005-07-19 10:28:40

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential