Commit Graph

161 Commits (3d935e86d9d67af25a0abbb7b83435e73d0b9797)

Author SHA1 Message Date
Rahul Kar 3d935e86d9
Update broken links in readme and comments (#1110)
Update broken links in readme and comments
6 months ago
Björn Schäpers fffed5e809
Define vApplicationGetTimerTaskMemory only when configUSE_TIMERS is set (#1104)
Otherwise it is very reasonable that config_TIMER_TASK_STACK_DEPTH is
undefined.
6 months ago
chinglee-iot 0c79e74eaa
Remove run state assertion in prvCheckForRunStateChange (#1093)
In `prvCheckForRunStateChange()`, enabling interrupts should cause this core to immediately service the pending interrupt and yield. Upon the next scheduling of the task, the assertion `configASSERT(pxThisTCB->xTaskRunState != taskTASK_SCHEDULED_TO_YIELD);` may not be true, as other cores could have requested a yield for this task before it evaluates its run state within the assertion. To address this, the task re-evaluates its run state in critical section within a loop until it is eligible for execution, which is the current implementation. Consequently, this assertion should be removed to ensure correct behavior.
8 months ago
Philipp Schilk e64d1e06b3
Add traceSTARTING_SCHEDULER tracing hook. (#1082)
* Add traceSTARTING_SCHEDULER tracing hook.

Discussed here: https://forums.freertos.org/t/tracing-improvements/20097

This hook enables tracers to run code on startup after all RTOS
resources are created and to detect that the scheduler is starting without
relying on traceENTER/traceEXIT macros.

It also provides tracers access to the task handle of all IDLE tasks,
allowing them to be identified unambiguously and without relying on
INCLUDE_xTaskGetIdleTaskHandle.
8 months ago
Rahul Kar ef22228bda
Change UBaseType_t to BaseType_t for a boolean variable (#1072) 8 months ago
Gaurav-Aggarwal-AWS 9697f8c9b0
Update documentation of prvGetExpectedIdleTime (#1061)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
9 months ago
chinglee-iot c02a347880
Use suffix "U" for unsigned constant (#1041)
* Fix the constant suffix to U

* Fix more unsigned contant suffix

---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
10 months ago
chinglee-iot fdf4695c1e
Adding SMP coverity example (#1039)
* Adding SMP coverity example

* Add coverity scan flow

* Fix format

* Update README.md

* Code review suggestions

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

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
10 months ago
Rahul Kar bbc058967b
Fix cmake example errors (#1037)
Add typecasts to prevent compiler warnings. Remove ULL suffix to adhere
to C90.
10 months ago
chinglee-iot 4d4f8d0d50
Fix vTaskSuspendAll assert for critical nesting count (#1029)
* Accessing the critical nesting count in current task's TCB is performed with interrupt disabled to ensure atomicity.
10 months ago
Rahul Kar 73851fb6da
Remove unwanted volatile keyword (#1028)
* Remove unwanted volatile keyword

* Declare variable initially
10 months ago
chinglee-iot 30f6061f48
Not using pxIndex to iterate ready list in trace utility (#1000)
* pxIndex should only be used when selecting next task. Altering pxIndex
  of a ready list will cause the scheduler to be unable to select the
  right task to run. Using a for loop if traversing the list for trace
  utility is required.
* Not defining listGET_OWNER_OF_NEXT_ENTRY when using SMP scheduler

---------

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
11 months ago
Soren Ptak 839ccb719b
Use Regex for Copyright Year in Header Check (#1002) 11 months ago
chinglee-iot 1a500f1a74
Support reset kernel state for restarting scheduler (#944)
* Adding the following functions to reset kernel state. These functions are only required for application which 
needs to restart the scheduler.
 - void vTaskResetState( void )
 - void vTimerResetState( void )
 - void vPortHeapResetState( void )
 - void vCoRoutineResetState( void )

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Chris Morgan <cmorgan@boston-engineering.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
12 months ago
Christoph Seitz e68975fcf7
Add default core affinity config value. (#996)
* Add default core affinity config value.

---------

Co-authored-by: Anubhav Rawal <rawalexe@amazon.com>
12 months ago
bradleysmith23 4d34700bcc
Fix MISRA C 2012 Rule 13.3 Violations (#988)
* MISRA Rule 13.3 Fixes

* Add semiicolons that were accidentally removed

* Add parentheses back around pxList->uxNumberOfItems where removed.

* Formatting fix

* Add Casts to UBaseType_t

---------

Co-authored-by: bjbsmith <bjbsmith@uafeb6a6bcdce55.ant.amazon.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
12 months ago
bradleysmith23 8cfa7152f7
Fix MISRA C 2012 Rule 13.2 Violations (#979)
* Fix violations of MISRA rule 13.2

* Fix typo in UBaseType_t

* Uncrustify: triggered by comment.

* Run Github Actions.

* Remove temp variable for uxCurrentNumberOfTasks

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>

* Declare uxCurrentListLength at top of function, update comment.

* Update location of uxCurrentListLength Declaration

* Uncrustify: triggered by comment.

* Run Github Actions

* Uncrustify: triggered by comment.

* Run Github Actions.

* Update comment explaining use of temp variable

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
12 months ago
Darian 7284d84dc8
Update task notification scheduler suspension usage (#982)
* Update task notification scheduler suspension

Previously ulTaskGenericNotifyTake() and xTaskGenericNotifyWait() would suspend
the scheduler while inside a critical section.

This commit changes the order by wrapping the critical sections in a scheduler
suspension block. This logic is more inuitive and allows the SMP scheduler
suspension logic to be simplified.

* tasks.c: Fix typo

* Use a complete sentence in comment

* Check portGET_CRITICAL_NESTING_COUNT when scheduler is running

* Prevent potential NULL pointer access when scheduler is not running

---------

Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
12 months ago
chinglee-iot 57a5ed7f67
Fix SMP task self void run state change (#984)
* Request a task to yield after been suspended or deleted to prevent this task puts itself back to another list
* Fix volatile variable access order to ensure ensure compliance with MISRA C 2012 Rule 13.5

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
bradleysmith23 c19b13cdfc
Fix MISRA C 2012 Rule 14.4 Violations. (#975)
* Fix MISRA rule 14.4 violations.

* Use pdFALSE instead of 0 in comparison

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>

* Uncrustify: triggered by comment.

* Run Github Actions.

---------

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
1 year ago
Darian 1c35cb3bc9
Enable xTaskGetCurrentTaskHandleForCore() for single core builds (#978)
Enable xTaskGetCurrentTaskHandleForCore() for single core builds

---------
Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
1 year ago
bradleysmith23 d94db2d11d
Fix MISRA C 2012 Rule 10.3 Violations (#974)
* Resolve violations for MISRA Rule 10.3-b2

* Formatting fix

---------

Co-authored-by: bjbsmith <bjbsmith@uafeb6a6bcdce55.ant.amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
1 year ago
chinglee-iot 1de764ba87
Delete kernel created task in vTaskEndScheduler (#962)
* Update vTaskDelete() to delete a task directly when scheduler is stopped instead of putting it on the xTasksWaitingTermination list.
* Delete the idle tasks and timer task in vTaskEndScheduler().
* Reclaim resources for all the tasks on the xTasksWaitingTermination list in vTaskEndScheduler().
* Update POSIX to no longer delete FreeRTOS tasks in the port.

---------

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>
1 year ago
Soren Ptak d63434493a
Add missing Task Notification IFDEF (#967)
Wrap the task notification check in vTaskGetInfo() in in a  #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1 year ago
Phillip Stevens 14dd5b503a
use configSTACK_DEPTH_TYPE consequently (updated for 11.0.x) (#942)
* use configSTACK_DEPTH_TYPE consequently

* update default to uint32_t

* Update FreeRTOS.h

Revert for backwards compatibility

* Update portable.h

* configSTACK_DEPTH_TYPE - unify stack variable naming

* update lexicon.txt

* update typo lexicon.txt

* Update task.h

* Update timers.h

* fix merge typo

* fix stack type

* fix timer stack type

* fix timer stack more

* fix affinity set stack

* adjust ports to use configSTACK_DEPTH_TYPE

* fix vTaskListTasks

* set default stack depth type in portable.h

* fix History.txt

* update affinityset

* resolve reviewer comments

* fix prvTaskCheckFreeStackSpace for variable stack size type

* restore CoRoutine defines

* remove obsolete stack ttype casts

* fix (attempt) for format portable.h

* Formatting fixes

* prvTaskCheckFreeStackSpace make variable naming compliant

* Update portable/GCC/ARM_CM33/non_secure/port.c

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>

* Update portable/GCC/ARM_CM23/non_secure/port.c

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>

* Apply suggestions from code review

Update ulStackDepth to uxStackDepth

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>

* Correct uxStackDepth in port.c

Also add uint32_t cast prvGetMPURegionSizeSetting.

* Update ARM CM3 MPU port.c

Revert casting of ( uint32_t ) pxBottomOfStack

* Code review suggestions

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

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
chinglee-iot 72c7d86276
Update for unpaired critical section in vTaskSuspend (#959)
* Move the taskEXIT_CRITICAL out of the configNUMBER_OF_CORES macro block to improve readability.
1 year ago
chinglee-iot cf2366c949
Update unpaired critical section in vTaskDelete for readability (#958)
* Modify unpaired critical section for readability
* Move prvDeleteTCB out of critical section for SMP

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
IsaacDynamo aa07289c24
Make configSUPPORT_STATIC_ALLOCATION==1 an error for MPU ports (#953)
* Error when configSUPPORT_STATIC_ALLOCATION is set for MPU ports

* Uncrustify: triggered by comment.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
1 year ago
chinglee-iot 94cb87ad30
Assign idle task to each core before SMP scheduler start (#945)
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
1 year ago
Soren Ptak 553b0ad5d3
Update comments related to portYIELD_FROM_ISR() in queue.h #925 1 year ago
Darian bd0f87c18b
Add portTASK_SWITCH_HOOK (#867)
This commit adds a portTASK_SWITCH_HOOK() macro which allows ports to inject
behavior immediately after a context switch. For example, this macro could be
used by ports that need to set an end of stack watchpoint after a context
swtich.

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
chinglee-iot a79752a04a
Remove lint suppression comment (#920)
Remove lint suppression comment
1 year ago
chinglee-iot d95b05ea5f
Suppress MISRA C:2012 rule 21.6 for snprintf (#877)
Suppress MISRA C:2012 rule 21.6 for snprintf
1 year ago
Rahul Kar 93ef558fa8
Declare variable without initializer (#841)
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Rahul Kar 55094e2ddf
Fix MISRA_C_2012 rule 13.2 violation (#855)
* Assign volatile variables to local non-volatile variables before read

* Fix stack macro overflow check volatile access

* Explicit the read order of volatile variable

* Fix issue : ISO C90 forbids mixed declarations and code



---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Monika Singh <moninom@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Rahul Kar d1a0202125
Fix MISRA_C_2012 rule 8.4 violation (#844)
Fix MISRA_C_2012 rule 8.4 violation
1 year ago
Rahul Kar 71d86f9a6e
Fix MISRA_C_2012 rule 17.7 violation (#848)
* Assign return value of xPortStartScheduler API to a variable

* Add void datatype

---------

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Rahul Kar edce1e94b3
Fix MISRA_C_2012 rule 20.7 violation (#843)
* Wrap macro parameter expansion by parentheses
* Update parentheses in SMP macro definition

---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Monika Singh <moninom@amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
1 year ago
chinglee-iot 84c0047ccd
Suppress MISRA C:2012 rule 11.5 deviations (#878)
* Suppress MISRA C:2012 rule 11.5 deviations by comment also remove this rule in global config

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: Rahul Kar <karahulx@amazon.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
Darian cd5c774b2b
Update xTaskGetIdleTaskHandle() For SMP (#868)
* Update xTaskGetIdleTaskHandle() in SMP

This commit updates xTaskGetIdleTaskHandle() for SMP in the following ways:

- xTaskGetIdleTaskHandle() no longer accepts xCoreID argument in SMP so that
there is not change in API between single-core and SMP
- xTaskGetIdleTaskHandle() now returns the Active idle task handle in SMP,
which matches the behavior in single-core.
- Added xTaskGetIdleTaskHandleForCore() in SMP which accepts an xCoreID
argument. This function can be used to obtain the Passive idle task handles.

* Update xTaskGetIdleTaskHandle

---------

Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
chinglee-iot dabbc05a39
Suppress MISRA C rule 11.3 in MISRA.md (#857)
Suppress MISRA C rule 11.3 in MISRA.md
1 year ago
chinglee-iot 1813a4551e
Fix MISRA 2012 rule 10.4 violations (#852)
Fix MISRA 2012 rule 10.4 violations
1 year ago
chinglee-iot ce88adea2a
Fix MISRA C 2012 Rule 10.3 errors (#860)
* The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category.
---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
chinglee-iot ac4313560f
Not to use object modified in the loop body (#861)
Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Moral-Hao 5f2bb1b48b
In smp, every core has a idle task. (#893)
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
1 year ago
chinglee-iot dc09a3dd51
Add vApplicationGetPassiveIdleTaskMemory for SMP (#890)
* Update vApplicationGetIdleTaskMemory prototype for SMP. Now SMP and
  single core use the same prototype for compatibility.
* Add vApplicationGetPassiveIdleTaskMemory for SMP to get passive idle
  task memory.
1 year ago
Moral-Hao 0640b2e486
Distinguish waiting for notify status from suspend status (#865)
* Fix prvTaskIsTaskSuspended.

Just like eTaskGetState, distinguish waiting for notify from suspend.

* Fix vTaskGetInfo.

Just like eTaskGetState, distinguish block state (waiting on notification)
from suspend state.

* Add missing definition of variable x.

* Fix formatting syntax.

---------

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Tony Josi <tonyjosi@amazon.com>
1 year ago
Moral-Hao 8ede50cafd
Fix vTaskSwitchContext for smp. (#879)
The function vTaskSwitchContext in smp has an parameter of core id,
which means this function is not only used for the core who call it.
Thus we should use the task running on the specific core id,
instead of use the task running on the core who call this function.

Co-authored-by: moral-hao <405197809@qq.com>
1 year ago
Darian 4ef0bb676c
vTaskListTasks prints core affinity mask (#850)
This commit updates vTaskListTasks so that it prints uxCoreAffinityMask if
core affinity is enabled in configuration.
1 year ago
Darian fc7aca7ff2
Rename CPU to Core (#849)
This commit renames "CPU" to "Core" for any public facing API for consistency
with other SMP related APIs (e.g., "configNUMBER_OF_CORES").

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