Quality RTOS & Embedded Software

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


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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