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


Context Switching Problem??

Posted by Nobody/Anonymous on March 22, 2007

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.



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 )

void v2( void *pvParameters )

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) 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