Quality RTOS & Embedded Software

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




Loading

Context Switching Problem??

Posted by Nobody/Anonymous on March 22, 2007
Hi....

Just wondering if anyone has any insight into my problem....

Ive tested FreeRTOS working on a samsung s344b0x arm7 processor and got it working.... my problem now is that i start the scheduler and the first thread executes, and i think that there is a problem when it switches context , i tried increasing the stack sizes by a lot but the problem still happens, what i'm wondering is how to check that a context switch is happening properly, i.e. all the correct bits are getting pushed and popped..... ive been checking
(pxCurrentTCB->pxTopOfStack - pxCurrentTCB->pxStack) and it does come up with some pretty big numbers ??

so through my debugging ive came up with :

first it breaks on the first thread, then it breaks on vPreemtiveTick, then i try to step through the ISR but it pokes out???

Any ideas would be greatly appreciated.

Thanks

Will

RE: Context Switching Problem??

Posted by Nobody/Anonymous on March 25, 2007
Try starting with the scheduler in cooperative (set configUSE_PREEMPTION to 0) mode and with two very simple tasks -

int i = 0, j = 0;

void v1( void *pvParameters )
{
for(;;)
{
i++;
taskYIELD();
}
}

void v2( void *pvParameters )
{
for(;;)
{
j++;
taskYIELD();
}
}

then you should be able to step through the context switch without the tick getting in the way.

Once you are sure this is working then you can set the registers in both tasks to known values to check that the known values are saved and restored as expected.

once that is working, then you can re-introduce the tick.

These steps are a good way of finding the source of the problem.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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