Commit Graph

90 Commits

Author SHA1 Message Date
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
RichardBarry
ddc840fd28
Make the type used to hold run-time counter values configurable (#350)
* Introduce configRUN_TIME_COUNTER_TYPE which enables developers to define the type used to hold run time statistic counters.  Defaults to uint32_t for backward compatibility.  #define configRUN_TIME_COUNTER_TYPE to a type (for example, uint64_t) in FreeRTOSConfig.h to override the default.

Introduce ulTaskGetIdleRunTimePercent() to complement the pre-existing ulTaskGetIdleRunTimeCounter().  Whereas the pre-existing function returns the raw run time counter value, the new function returns the percentage of the entire run time consumed by the idle task.  Note the amount of idle time is only a good measure of the slack time in a system if there are no other tasks executing at the idle priority, tickless
idle is not used, and configIDLE_SHOULD_YIELD is set to 0.

* Add ultaskgetidleruntimepercent to lexicon.txt.

* Update History file.
Add the MPU version of ulTaskGetIdleRunTimePercent().

* Update include/FreeRTOS.h to correct comment as per aggarg@ suggestion.
* Fix alignment in mpu_wrappers.h.
Commit changes to mpu_prototypes.h which were missed from the original commit.
2021-06-14 12:17:41 -07:00
Raul Rojas
bad8f01afd
Adds SemphrGetCountFromISR with QMsgWaitingFromISR (#345)
* Adds SemphrGetCountFromISR with QMsgWaitingFromISR
2021-06-08 17:48:52 -07:00
Paul Bartell
eec42331b4 Normalize files with mixed line endings (introduced in commit 3a413d1) 2021-06-01 17:55:18 -07:00
paulbartell
2f6c91be62 [AUTO][RELEASE]: Bump task.h version macros to "10.4.4+" 2021-05-28 23:03:08 +00:00
Joseph Julicher
b4a7a04657
Add history.txt for the 10.4.4 release (#336)
* updated history.txt for 10.4.4

* Update the release date in History.txt

* added link to SMP branch to History.txt

* Added comment explaining the + in the version string

* corrected typos in the + comment

Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
2021-05-28 15:48:53 -07:00
Paul Bartell
3a413d1022 Add SPDX-License-Identifier: MIT to MIT licensed files. 2021-05-27 19:57:55 -07:00
Paul Bartell
a1b9132a6d Update tskKERNEL_VERSION_NUMBER and tskKERNEL_VERSION_BUILD to V10.4.999 to denote the development branch 2021-05-27 19:57:55 -07:00
Paul Bartell
adfc53368f Update copyright year from 2020 to 2021 2021-05-27 19:57:55 -07:00
Paul Bartell
08dc6f64ee Change kernel revision in each file header from V10.4.3 to <DEVELOPMENT BRANCH> 2021-05-27 19:57:55 -07:00
Dan Good
8e2f723996
queue.c: Change some asserts into conditionals and improve overflow checks (#328) 2021-05-27 19:17:59 -04:00
RichardBarry
6bf3a75c6a
Create macro versions of uxListRemove() and vListInsertEnd() for use in xTaskIncrementTick(). This provides a minor optimisation to remove the need for a few function calls. (#241)
Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2021-04-19 14:16:10 -07:00
Meco Jianting Man
d8770748ff
[kernel & MemMang] use space to replace tab and remove meaningless space in the end of each line (#314)
Signed-off-by: Meco Man <920369182@qq.com>

Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
2021-04-19 09:58:55 -07:00
Meco Jianting Man
99295c9ae8
simplify and beautify portBYTE_ALIGNMENT (#309) 2021-04-14 07:46:46 -07:00
Paul Bartell
a22b438e60
Overwrite existing QueueRegistry entries when a handle is added multiple times. (#306)
Overwrite an existing entry for a given xQueue handle when vQueueAddToRegistry is called with an xQueue handle of a queue that is already in the QueueRegistry.
2021-04-09 17:06:58 -07:00
Gaurav-Aggarwal-AWS
b08c19f745
Define default values of macros before first use (#298)
configSTACK_ALLOCATION_FROM_SEPARATE_HEAP was added recently in
https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/267. This macro was
used in portable.h before its default value was defined, resulting in a
warning when built with -Wundef. This changes moves the default value
definition for configSTACK_ALLOCATION_FROM_SEPARATE_HEAP to portable.h
to ensure that it is defined before first use.

portUSING_MPU_WRAPPERS check in mpu_wrappers.h was updated in
https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/285. The new check
results in a warning when built with -Wundef because
portUSING_MPU_WRAPPERS is not defined yet. This changes adds the default
value definition for portUSING_MPU_WRAPPERS to portable.h to ensure that
it is defined before first use.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2021-04-02 07:35:52 -07:00
Paul Bartell
9b679c347c
Fix comments in list.h and clarify list usage in xTaskRemoveFromEventList (#289)
* Change instances of "descending" to "ascending" to match implementation.

* Uncrustify

* Clarify list usage in xTaskRemoveFromEventList
2021-03-25 12:39:08 -07:00
RichardBarry
086d52f9d3
A recent change in the FreeRTOS/FreeRTOS hub repo (which submodules this repo) introduced use of a new compile time constant configRUN_ADDITIONAL_TESTS. This check in adds a default for the constant that will be used in builds to which it does not apply. (#266) 2021-03-20 11:58:07 -07:00
alfred gedeon
9706a69850
Fix: testing for mpu wrapers to be equal to 1 (#285) 2021-03-19 17:44:12 -07:00
Joseph Julicher
5e45472d6e
fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (#269) 2021-03-03 09:38:12 -08:00
gomonovych
4fde4a8d0a
Add description for vTaskList (#206)
Describe each column which vTaskList print:
task name, task status, task priority, task stack unused watermark lewel, task number

Co-authored-by: David Chalco <59750547+dachalco@users.noreply.github.com>
2021-03-01 18:10:00 -07:00