Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists