FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2010 Threads] Serial driver and Cortex M3Posted 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 M3Posted 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 M3Posted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|