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


Serial driver and Cortex M3

Posted by Reinhard Arlt on June 15, 2010

while porting a small app, that runs on ARM7 and PowerPC ports of FreeRTOS, to a LPC1758, i had to find out, that i can not use API calls, that force a context switch in a taskENTER_CRITICAL() task_EXIT_CRITICAL() section. For example, the serial driver from the LPC2106 port do this.

Here xQueueSend() is called after a taskENTER_CRITICAL(), and the result is an infinite loop in "vListInsert()".
The system tries to put the same task several times in the "xTasksWaitingToSend" of the tx queue, because it is not able to stop the task after it do so the first time, as the interrupts are off.

Is there an easy way to fix the serial driver?


RE: Serial driver and Cortex M3

Posted by Richard on June 15, 2010
The big difference between the Cortex-M3 port and the ARM7 port is that when the ARM7 port calls taskYIELD() it will yield immediately no matter where it is called from - and when the Cortex-M3 port calls taskYIELD() it will set an interrupt pend bit and therefore only actually yield once outside a critical section (if it was called from inside a critical section).

Hope that helps.


RE: Serial driver and Cortex M3

Posted by Reinhard Arlt on June 16, 2010
The API reference is a bit vague, if context switching API calls are allowed after a "taskENTER_CRITICAL()".

From the fact, that for example the serial diver (Demo/ARM7_LPC2106_GCC/serial/serial.c) do it, and it is forbidden after a vTaskSuspendAll(), I have assumed up to now, that it is allowed.

An answer like: It is allowed on ARM7 and not on CORTEX-M3 would be a bit disappointing, as i think, that a kernel should provide the same API on all supported platforms.

[ 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