Commit graph

189 commits

Author SHA1 Message Date
chinglee-iot 893fcc8ea0
Merge branch 'main' into update-pxcurrentTCB 2024-08-06 14:24:30 +08:00
Gaurav-Aggarwal-AWS 53c7e7c46f
Reset xNextTaskUnblockTime in task notify FromISR APIs (#1111)
* Reset xNextTaskUnblockTime in task notify FromISR APIs

If a task is blocked waiting for a notification then
xNextTaskUnblockTime might be set to the blocked task's timeout 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 idle is used it is important
to enter sleep mode at the earliest possible time - so reset
xNextTaskUnblockTime here to ensure it is updated at the earliest
possible time.

This was reported here -
https://forums.freertos.org/t/the-vtaskgenericnotifygivefromisr-function-need-call-prvresetnexttaskunblocktime/21090

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2024-08-06 10:49:48 +05:30
Rahul Kar 3d935e86d9
Update broken links in readme and comments (#1110)
Update broken links in readme and comments
2024-08-05 16:00:47 +05:30
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.
2024-07-26 12:18:35 +05:30
Ching-Hsin,Lee 937dcf11fe Update format 2024-07-08 17:26:41 +08:00
Ching-Hsin,Lee 926224e7fd Rename prvGetCurrentTaskTCB to prvGetCurrentTCB 2024-07-08 17:25:04 +08:00
Ching-Hsin,Lee e43f7d808b Update variable name 2024-07-08 16:12:26 +08:00
Ching-Hsin,Lee dded3f483e Update typo 2024-07-08 14:52:27 +08:00
Ching-Hsin,Lee f41b6a626b Fix typo in xHigherPriorityReadyTasks 2024-07-08 14:37:13 +08:00
Ching-Hsin,Lee 7a418ceffe Fix format and spelling 2024-07-08 14:36:19 +08:00
Ching-Hsin,Lee 9a097c51dd Fix typo 2024-07-08 12:52:16 +08:00
Ching-Hsin,Lee 98faa785cb Fix typo 2024-07-08 12:34:48 +08:00
Ching-Hsin,Lee 0fcb04a41d Refine usage 2024-07-08 12:26:26 +08:00
Ching-Hsin,Lee 9362ac47c1 Remove set current TCB 2024-07-08 11:16:26 +08:00
Ching-Hsin,Lee cb0b1ed882 code refine 2024-07-08 10:50:07 +08:00
Ching-Hsin,Lee 4ec5b9d94d Update set current TCB 2024-07-08 10:46:26 +08:00
Ching-Hsin,Lee 67b6574633 Update pxCurrentTCBs[ portGET_CORE_ID() ] optimization 2024-07-08 10:14:45 +08:00
Ching-Hsin,Lee f4dad5e7c1 Merge remote-tracking branch 'freertos/main' into update-pxcurrentTCB 2024-07-08 09:52:18 +08:00
Ching-Hsin,Lee f08c3c5e8c Use unsafe get in critical section directory 2024-07-08 09:48:09 +08:00
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.
2024-06-19 18:29:04 +08:00
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.
2024-06-10 23:14:10 +05:30
Rahul Kar ef22228bda
Change UBaseType_t to BaseType_t for a boolean variable (#1072) 2024-05-24 12:53:54 +05:30
Ching-Hsin,Lee 2883653d9a Update for performance 2024-05-21 23:50:33 +08:00
Ching-Hsin,Lee 8200e590f1 Remove pxCurrentTCB define in SMP 2024-05-20 18:13:17 +08:00
Ching-Hsin,Lee 1c9130fbfa Update usage again 2024-05-20 17:59:07 +08:00
Ching-Hsin,Lee 080b840a01 Update pxCurrentTCB 2024-05-20 17:56:19 +08:00
Ching-Hsin,Lee 69581faaa0 Fix compiler error 2024-05-20 17:52:50 +08:00
Ching-Hsin,Lee c774dfda63 Revert select highest priority task 2024-05-20 17:33:56 +08:00
Ching-Hsin,Lee bade1a671a Fix typo 2024-05-20 17:16:20 +08:00
chinglee-iot 028ccda316
Merge branch 'main' into update-pxcurrentTCB 2024-05-20 17:07:25 +08:00
Ching-Hsin,Lee b2f9dadcc4 Refine the implementation 2024-05-20 17:01:23 +08:00
Gaurav-Aggarwal-AWS 9697f8c9b0
Update documentation of prvGetExpectedIdleTime (#1061)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2024-05-20 14:24:54 +05:30
Ching-Hsin,Lee edfa323bf3 Update the usage of pxCurrentTCB
* Update the usage of pxCurrentTCB to improve multiple accessing
  volatile variable in a function
2024-05-20 16:41:02 +08:00
Ching-Hsin,Lee d4b8bfdb36 First version of pxCurrentTCB 2024-05-20 14:05:52 +08:00
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>
2024-04-19 14:41:16 +05:30
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>
2024-04-19 10:18:00 +05:30
Rahul Kar bbc058967b
Fix cmake example errors (#1037)
Add typecasts to prevent compiler warnings. Remove ULL suffix to adhere
to C90.
2024-04-18 19:08:51 +05:30
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.
2024-04-11 15:12:03 +08:00
Rahul Kar 73851fb6da
Remove unwanted volatile keyword (#1028)
* Remove unwanted volatile keyword

* Declare variable initially
2024-04-11 11:30:29 +05:30
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>
2024-03-06 15:34:21 +08:00
Soren Ptak 839ccb719b
Use Regex for Copyright Year in Header Check (#1002) 2024-02-26 09:26:42 -08:00
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>
2024-02-19 14:39:31 +08:00
Christoph Seitz e68975fcf7
Add default core affinity config value. (#996)
* Add default core affinity config value.

---------

Co-authored-by: Anubhav Rawal <rawalexe@amazon.com>
2024-02-16 11:12:18 +05:30
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>
2024-02-14 11:48:35 +05:30
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>
2024-02-13 10:41:30 +05:30
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>
2024-02-07 13:14:04 +08:00
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>
2024-02-06 20:41:34 +08:00
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>
2024-02-02 14:28:43 -08:00
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>
2024-02-02 11:46:20 -08:00
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>
2024-02-01 14:58:24 +05:30