Commit Graph

110 Commits

Author SHA1 Message Date
Skptak
def7d2df2b [AUTO][RELEASE]: Bump file header version to "10.5.1" 2022-11-15 20:10:13 +00:00
Skptak
612d9a87e8 [AUTO][RELEASE]: Bump task.h version macros to "10.5.1" 2022-11-15 20:10:12 +00:00
Gaurav-Aggarwal-AWS
6311ad13b9
Update doc comments in task.h (#570)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-09-28 21:42:05 +05:30
Gaurav Aggarwal
331362d45a Restrict unpriv task to invoke code with privilege
It was possible for an unprivileged task to invoke any function with
privilege by passing it as a parameter to MPU_xTaskCreate,
MPU_xTaskCreateStatic, MPU_xTimerCreate, MPU_xTimerCreateStatic, or
MPU_xTimerPendFunctionCall.

This commit ensures that MPU_xTaskCreate and MPU_xTaskCreateStatic can
only create unprivileged tasks. It also removes the following APIs:
1. MPU_xTimerCreate
2. MPU_xTimerCreateStatic
3. MPU_xTimerPendFunctionCall

We thank Huazhong University of Science and Technology for reporting
this issue.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-09-17 00:03:08 +05:30
Gaurav Aggarwal
79704b8213 Remove local stack variable form MPU wrappers
It was possible for a third party that had already independently gained
the ability to execute injected code to achieve further privilege
escalation by branching directly inside a FreeRTOS MPU API wrapper
function with a manually crafted stack frame. This commit removes the
local stack variable `xRunningPrivileged` so that a manually crafted
stack frame cannot be used for privilege escalation by branching
directly inside a FreeRTOS MPU API wrapper.

We thank Certibit Consulting, LLC, Huazhong University of Science and
Technology and the SecLab team at Northeastern University for reporting
this issue.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-09-17 00:03:08 +05:30
newbrain
c09187e73b
Update of three badly terminated macro definitions (#555)
* Update of three badly terminated macro definitions
- vTaskDelayUntil() to conform to usual pattern do { ... } while(0)
- vTaskNotifyGiveFromISR() and
- vTaskGenericNotifyGiveFromISR() to remove extra terminating semicolons
- This PR addresses issues #553 and #554

* Adjust formatting of task.h

Co-authored-by: Paul Bartell <pbartell@amazon.com>
2022-09-08 10:33:41 -07:00
Monika Singh
11c72bc075
Add support for MISRA rule 20.7 (#546)
Misra rule 20.7 requires parenthesis to all parameter names
in macro definitions.

The issue was reported here : https://forums.freertos.org/t/misra-20-7-compatibility/15385
2022-08-19 15:51:57 +05:30
Paul Bartell
48ad473891 correct grammar in include/FreeRTOS.h
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2022-08-10 10:14:56 -07:00
Paul Bartell
ab25da6087 Fix formatting of FreeRTOS.h 2022-08-10 10:14:56 -07:00
RichardBarry
c2bbe92cab Move some of the complex pre-processor guards on prvWriteNameToBuffer() to compile time checks in FreeRTOS.h.
Co-authored-by: Paul Bartell <pbartell@amazon.com>
2022-08-10 10:14:56 -07:00
Ravishankar Bhagavandas
b0a8bd8f28
Change default value of INCLUDE_xTaskGetCurrentTaskHandle (#542) 2022-08-09 09:48:44 -07:00
Gaurav-Aggarwal-AWS
95669cc1a1
Generalize Thread Local Storage (TLS) support (#540)
* Generalize Thread Local Storage (TLS) support

FreeRTOS's Thread Local Storage (TLS) support used variables and
functions from newlib, thereby making the TLS support specific to
newlib. This commit generalizes the TLS support so that it can be used
with other c-runtime libraries also. The default behavior for newlib
support is still kept same for backward compatibility.

The application writer would need to set configUSE_C_RUNTIME_TLS_SUPPORT
to 1 in their FreeRTOSConfig.h and define the following macros to
support TLS for a c-runtime library:

1. configTLS_BLOCK_TYPE - Type used to define the TLS block in TCB.
2. configINIT_TLS_BLOCK( xTLSBlock ) - Allocate and initialize memory
   block for the task's TLS Block.
3. configSET_TLS_BLOCK( xTLSBlock ) - Switch C-Runtime's TLS Block to
   point to xTLSBlock.
4. configDEINIT_TLS_BLOCK( xTLSBlock ) - Free up the memory allocated
   for the task's TLS Block.

The following is an example to support TLS for picolibc:

 #define configUSE_C_RUNTIME_TLS_SUPPORT        1
 #define configTLS_BLOCK_TYPE                   void*
 #define configINIT_TLS_BLOCK( xTLSBlock )      _init_tls( xTLSBlock )
 #define configSET_TLS_BLOCK( xTLSBlock )       _set_tls( xTLSBlock )
 #define configDEINIT_TLS_BLOCK( xTLSBlock )

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-08-08 21:23:29 +05:30
Ravishankar Bhagavandas
4a8c06689e
Change type of message buffer handle (#537) 2022-08-04 10:07:49 -07:00
Gaurav-Aggarwal-AWS
d5771a7a60
Add configUSE_MUTEXES to function declarations in header (#504)
This commit adds the configUSE_MUTEXES guard to the function
declarations in semphr.h which are only available when configUSE_MUTEXES
is set to 1.

It was reported here - https://forums.freertos.org/t/mutex-missing-reference-to-configuse-mutexes-on-the-online-documentation/15231

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-06-21 16:04:52 +05:30
Ravishankar Bhagavandas
0b46492740
Add callback overrides for stream buffer and message buffers (#437)
* Let each stream/message can use its own sbSEND_COMPLETED

In FreeRTOS.h, set the default value of configUSE_SB_COMPLETED_CALLBACK
to zero, and add additional space for the function pointer when
the buffer created statically.

In stream_buffer.c, modify the macro of sbSEND_COMPLETED which let
the stream buffer to use its own implementation, and then add an
pointer to the stream buffer's structure, and modify the
implementation of the buffer creating and initializing

Co-authored-by: eddie9712 <qw1562435@gmail.com>
2022-06-20 17:48:34 -07:00
alfred gedeon
719ceee352
Add suppport for ARM CM55 (#494)
* Add supposrt for ARM CM55

* Fix file header

* Remove duplicate code

* Refactor portmacro.h

1. portmacro.h is re-factored into 2 parts - portmacrocommon.h which is
   common to all ARMv8-M ports and portmacro.h which is different for
   different compiler and architecture. This enables us to provide
   Cortex-M55 ports without code duplication.
2. Update copy_files.py so that it copies Cortex-M55 ports correctly -
   all files except portmacro.h are used from Cortex-M33 ports.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-06-01 15:00:10 -07:00
Robert Berger
cf6850583c
queue.h: cTaskWokenByPost -> xTaskWokenByReceive (#491)
Co-authored-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
2022-04-25 14:11:51 -07:00
Anton Lagerholm
d5b95c9eda Corrected spelling mistake in mpu_prototypes.h
tasks.h doesn't exist.
2022-04-14 10:16:10 -07:00
Anton Lagerholm
9204f9f28d Correct spelling mistake in mpu_wrappers.h
tasks.h doesn't exist.
2022-04-14 10:16:10 -07:00
pierrenoel-bouteville-act
e73fabce9a
Declare vApplicationMallocFailedHook function in task.h instead in each C heap file (#483)
vApplicationMallocFailedHook was declared in each Heap file. which forces users to declare it and can cause problems if the prototype of the function changes.

Co-authored-by: Pierre-Noel Bouteville <pnb990@gmail.com>
2022-04-13 10:44:14 -07:00
Gaurav-Aggarwal-AWS
82be77995e
Heap improvements (#462)
* Heap improvements

This commit makes the following improvements:

1. Add a check to heap_2 to track if a memory block is allocated to the
   application or not. The MSB of the size field is used for this
   purpose. The same check already exists in heap_4 and heap_5. This
   check prevents against double free.

2. Add a new flag configHEAP_CLEAR_MEMORY_ON_FREE to heap_2, heap_4 and
   heap_5. The application writer can set it to 1 in their
   FreeRTOSConfig.h to ensure that a block of memory allocated using
   pvPortMalloc is cleared (i.e. set to zero) when it is freed using
   vPortFree. If left undefined, configHEAP_CLEAR_MEMORY_ON_FREE
   defaults to 0 for backward compatibility. We recommend setting
   configHEAP_CLEAR_MEMORY_ON_FREE to 1 for better security.

3. Add a new API pvPortCalloc to heap_2, heap_4 and heap_5. This API
   has the following signature:
   void * pvPortCalloc( size_t xNum, size_t xSize );
   It allocates memory for an array of xNum objects each of which is of
   xSize and initializes all bytes in the allocated storage to zero. If
   allocation succeeds, it returns a pointer to the lowest byte in the
   allocated memory block. On failure, it returns a null pointer.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-02-24 10:52:10 -08:00
Gaurav-Aggarwal-AWS
840214dc29
Update documentation of uxTaskGetTaskNumber function (#460)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2022-02-22 10:44:05 -08:00
mikisama
d5b2413f48
Fix typo (#454) 2022-02-13 15:47:52 -08:00
Muneeb Ahmed
4014abb943
Fix some warnings in doxygen comments (#453)
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2022-02-10 11:36:42 -08:00
Tobias Nießen
364f0e585f
Fix description of configQUEUE_REGISTRY_SIZE (#446) 2022-01-31 11:12:47 -08:00
isus-ipanienko
a3843bd5b1
Fix warning message error. (#443)
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2022-01-21 10:10:22 -08:00
Paul Bartell
dca4f80a6b
Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. (#433)
* Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type.

When configUSE_MINI_LIST_ITEM == 0:
	MiniListItem_t and ListItem_t are both typedefs of struct xLIST_ITEM.

When configUSE_MINI_LIST_ITEM == 1 (the default in projdefs.h):
	MiniListItem_t is a typedef of struct xMINI_LIST_ITEM, which contains 3 fewer fields than a struct xLIST_ITEM.
	This configuration saves approximately sizeof(TickType_t) + 2 * sizeof( void * ) bytes of ram, however it also violates strict aliasing rules which some compilers depend on for optimization.

configUSE_MINI_LIST_ITEM defaults to 1 when not defined.

* Add pp_indent_brace option to uncrustify config

Improves compliance with the FreeRTOS code style guide:
https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html
2022-01-19 13:12:57 -08:00
Jeff Tenney
990643ebe8
Fix support for stepping tick by xExpectedIdleTime (#73)
* Fix support for stepping maximum number of ticks

This commit fixes support for tickless implementations that call
vTaskStepTick() with the maximum number of allowed ticks to step.

vTaskStepTick()
---------------
Function vTaskStepTick() provides a way for the tickless idle
implementation to account for ticks that elapse during tickless idle.
The maximum number of stepped ticks allowed is the number passed to
portSUPPRESS_TICKS_AND_SLEEP().  It is the number of ticks between
xTickCount and xNextTaskUnblockTime.

vTaskStepTick() is specifically intended for use with tickless idle,
so it always executes with the scheduler disabled.  For reference,
compare it with the more general function xTaskCatchUpTicks().

Without this Change
-------------------
Prior to this commit, if a task is supposed to wake at xTickCount ==
0xFFFFFFFF, then when tickless idle ends, function vTaskStepTick()
sets the tick to 0xFFFFFFFF but the task remains on the delayed list
because xTaskIncrementTick() does not execute.  One tick later,
xTaskIncrementTick() executes because it's time to increment xTickCount
to 0x00000000.  An assertion failure occurs in
taskSWITCH_DELAYED_LISTS() because the delayed task list is not
empty.  Other examples of valling vTaskStepTick() with the maximum
allowed number of ticks merely result in a task waking one tick late.

Default Tickless Implementations
--------------------------------
Note that the default tickless implementations never pass the maximum
allowed value to vTaskStepTick().  The default implementations use the
tick interrupt to finish the sleep and allow that one tick to be
counted normally via the tick ISR and xTaskIncrementTick().

* Protect xPendedTicks with critical section

Function xTaskIncrementTick() increments xPendedTicks when the
scheduler is disabled.  That function typically executes inside the tick
ISR.  So code in xTaskCatchUpTicks() must mask interrupts when modifying
xPendedTicks.

* uncrustify tasks.c

* Update tasks.c

Style changes only - added comment and indentation to the two modified files.

* uncrustify

* Add test coverage for new conditional

* Add typecast

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com>
2022-01-10 12:44:12 -07:00
Jon Enz
abd887c687
Clean some spell check words. (#439) 2022-01-07 10:45:58 -08:00
Joseph Julicher
c4f9e27c28
Feature: Add task top/end of stack to task info report (#436)
uncrustify

Co-authored-by: Shreyas Balakrishna <shreyasbharath@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2022-01-06 12:03:56 -07:00
Joseph Julicher
f5df2c140c
Documentation update for xEventGroupClearBitsFromISR (#432)
* Documented the correct use of xEventGroupClearBitsFromISR

* removed typo
2021-12-28 14:20:33 -07:00
Joseph Julicher
455df7a07a
uxAutoReload replaced with xAutoReload to improve MISRA compliance (#429)
* Created xTimerGetReloadMode and uxTimerGetReloadMode.

* Changed the use of uxAutoReload to xAutoReload

* updated history.txt

* Update History.txt

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>

* Update timers.c

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>

* Added xTimerGetReloadMode to lexicon.txt

* uncrustified timers.c

* Fix formatting check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2021-12-27 11:36:59 -07:00
Pramith K V
4c4089b154
Remove tickless idle mode dependency with include v task suspend (#422)
* Fix Remove tickless idle feature dependency with INCLUDE_vTaskSuspend
* fix unused variable warning
* Fix CI fomatting check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Authored-by: pramithkv <pramit@lifesignals.com>
2021-12-08 15:47:07 -08:00
Gaurav Aggarwal
6ac9aaec95 Fix formatting error
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2021-11-15 15:09:12 -08:00
Gaurav Aggarwal
7a3848753b Change xPortRaisePrivilege and vPortResetPrivilege to macros
This prevents non-kernel code from calling these functions.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2021-11-15 15:09:12 -08:00
Gaurav-Aggarwal-AWS
78da9cb261
Fix code example in timers.h (#412)
The example was trying to create a timer with period 0 which is not a
valid period.

This was reported here - https://forums.freertos.org/t/multiple-timers/13884

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2021-11-12 10:36:49 -08:00
Tobias Nießen
4896d6b1a1 Mention portMAX_DELAY in xEventGroupWaitBits docs (#411)
The public function xEventGroupWaitBits passes xTicksToWait to the
function vTaskPlaceOnUnorderedEventList, which passes the number of
ticks to prvAddCurrentTaskToDelayedList and sets xCanBlockIndefinitely
to pdTRUE, causing the latter to block indefinitely if
xTicksToWait == portMAX_DELAY and INCLUDE_vTaskSuspend == 1.
2021-11-10 17:39:01 -08:00
Gaurav-Aggarwal-AWS
5a2a1d0702
Change taskYIELD_FROM_ISR to portYIELD_FROM_ISR in docs (#408) 2021-11-05 14:33:15 -07:00
prplz
a40d52dc05
Fix documentation mistake (#407)
ulTaskNotification -> ulTaskNotify
2021-11-05 10:55:17 -07:00
Zim Kalinowski
f8ada39d85
Replace <pre> with @code - remaining files (#388)
Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: Ming Yue <mingyue86010@gmail.com>
2021-09-07 12:03:12 -07:00
Zim Kalinowski
bb02cf647d
minor fix in stream buffer doc (#387)
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2021-08-31 11:24:56 -07:00
Zim Kalinowski
ae73f0de41
Replace <pre> with @code{c} (#386)
* replace <pre> with @code{c}

* endcode must pass spellcheck
2021-08-31 09:04:36 -07:00
Zim Kalinowski
0b1e9d79c8
fixes in queue documentation (#382)
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2021-08-12 18:15:57 -07:00
Paul Adelsbach
d858d1ff36
fix example usage of xMessageBufferCreateStatic and xStreamBufferCrea… (#380)
Example usage is actually correct, so remove the -1. but update
the incorrect parameter description for pucStreamBufferStorageArea
and pucMessageBufferStorageArea.
2021-08-12 17:06:41 -07:00
Zim Kalinowski
1b38078939
fixed parameter names documentation (#378) 2021-08-12 11:18:53 -07:00
alfred gedeon
ce81bcb33f
Run uncrustify with github workflows (#369)
* uncrustify with github workflows

* Fix find expression

* Add uncrustify configuration file

* Uncrustify some files

* uncrustify some more files

* uncrustify more files

* Fix whitespace at end of lines

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
2021-07-28 17:53:10 -07:00
Craig Kewley
d9d5d53a75
doc: fix function name typo (#368) 2021-07-20 17:21:18 -07:00
Tobias Nießen
1d86b973aa
Fix description of vTaskDelay (#363) 2021-07-06 14:10:53 -07:00
swaldhoer
46338705bd
Replace two dashes and one whitespace with their corresponding ASCII characters. (#362) 2021-06-30 15:07:55 -07:00
Graham Sanderson
9af72db3ec
Add RP2040 support (#341)
* Add RP2040 support

* remove spurious tab/spaces comments

* add .cmake to ignored kernel checks

* Apply suggestions from code review

Co-authored-by: Paul Bartell <paul.bartell@gmail.com>

* license and end of file newline fixes

* Rename LICENSE.TXT to LICENSE.md

Co-authored-by: Paul Bartell <paul.bartell@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2021-06-30 13:20:54 -07:00