Quality RTOS & Embedded Software

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


Loading

Serial driver and Cortex M3

Posted by Reinhard Arlt on June 15, 2010
Hello,

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?

Thanks.

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.

Regards.

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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

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

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

New FAQ page about the FreeRTOS kernel and Amazon FreeRTOS.


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

Xilinx Microblaze and Zynq partner