Quality RTOS & Embedded Software

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


Loading

portCOPY_XRAM_TO_STACK on 8052 porting

Posted by superfede76 on July 23, 2007
Hi,
I'm trying to port FreeRTOS on a generic 8052 MCU (AT89C51ED2), starting from Cygnal port. I've removed the reference to SFRpage, because is not present in this MCU. When xTaskCreate calls the prvAllocateTCBAndStack that calls the pvPortMalloc, the portCOPY_XRAM_TO_STACK macro cannot performs the copletly copy, because when it start the ucStackBytes value is zero, and after the first "do while" cycle, because underflow, it starts from 255 and before arrive to 0, the program restart whithout starting the tasks.
regards

Federico


RE: portCOPY_XRAM_TO_STACK on 8052 porting

Posted by sotd on July 23, 2007
Maybe you are simply running out of RAM. How much RAM does your 8051 have compared to the Cygnal on which the port was made?

RE: portCOPY_XRAM_TO_STACK on 8052 porting

Posted by superfede76 on July 24, 2007
I've used an At89c51id2 whith 1792 kByte of XRAM. Other porting run on microcontroller like pic18 with a smaller memory.

RE: portCOPY_XRAM_TO_STACK on 8052 porting

Posted by superfede76 on July 26, 2007
excuse me: the XRAM memory is 1792 Byte and not "KByte".
During debugging I've noted in the portCOPY_XRAM_TO_STACK macro the value of ucStackBytes = pxXRAMStack[ 0 ] is 0 and this causes a bad copy of ram into xram whith a coneguent reset.
regards

RE: portCOPY_XRAM_TO_STACK on 8052 porting

Posted by David Hawks on July 26, 2007
Are you checking the return value of the call to xTaskCreate()? Assuming that xTaskCreate() was able to allocate the required memory in prvAllocateTCBAndStack(), the subsequent call to pxPortInitialiseStack() should set up the task's XRAM stack copy such that a call to portCOPY_XRAM_TO_STACK() would succeed.

Perhaps you don't have enough heap space. What value of configTOTAL_HEAP_SIZE are you using? What tasks (along with stack sizes) are you trying to create? The Cygnal demo application allocates 8 flash tasks, 4 semaphore tasks, 1 integer math task, 2 polled queue tasks, 2 com tasks, 4 semaphore tasks, 2 FLOP tasks, a register test task, an error check task, and the idle task, each with about 200 bytes of stack space. That is roughly 5200 bytes of heap space before adding any of the queues, semaphores, or task structures (the Cygnal port allocates 6 KiB for the heap). With only 1792 bytes of XRAM, you will have to cut way back on the number of tasks and/or size of stacks you use.

RE: portCOPY_XRAM_TO_STACK on 8052 porting

Posted by superfede76 on July 27, 2007
In my new porting i've used only a little test task because the little memory. This morning, during debuging I've discovered why this happens. When the first time the portYield is called, it make nothing (I don't know the motivation), and no byte is saved into XRAM. When xPortStartScheduler call the macro portCOPY_XRAM_TO_STACK there is no data saved into XRAM, the ucStackBytes value is zero, Because in his position there is non data, and the first decrementation cause his undeflow...
Now my problem is: why portYield make nothing. I'm working on this.
regards


[ 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.1 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.


Careers

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

Renesas

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