Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


8051 port - PDATA Pages for task stacks/etc

Posted by John W. on October 15, 2007

For those of you working with the 8051 - have you tried using PDATA pages to store the tasks stack/context?

This seems to be a viable approach for devices like the C8051F120 - and obviates having to do the XRAM copy/restore step.

John W.

RE: 8051 port - PDATA Pages for task stacks/etc

Posted by sotd on October 16, 2007
Is PDATA not limited to 256 bytes?

RE: 8051 port - PDATA Pages for task stacks/e

Posted by John W. on October 16, 2007
Each PDATA page is limited to 256 bytes - but you can have multiple pages.


RE: 8051 port - PDATA Pages for task stacks/e

Posted by David Hawks on October 16, 2007
PDATA is a method to use eight bit addressing to access external memory. The lower eight bits of the 16-bit address are encoded in the instruction while the upper eight bits are set by some other register outside of the instruction.

I don't see how this obviates an XRAM copy/restore step as the hardware stack must always reside in internal memory. What am I missing?

RE: 8051 port - PDATA Pages for task stacks/e

Posted by John W. on October 17, 2007
Hello David,

I think I should have worded, "and obviates" - to "could obviate".

I was a little unclear on this myself - evidently IAR limits you to one PDATA page at link-time - but you can switch PDATA
pages using: (according to a reliable source:)

"The C8051F120 has 16 pages of PDATA space. The datasheet refers to this space as XRAM. Switching between pages is accomplished by setting the PGSELx bits in the EMI0CN SFR. In assembly, this can be accomplished by a “mov” instruction, which will take 3 clock cycles."

Someone mentioned to me this could obviate the XRAM copy step - in reality, as you point out - I don't think it does.

I think the person that mentioned this to me thought everything could be declared __pdata_reentrant with the IAR compiler - but
didn't think about the hardware stack in IDATA. Since the IAR compiler has it's own routines to copy stacks for the reentrant functions - I think the thinking was/is if a task can be assigned a PDATA page - that the task contexts could be paged effectively.
I suppose this could be done - but you still have the to/from copy step to the PDATA page that has to be done. This is also not a good use of XRAM if your app. becomes somewhat XRAM limited.

John W.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner