Merge branch 'main' into update-pxcurrentTCB

This commit is contained in:
chinglee-iot 2024-08-06 14:24:30 +08:00 committed by GitHub
commit 893fcc8ea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 459 additions and 263 deletions

View file

@ -14,12 +14,12 @@ application projects. That way you will have the correct FreeRTOS source files
included, and the correct include paths configured. Once a demo application is included, and the correct include paths configured. Once a demo application is
building and executing you can remove the demo application files, and start to building and executing you can remove the demo application files, and start to
add in your own application source files. See the add in your own application source files. See the
[FreeRTOS Kernel Quick Start Guide](https://www.FreeRTOS.org/FreeRTOS-quick-start-guide.html) [FreeRTOS Kernel Quick Start Guide](https://www.freertos.org/Documentation/01-FreeRTOS-quick-start/01-Beginners-guide/02-Quick-start-guide)
for detailed instructions and other useful links. for detailed instructions and other useful links.
Additionally, for FreeRTOS kernel feature information refer to the Additionally, for FreeRTOS kernel feature information refer to the
[Developer Documentation](https://www.FreeRTOS.org/features.html), [Developer Documentation](https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/00-Developer-docs),
and [API Reference](https://www.FreeRTOS.org/a00106.html). and [API Reference](https://www.freertos.org/Documentation/02-Kernel/04-API-references/01-Task-creation/00-TaskHandle).
Also for contributing and creating a Pull Request please refer to Also for contributing and creating a Pull Request please refer to
[the instructions here](.github/CONTRIBUTING.md#contributing-via-pull-request). [the instructions here](.github/CONTRIBUTING.md#contributing-via-pull-request).

View file

@ -30,7 +30,7 @@
* This is a simple main that will start the FreeRTOS-Kernel and run a periodic task * This is a simple main that will start the FreeRTOS-Kernel and run a periodic task
* that only delays if compiled with the template port, this project will do nothing. * that only delays if compiled with the template port, this project will do nothing.
* For more information on getting started please look here: * For more information on getting started please look here:
* https://freertos.org/FreeRTOS-quick-start-guide.html * https://www.freertos.org/Documentation/01-FreeRTOS-quick-start/01-Beginners-guide/02-Quick-start-guide
*/ */
/* FreeRTOS includes. */ /* FreeRTOS includes. */

View file

@ -1645,7 +1645,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* or semaphores contained in the set is in a state where a queue read or * or semaphores contained in the set is in a state where a queue read or
* semaphore take operation would be successful. * semaphore take operation would be successful.
* *
* Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html * Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
* for reasons why queue sets are very rarely needed in practice as there are * for reasons why queue sets are very rarely needed in practice as there are
* simpler methods of blocking on multiple objects. * simpler methods of blocking on multiple objects.
* *
@ -1742,7 +1742,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
* function. * function.
* *
* Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html * Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
* for reasons why queue sets are very rarely needed in practice as there are * for reasons why queue sets are very rarely needed in practice as there are
* simpler methods of blocking on multiple objects. * simpler methods of blocking on multiple objects.
* *

2
list.c
View file

@ -166,7 +166,7 @@ void vListInsert( List_t * const pxList,
{ {
/* *** NOTE *********************************************************** /* *** NOTE ***********************************************************
* If you find your application is crashing here then likely causes are * If you find your application is crashing here then likely causes are
* listed below. In addition see https://www.FreeRTOS.org/FAQHelp.html for * listed below. In addition see https://www.freertos.org/Why-FreeRTOS/FAQs for
* more tips, and ensure configASSERT() is defined! * more tips, and ensure configASSERT() is defined!
* https://www.FreeRTOS.org/a00110.html#configASSERT * https://www.FreeRTOS.org/a00110.html#configASSERT
* *

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -669,7 +669,7 @@ void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -694,7 +694,7 @@ void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1288,7 +1288,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -292,7 +292,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -801,7 +801,7 @@ __attribute__( ( weak ) ) void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -767,7 +767,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -1462,7 +1462,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -335,7 +335,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -886,7 +886,7 @@ static void vPortEnableVFP( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -853,7 +853,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -1605,7 +1605,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -323,7 +323,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -876,7 +876,7 @@ static void vPortEnableVFP( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -28,6 +28,7 @@
/* Standard includes. */ /* Standard includes. */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
/* Scheduler includes. */ /* Scheduler includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
@ -80,13 +81,22 @@
#define portTASK_RETURN_ADDRESS prvTaskExitError #define portTASK_RETURN_ADDRESS prvTaskExitError
#endif #endif
/* The space on the stack required to hold the FPU registers. */
#if ( configFPU_D32 == 1 )
#define portFPU_REGISTER_WORDS ( ( 32 * 2 ) + 1 ) /* D0-D31 and FPSCR. */
#else
#define portFPU_REGISTER_WORDS ( ( 16 * 2 ) + 1 ) /* D0-D15 and FPSCR. */
#endif /* configFPU_D32 */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
* Starts the first task executing. This function is necessarily written in * These functions are necessarily written in assembly code, so are implemented
* assembly code so is implemented in portASM.s. * in portASM.S.
*/ */
extern void vPortRestoreTaskContext( void ); extern void vPortRestoreTaskContext( void );
extern void vPortInitialiseFPSCR( void );
extern uint32_t ulReadAPSR( void );
/* /*
* Used to catch tasks that attempt to return from their implementing function. * Used to catch tasks that attempt to return from their implementing function.
@ -184,12 +194,33 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
/* The task will start with a critical nesting count of 0 as interrupts are /* The task will start with a critical nesting count of 0 as interrupts are
* enabled. */ * enabled. */
*pxTopOfStack = portNO_CRITICAL_NESTING; *pxTopOfStack = portNO_CRITICAL_NESTING;
pxTopOfStack--;
#if ( configUSE_TASK_FPU_SUPPORT == 1 )
{
/* The task will start without a floating point context. A task that uses /* The task will start without a floating point context. A task that uses
* the floating point hardware must call vPortTaskUsesFPU() before executing * the floating point hardware must call vPortTaskUsesFPU() before executing
* any floating point instructions. */ * any floating point instructions. */
pxTopOfStack--;
*pxTopOfStack = portNO_FLOATING_POINT_CONTEXT; *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT;
}
#elif ( configUSE_TASK_FPU_SUPPORT == 2 )
{
/* The task will start with a floating point context. Leave enough
* space for the registers - and ensure they are initialised to 0. */
pxTopOfStack -= portFPU_REGISTER_WORDS;
memset( pxTopOfStack, 0x00, portFPU_REGISTER_WORDS * sizeof( StackType_t ) );
/* Initialise the slot containing ulPortTaskHasFPUContext to true as
* the task starts with a floating point context. */
pxTopOfStack--;
*pxTopOfStack = pdTRUE;
ulPortTaskHasFPUContext = pdTRUE;
}
#else
{
#error "Invalid configUSE_TASK_FPU_SUPPORT value - configUSE_TASK_FPU_SUPPORT must be set to 1, 2, or left undefined."
}
#endif /* if ( configUSE_TASK_FPU_SUPPORT == 1 ) */
return pxTopOfStack; return pxTopOfStack;
} }
@ -218,7 +249,7 @@ BaseType_t xPortStartScheduler( void )
/* Only continue if the CPU is not in User mode. The CPU must be in a /* Only continue if the CPU is not in User mode. The CPU must be in a
* Privileged mode for the scheduler to start. */ * Privileged mode for the scheduler to start. */
__asm volatile ( "MRS %0, APSR" : "=r" ( ulAPSR )::"memory" ); ulAPSR = ulReadAPSR();
ulAPSR &= portAPSR_MODE_BITS_MASK; ulAPSR &= portAPSR_MODE_BITS_MASK;
configASSERT( ulAPSR != portAPSR_USER_MODE ); configASSERT( ulAPSR != portAPSR_USER_MODE );
@ -310,15 +341,17 @@ void FreeRTOS_Tick_Handler( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_TASK_FPU_SUPPORT != 2 )
void vPortTaskUsesFPU( void ) void vPortTaskUsesFPU( void )
{ {
uint32_t ulInitialFPSCR = 0;
/* A task is registering the fact that it needs an FPU context. Set the /* A task is registering the fact that it needs an FPU context. Set the
* FPU flag (which is saved as part of the task context). */ * FPU flag (which is saved as part of the task context). */
ulPortTaskHasFPUContext = pdTRUE; ulPortTaskHasFPUContext = pdTRUE;
/* Initialise the floating point status register. */ /* Initialise the floating point status register. */
__asm volatile ( "FMXR FPSCR, %0" ::"r" ( ulInitialFPSCR ) : "memory" ); vPortInitialiseFPSCR();
} }
#endif /* configUSE_TASK_FPU_SUPPORT */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -28,14 +28,14 @@
.text .text
.arm .arm
.syntax unified
.set SYS_MODE, 0x1f .set SYS_MODE, 0x1f
.set SVC_MODE, 0x13 .set SVC_MODE, 0x13
.set IRQ_MODE, 0x12 .set IRQ_MODE, 0x12
.set CPSR_I_BIT, 0x80
/* Variables and functions. */ /* Variables and functions. */
.extern ulMaxAPIPriorityMask
.extern _freertos_vector_table
.extern pxCurrentTCB .extern pxCurrentTCB
.extern vTaskSwitchContext .extern vTaskSwitchContext
.extern vApplicationIRQHandler .extern vApplicationIRQHandler
@ -47,29 +47,38 @@
.global FreeRTOS_IRQ_Handler .global FreeRTOS_IRQ_Handler
.global FreeRTOS_SVC_Handler .global FreeRTOS_SVC_Handler
.global vPortRestoreTaskContext .global vPortRestoreTaskContext
.global vPortInitialiseFPSCR
.global ulReadAPSR
.global vPortYield
.global vPortEnableInterrupts
.global vPortDisableInterrupts
.global ulPortSetInterruptMaskFromISR
.global ulPortCountLeadingZeros
.weak vApplicationSVCHandler
/*-----------------------------------------------------------*/
.macro portSAVE_CONTEXT .macro portSAVE_CONTEXT
/* Save the LR and SPSR onto the system mode stack before switching to /* Save the LR and SPSR onto the system mode stack before switching to
system mode to save the remaining system mode registers. */ * system mode to save the remaining system mode registers. */
SRSDB sp!, #SYS_MODE SRSDB SP!, #SYS_MODE
CPS #SYS_MODE CPS #SYS_MODE
PUSH {R0-R12, R14} PUSH {R0-R12, R14}
/* Push the critical nesting count. */ /* Push the critical nesting count. */
LDR R2, ulCriticalNestingConst LDR R2, =ulCriticalNesting
LDR R1, [R2] LDR R1, [R2]
PUSH {R1} PUSH {R1}
/* Does the task have a floating point context that needs saving? If /* Does the task have a floating point context that needs saving? If
ulPortTaskHasFPUContext is 0 then no. */ * ulPortTaskHasFPUContext is 0 then no. */
LDR R2, ulPortTaskHasFPUContextConst LDR R2, =ulPortTaskHasFPUContext
LDR R3, [R2] LDR R3, [R2]
CMP R3, #0 CMP R3, #0
/* Save the floating point context, if any. */ /* Save the floating point context, if any. */
FMRXNE R1, FPSCR VMRSNE R1, FPSCR
VPUSHNE {D0-D15} VPUSHNE {D0-D15}
#if configFPU_D32 == 1 #if configFPU_D32 == 1
VPUSHNE {D16-D31} VPUSHNE {D16-D31}
@ -80,24 +89,24 @@
PUSH {R3} PUSH {R3}
/* Save the stack pointer in the TCB. */ /* Save the stack pointer in the TCB. */
LDR R0, pxCurrentTCBConst LDR R0, =pxCurrentTCB
LDR R1, [R0] LDR R1, [R0]
STR SP, [R1] STR SP, [R1]
.endm .endm
; /**********************************************************************/ /*-----------------------------------------------------------*/
.macro portRESTORE_CONTEXT .macro portRESTORE_CONTEXT
/* Set the SP to point to the stack of the task being restored. */ /* Set the SP to point to the stack of the task being restored. */
LDR R0, pxCurrentTCBConst LDR R0, =pxCurrentTCB
LDR R1, [R0] LDR R1, [R0]
LDR SP, [R1] LDR SP, [R1]
/* Is there a floating point context to restore? If the restored /* Is there a floating point context to restore? If the restored
ulPortTaskHasFPUContext is zero then no. */ * ulPortTaskHasFPUContext is zero then no. */
LDR R0, ulPortTaskHasFPUContextConst LDR R0, =ulPortTaskHasFPUContext
POP {R1} POP {R1}
STR R1, [R0] STR R1, [R0]
CMP R1, #0 CMP R1, #0
@ -111,7 +120,7 @@
VMSRNE FPSCR, R0 VMSRNE FPSCR, R0
/* Restore the critical section nesting depth. */ /* Restore the critical section nesting depth. */
LDR R0, ulCriticalNestingConst LDR R0, =ulCriticalNesting
POP {R1} POP {R1}
STR R1, [R0] STR R1, [R0]
@ -120,29 +129,17 @@
POP {R0-R12, R14} POP {R0-R12, R14}
/* Return to the task code, loading CPSR on the way. */ /* Return to the task code, loading CPSR on the way. */
RFEIA sp! RFEIA SP!
.endm .endm
/*-----------------------------------------------------------*/
/*
* void vPortRestoreTaskContext( void );
/****************************************************************************** *
* SVC handler is used to yield.
*****************************************************************************/
.align 4
.type FreeRTOS_SVC_Handler, %function
FreeRTOS_SVC_Handler:
/* Save the context of the current task and select a new task to run. */
portSAVE_CONTEXT
LDR R0, vTaskSwitchContextConst
BLX R0
portRESTORE_CONTEXT
/******************************************************************************
* vPortRestoreTaskContext is used to start the scheduler. * vPortRestoreTaskContext is used to start the scheduler.
*****************************************************************************/ */
.align 4 .align 4
.type vPortRestoreTaskContext, %function .type vPortRestoreTaskContext, %function
vPortRestoreTaskContext: vPortRestoreTaskContext:
@ -150,72 +147,212 @@ vPortRestoreTaskContext:
CPS #SYS_MODE CPS #SYS_MODE
portRESTORE_CONTEXT portRESTORE_CONTEXT
/*-----------------------------------------------------------*/
/*
* void vPortInitialiseFPSCR( void );
*
* vPortInitialiseFPSCR is used to initialize the FPSCR register.
*/
.align 4
.type vPortInitialiseFPSCR, %function
vPortInitialiseFPSCR:
MOV R0, #0
VMSR FPSCR, R0
BX LR
/*-----------------------------------------------------------*/
/*
* uint32_t ulReadAPSR( void );
*
* ulReadAPSR is used to read the value of APSR context.
*/
.align 4
.type ulReadAPSR, %function
ulReadAPSR:
MRS R0, APSR
BX LR
/*-----------------------------------------------------------*/
/*
* void vPortYield( void );
*/
.align 4
.type vPortYield, %function
vPortYield:
SVC 0
ISB
BX LR
/*-----------------------------------------------------------*/
/*
* void vPortEnableInterrupts( void );
*/
.align 4
.type vPortEnableInterrupts, %function
vPortEnableInterrupts:
CPSIE I
BX LR
/*-----------------------------------------------------------*/
/*
* void vPortDisableInterrupts( void );
*/
.align 4
.type vPortDisableInterrupts, %function
vPortDisableInterrupts:
CPSID I
DSB
ISB
BX LR
/*-----------------------------------------------------------*/
/*
* uint32_t ulPortSetInterruptMaskFromISR( void );
*/
.align 4
.type ulPortSetInterruptMaskFromISR, %function
ulPortSetInterruptMaskFromISR:
MRS R0, CPSR
AND R0, R0, #CPSR_I_BIT
CPSID I
DSB
ISB
BX LR
/*-----------------------------------------------------------*/
/*
* void vApplicationSVCHandler( uint32_t ulSvcNumber );
*/
.align 4
.type vApplicationSVCHandler, %function
vApplicationSVCHandler:
B vApplicationSVCHandler
/*-----------------------------------------------------------*/
/*
* UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
*
* According to the Procedure Call Standard for the ARM Architecture (AAPCS):
* - Parameter ulBitmap is passed in R0.
* - Return value must be in R0.
*/
.align 4
.type ulPortCountLeadingZeros, %function
ulPortCountLeadingZeros:
CLZ R0, R0
BX LR
/*-----------------------------------------------------------*/
/*
* SVC handler is used to yield.
*/
.align 4
.type FreeRTOS_SVC_Handler, %function
FreeRTOS_SVC_Handler:
PUSH { R0-R1 }
/* ---------------------------- Get Caller SVC Number ---------------------------- */
MRS R0, SPSR /* R0 = CPSR at the time of SVC. */
TST R0, #0x20 /* Check Thumb bit (5) in CPSR. */
LDRHNE R0, [LR, #-0x2] /* If Thumb, load halfword. */
BICNE R0, R0, #0xFF00 /* And extract immidiate field (i.e. SVC number). */
LDREQ R0, [LR, #-0x4] /* If ARM, load word. */
BICEQ R0, R0, #0xFF000000 /* And extract immidiate field (i.e. SVC number). */
/* --------------------------------- SVC Routing --------------------------------- */
CMP R0, #0
BEQ svcPortYield
BNE svcApplicationCall
svcPortYield:
POP { R0-R1 }
portSAVE_CONTEXT
BLX vTaskSwitchContext
portRESTORE_CONTEXT
svcApplicationCall:
POP { R0-R1 }
portSAVE_CONTEXT
BLX vApplicationSVCHandler
portRESTORE_CONTEXT
/*-----------------------------------------------------------*/
.align 4 .align 4
.type FreeRTOS_IRQ_Handler, %function .type FreeRTOS_IRQ_Handler, %function
FreeRTOS_IRQ_Handler: FreeRTOS_IRQ_Handler:
/* Return to the interrupted instruction. */ /* Return to the interrupted instruction. */
SUB lr, lr, #4 SUB LR, LR, #4
/* Push the return address and SPSR. */ /* Push the return address and SPSR. */
PUSH {lr} PUSH {LR}
MRS lr, SPSR MRS LR, SPSR
PUSH {lr} PUSH {LR}
/* Change to supervisor mode to allow reentry. */ /* Change to supervisor mode to allow reentry. */
CPS #0x13 CPS #SVC_MODE
/* Push used registers. */ /* Push used registers. */
PUSH {r0-r3, r12} PUSH {R0-R3, R12}
/* Increment nesting count. r3 holds the address of ulPortInterruptNesting /* Increment nesting count. r3 holds the address of ulPortInterruptNesting
for future use. r1 holds the original ulPortInterruptNesting value for * for future use. r1 holds the original ulPortInterruptNesting value for
future use. */ * future use. */
LDR r3, ulPortInterruptNestingConst LDR R3, =ulPortInterruptNesting
LDR r1, [r3] LDR R1, [R3]
ADD r0, r1, #1 ADD R0, R1, #1
STR r0, [r3] STR R0, [R3]
/* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for
future use. */ * future use. */
MOV r0, sp MOV R0, SP
AND r2, r0, #4 AND R2, R0, #4
SUB sp, sp, r2 SUB SP, SP, R2
/* Call the interrupt handler. */ /* Call the interrupt handler. */
PUSH {r0-r3, lr} PUSH {R0-R3, LR}
LDR r1, vApplicationIRQHandlerConst BLX vApplicationIRQHandler
BLX r1 POP {R0-R3, LR}
POP {r0-r3, lr} ADD SP, SP, R2
ADD sp, sp, r2
/* Disable IRQs incase vApplicationIRQHandler enabled them for re-entry. */
CPSID i CPSID i
DSB DSB
ISB ISB
/* Write to the EOI register. */ /* Write to the EOI register. */
LDR r0, ulICCEOIRConst LDR R0, =ulICCEOIR
LDR r2, [r0] LDR R2, [R0]
STR r0, [r2] STR R0, [R2]
/* Restore the old nesting count. */ /* Restore the old nesting count. */
STR r1, [r3] STR R1, [R3]
/* A context switch is never performed if the nesting count is not 0. */ /* A context switch is never performed if the nesting count is not 0. */
CMP r1, #0 CMP R1, #0
BNE exit_without_switch BNE exit_without_switch
/* Did the interrupt request a context switch? r1 holds the address of /* Did the interrupt request a context switch? r1 holds the address of
ulPortYieldRequired and r0 the value of ulPortYieldRequired for future * ulPortYieldRequired and r0 the value of ulPortYieldRequired for future
use. */ * use. */
LDR r1, ulPortYieldRequiredConst LDR R1, =ulPortYieldRequired
LDR r0, [r1] LDR R0, [R1]
CMP r0, #0 CMP R0, #0
BNE switch_before_exit BNE switch_before_exit
exit_without_switch: exit_without_switch:
/* No context switch. Restore used registers, LR_irq and SPSR before /* No context switch. Restore used registers, LR_irq and SPSR before
returning. */ * returning. */
POP {r0-r3, r12} POP {R0-R3, R12}
CPS #IRQ_MODE CPS #IRQ_MODE
POP {LR} POP {LR}
MSR SPSR_cxsf, LR MSR SPSR_cxsf, LR
@ -224,13 +361,13 @@ exit_without_switch:
switch_before_exit: switch_before_exit:
/* A context switch is to be performed. Clear the context switch pending /* A context switch is to be performed. Clear the context switch pending
flag. */ * flag. */
MOV r0, #0 MOV R0, #0
STR r0, [r1] STR R0, [R1]
/* Restore used registers, LR-irq and SPSR before saving the context /* Restore used registers, LR-irq and SPSR before saving the context
to the task stack. */ * to the task stack. */
POP {r0-r3, r12} POP {R0-R3, R12}
CPS #IRQ_MODE CPS #IRQ_MODE
POP {LR} POP {LR}
MSR SPSR_cxsf, LR MSR SPSR_cxsf, LR
@ -238,23 +375,15 @@ switch_before_exit:
portSAVE_CONTEXT portSAVE_CONTEXT
/* Call the function that selects the new task to execute. /* Call the function that selects the new task to execute.
vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD * vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD
instructions, or 8 byte aligned stack allocated data. LR does not need * instructions, or 8 byte aligned stack allocated data. LR does not need
saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ * saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */
LDR R0, vTaskSwitchContextConst BLX vTaskSwitchContext
BLX R0
/* Restore the context of, and branch to, the task selected to execute /* Restore the context of, and branch to, the task selected to execute
next. */ * next. */
portRESTORE_CONTEXT portRESTORE_CONTEXT
ulICCEOIRConst: .word ulICCEOIR /*-----------------------------------------------------------*/
pxCurrentTCBConst: .word pxCurrentTCB
ulCriticalNestingConst: .word ulCriticalNesting
ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext
vTaskSwitchContextConst: .word vTaskSwitchContext
vApplicationIRQHandlerConst: .word vApplicationIRQHandler
ulPortInterruptNestingConst: .word ulPortInterruptNesting
ulPortYieldRequiredConst: .word ulPortYieldRequired
.end .end

View file

@ -88,46 +88,30 @@ typedef uint32_t TickType_t;
} }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
#define portYIELD() \
__asm volatile ( "SWI 0 \n" \
"ISB " ::: "memory" );
void vPortYield( void );
/*----------------------------------------------------------- #define portYIELD() vPortYield();
* Critical section control
*----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/*
* Critical section management.
*/
extern void vPortEnterCritical( void ); extern void vPortEnterCritical( void );
extern void vPortExitCritical( void ); extern void vPortExitCritical( void );
extern uint32_t ulPortSetInterruptMask( void ); extern void vPortEnableInterrupts( void );
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue ); extern void vPortDisableInterrupts( void );
extern void vPortInstallFreeRTOSVectorTable( void ); extern uint32_t ulPortSetInterruptMaskFromISR( void );
/* The I bit within the CPSR. */
#define portINTERRUPT_ENABLE_BIT ( 1 << 7 )
/* In the absence of a priority mask register, these functions and macros /* In the absence of a priority mask register, these functions and macros
* globally enable and disable interrupts. */ * globally enable and disable interrupts. */
#define portENTER_CRITICAL() vPortEnterCritical(); #define portENTER_CRITICAL() vPortEnterCritical();
#define portEXIT_CRITICAL() vPortExitCritical(); #define portEXIT_CRITICAL() vPortExitCritical();
#define portENABLE_INTERRUPTS() __asm volatile ( "CPSIE i \n" ::: "memory" ); #define portENABLE_INTERRUPTS() vPortEnableInterrupts();
#define portDISABLE_INTERRUPTS() \ #define portDISABLE_INTERRUPTS() vPortDisableInterrupts();
__asm volatile ( "CPSID i \n" \ #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMaskFromISR();
"DSB \n" \
"ISB " ::: "memory" );
__attribute__( ( always_inline ) ) static __inline uint32_t portINLINE_SET_INTERRUPT_MASK_FROM_ISR( void )
{
volatile uint32_t ulCPSR;
__asm volatile ( "MRS %0, CPSR" : "=r" ( ulCPSR )::"memory" );
ulCPSR &= portINTERRUPT_ENABLE_BIT;
portDISABLE_INTERRUPTS();
return ulCPSR;
}
#define portSET_INTERRUPT_MASK_FROM_ISR() portINLINE_SET_INTERRUPT_MASK_FROM_ISR()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) do { if( x == 0 ) portENABLE_INTERRUPTS(); } while( 0 ) #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) do { if( x == 0 ) portENABLE_INTERRUPTS(); } while( 0 )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -148,9 +132,27 @@ __attribute__( ( always_inline ) ) static __inline uint32_t portINLINE_SET_INTER
* handler for whichever peripheral is used to generate the RTOS tick. */ * handler for whichever peripheral is used to generate the RTOS tick. */
void FreeRTOS_Tick_Handler( void ); void FreeRTOS_Tick_Handler( void );
/* Any task that uses the floating point unit MUST call vPortTaskUsesFPU() /**
* before any floating point instructions are executed. */ * @brief Returns the number of leading zeros in a 32 bit variable.
*
* @param[in] ulBitmap 32-Bit number to count leading zeros in.
*
* @return The number of leading zeros in ulBitmap.
*/
UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are
* created without an FPU context and must call vPortTaskUsesFPU() to give
* themselves an FPU context before using any FPU instructions. If
* configUSE_TASK_FPU_SUPPORT is set to 2 then all tasks will have an FPU
* context by default. */
#if ( configUSE_TASK_FPU_SUPPORT != 2 )
void vPortTaskUsesFPU( void ); void vPortTaskUsesFPU( void );
#else
/* Each task has an FPU context already, so define this function as a
* no-op. */
#define vPortTaskUsesFPU()
#endif
#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() #define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU()
#define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL ) #define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL )
@ -163,19 +165,15 @@ void vPortTaskUsesFPU( void );
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
/* Store/clear the ready priorities in a bit map. */ /* Store, clear and get the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ulPortCountLeadingZeros( ( uxTopReadyPriority ) ) )
/*-----------------------------------------------------------*/
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) __builtin_clz( uxReadyPriorities ) )
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
#define portNOP() __asm volatile ( "NOP" ) #define portNOP() __asm volatile ( "NOP" )
#define portINLINE __inline #define portINLINE __inline
#define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" ) #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
/* *INDENT-OFF* */ /* *INDENT-OFF* */

View file

@ -427,7 +427,7 @@ uint32_t ulPortSetInterruptMask( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ); configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( uint32_t ) ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) );
/* Priority grouping: The interrupt controller (GIC) allows the bits /* Priority grouping: The interrupt controller (GIC) allows the bits

View file

@ -205,7 +205,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handler. For help installing the FreeRTOS handler, see * FreeRTOS handler. For help installing the FreeRTOS handler, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -246,7 +246,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -709,7 +709,7 @@ __weak void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -284,7 +284,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -753,7 +753,7 @@ __weak void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -748,7 +748,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -1336,7 +1336,7 @@ void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -272,7 +272,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -741,7 +741,7 @@ __weak void vPortSetupTimerInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -1650,7 +1650,7 @@ BaseType_t xPortStartScheduler( void ) /* PRIVILEGED_FUNCTION */
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -2041,7 +2041,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -892,7 +892,7 @@ BaseType_t xPortIsInsideInterrupt( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -465,7 +465,7 @@ uint32_t ulPortSetInterruptMask( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) ); configASSERT( portICCRPR_RUNNING_PRIORITY_REGISTER >= ( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ) );
/* Priority grouping: The interrupt controller (GIC) allows the bits /* Priority grouping: The interrupt controller (GIC) allows the bits

View file

@ -770,7 +770,7 @@ __asm uint32_t vPortGetIPSR( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -866,7 +866,7 @@ __asm uint32_t vPortGetIPSR( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -852,7 +852,7 @@ BaseType_t xPortStartScheduler( void )
* *
* Assertion failures here indicate incorrect installation of the * Assertion failures here indicate incorrect installation of the
* FreeRTOS handlers. For help installing the FreeRTOS handlers, see * FreeRTOS handlers. For help installing the FreeRTOS handlers, see
* https://www.FreeRTOS.org/FAQHelp.html. * https://www.freertos.org/Why-FreeRTOS/FAQs.
* *
* Systems with a configurable address for the interrupt vector table * Systems with a configurable address for the interrupt vector table
* can also encounter assertion failures or even system faults here if * can also encounter assertion failures or even system faults here if
@ -1602,7 +1602,7 @@ __asm uint32_t prvPortGetIPSR( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -852,7 +852,7 @@ __asm uint32_t vPortGetIPSR( void )
* *
* The following links provide detailed information: * The following links provide detailed information:
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
* https://www.FreeRTOS.org/FAQHelp.html */ * https://www.freertos.org/Why-FreeRTOS/FAQs */
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority ); configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
} }

View file

@ -420,36 +420,19 @@ static void vPortSystemTickHandler( int sig )
( void ) sig; ( void ) sig;
/* uint64_t xExpectedTicks; */
uxCriticalNesting++; /* Signals are blocked in this signal handler. */ uxCriticalNesting++; /* Signals are blocked in this signal handler. */
#if ( configUSE_PREEMPTION == 1 )
pxThreadToSuspend = prvGetThreadFromTask( xTaskGetCurrentTaskHandle() ); pxThreadToSuspend = prvGetThreadFromTask( xTaskGetCurrentTaskHandle() );
#endif
/* Tick Increment, accounting for any lost signals or drift in if( xTaskIncrementTick() != pdFALSE )
* the timer. */ {
/*
* Comment code to adjust timing according to full demo requirements
* xExpectedTicks = (prvGetTimeNs() - prvStartTimeNs)
* / (portTICK_RATE_MICROSECONDS * 1000);
* do { */
xTaskIncrementTick();
/* prvTickCount++;
* } while (prvTickCount < xExpectedTicks);
*/
#if ( configUSE_PREEMPTION == 1 )
/* Select Next Task. */ /* Select Next Task. */
vTaskSwitchContext(); vTaskSwitchContext();
pxThreadToResume = prvGetThreadFromTask( xTaskGetCurrentTaskHandle() ); pxThreadToResume = prvGetThreadFromTask( xTaskGetCurrentTaskHandle() );
prvSwitchThread( pxThreadToResume, pxThreadToSuspend ); prvSwitchThread( pxThreadToResume, pxThreadToSuspend );
#endif }
uxCriticalNesting--; uxCriticalNesting--;
} }

View file

@ -39,14 +39,6 @@
#include "task.h" #include "task.h"
#include "stream_buffer.h" #include "stream_buffer.h"
#if ( configUSE_TASK_NOTIFICATIONS != 1 )
#error configUSE_TASK_NOTIFICATIONS must be set to 1 to build stream_buffer.c
#endif
#if ( INCLUDE_xTaskGetCurrentTaskHandle != 1 )
#error INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 to build stream_buffer.c
#endif
/* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined /* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
* for the header files above, but not in this file, in order to generate the * for the header files above, but not in this file, in order to generate the
* correct privileged Vs unprivileged linkage and placement. */ * correct privileged Vs unprivileged linkage and placement. */
@ -58,6 +50,14 @@
* configUSE_STREAM_BUFFERS is set to 1 in FreeRTOSConfig.h. */ * configUSE_STREAM_BUFFERS is set to 1 in FreeRTOSConfig.h. */
#if ( configUSE_STREAM_BUFFERS == 1 ) #if ( configUSE_STREAM_BUFFERS == 1 )
#if ( configUSE_TASK_NOTIFICATIONS != 1 )
#error configUSE_TASK_NOTIFICATIONS must be set to 1 to build stream_buffer.c
#endif
#if ( INCLUDE_xTaskGetCurrentTaskHandle != 1 )
#error INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 to build stream_buffer.c
#endif
/* If the user has not provided application specific Rx notification macros, /* If the user has not provided application specific Rx notification macros,
* or #defined the notification macros away, then provide default implementations * or #defined the notification macros away, then provide default implementations
* that uses task notifications. */ * that uses task notifications. */

63
tasks.c
View file

@ -3868,9 +3868,30 @@ void vTaskSuspendAll( void )
#if ( configNUMBER_OF_CORES == 1 ) #if ( configNUMBER_OF_CORES == 1 )
{ {
/* A critical section is not required as the variable is of type /* A critical section is not required as the variable is of type
* BaseType_t. Please read Richard Barry's reply in the following link to a * BaseType_t. Each task maintains its own context, and a context switch
* post in the FreeRTOS support forum before reporting this as a bug! - * cannot occur if the variable is non zero. So, as long as the writing
* https://goo.gl/wu4acr */ * from the register back into the memory is atomic, it is not a
* problem.
*
* Consider the following scenario, which starts with
* uxSchedulerSuspended at zero.
*
* 1. load uxSchedulerSuspended into register.
* 2. Now a context switch causes another task to run, and the other
* task uses the same variable. The other task will see the variable
* as zero because the variable has not yet been updated by the
* original task. Eventually the original task runs again. **That can
* only happen when uxSchedulerSuspended is once again zero**. When
* the original task runs again, the contents of the CPU registers
* are restored to exactly how they were when it was switched out -
* therefore the value it read into the register still matches the
* value of the uxSchedulerSuspended variable.
*
* 3. increment register.
* 4. store register into uxSchedulerSuspended. The value restored to
* uxSchedulerSuspended will be the correct value of 1, even though
* the variable was used by other tasks in the mean time.
*/
/* portSOFTWARE_BARRIER() is only implemented for emulated/simulated ports that /* portSOFTWARE_BARRIER() is only implemented for emulated/simulated ports that
* do not otherwise exhibit real time behaviour. */ * do not otherwise exhibit real time behaviour. */
@ -8096,6 +8117,22 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
listREMOVE_ITEM( &( pxTCB->xStateListItem ) ); listREMOVE_ITEM( &( pxTCB->xStateListItem ) );
prvAddTaskToReadyList( pxTCB ); prvAddTaskToReadyList( pxTCB );
#if ( configUSE_TICKLESS_IDLE != 0 )
{
/* If a task is blocked waiting for a notification then
* xNextTaskUnblockTime might be set to the blocked task's time
* out time. If the task is unblocked for a reason other than
* a timeout xNextTaskUnblockTime is normally left unchanged,
* because it will automatically get reset to a new value when
* the tick count equals xNextTaskUnblockTime. However if
* tickless idling is used it might be more important to enter
* sleep mode at the earliest possible time - so reset
* xNextTaskUnblockTime here to ensure it is updated at the
* earliest possible time. */
prvResetNextTaskUnblockTime();
}
#endif
} }
else else
{ {
@ -8214,6 +8251,22 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
listREMOVE_ITEM( &( pxTCB->xStateListItem ) ); listREMOVE_ITEM( &( pxTCB->xStateListItem ) );
prvAddTaskToReadyList( pxTCB ); prvAddTaskToReadyList( pxTCB );
#if ( configUSE_TICKLESS_IDLE != 0 )
{
/* If a task is blocked waiting for a notification then
* xNextTaskUnblockTime might be set to the blocked task's time
* out time. If the task is unblocked for a reason other than
* a timeout xNextTaskUnblockTime is normally left unchanged,
* because it will automatically get reset to a new value when
* the tick count equals xNextTaskUnblockTime. However if
* tickless idling is used it might be more important to enter
* sleep mode at the earliest possible time - so reset
* xNextTaskUnblockTime here to ensure it is updated at the
* earliest possible time. */
prvResetNextTaskUnblockTime();
}
#endif
} }
else else
{ {
@ -8657,7 +8710,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) */ #endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) && ( configUSE_TIMERS == 1 ) )
/* /*
* This is the kernel provided implementation of vApplicationGetTimerTaskMemory() * This is the kernel provided implementation of vApplicationGetTimerTaskMemory()
@ -8678,7 +8731,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
*puxTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; *puxTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
} }
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) */ #endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) && ( configUSE_TIMERS == 1 ) ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*