Commit graph

199 commits

Author SHA1 Message Date
chinglee-iot
ebd8e35445
Merge ab84561366 into d0d55f3031 2024-11-05 14:56:54 +05:30
ActoryOu
445336aad9
Follow GitHub recommendation to update release.yml (#1178)
GitHub recommends to store user inputs in environments variables
and then use them in scripts. This PR updates the code as per the
GitHub recommendation.

Details here - https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections.
2024-11-04 14:53:28 +05:30
Rahul Kar
7d76dceaad
Add assert check for NULL TCB handle (#1177)
Co-authored-by: ActoryOu <jay2002824@gmail.com>
2024-11-02 10:43:53 +08:00
kakkoko
a49c35b5dc
Fix incorrect error checking of prvCreateIdleTasks (#1158)
In environments that do not support static allocation
(configSUPPORT_STATIC_ALLOCATION == 0), at prvCreateIdleTasks(), call
xCreateTask() and compare its return value to pdFAIL to check whether
xCreateTask() failed. However, xCreateTask() returns
errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY as the error value, so the
result of this comparison is always false.

This commit fixes this problem by changing the return value comparison
to pdPASS instead of pdFAIL.
2024-10-16 15:06:20 +05:30
Guilherme Giácomo Simões
e81ad46b0e
refactor: change methods ENTER|EXIT critical (#1140)
refactor: change methods ENTER|EXIT critical

The read and write of BaseType_t are atomic for a number of ports
and therefore, do not require taskENTER_CRITICAL/taskEXIT_CRITICAL.
This PR introduces portBASE_TYPE_ENTER_CRITICAL and
portBASE_TYPE_EXIT_CRITICAL which default to  taskENTER_CRITICAL
and taskEXIT_CRITICAL. The APIs that read/write BaseType_t are updated
to use these new macros. 

The next change would to be to define portBASE_TYPE_ENTER_CRITICAL and
portBASE_TYPE_EXIT_CRITICAL to nothing for ports where BaseType_t 
read and write are atomic.

Signed-off-by: guilherme giacomo simoes <trintaeoitogc@gmail.com>
2024-10-07 10:37:50 +05:30
Rahul Kar
a045081f73
Update config macro for xTaskGetCurrentTaskHandle (#1136) 2024-09-04 15:01:42 +05:30
chinglee-iot
cd0d09cc96
Merge branch 'main' into update-pxcurrentTCB 2024-08-26 13:49:41 +08:00
chinglee-iot
e43553af1e
Yield for task when core affinity of a ready task is changed (#1123)
* The SMP scheduler should re-select a core to yield when the core
  affinity of a ready task is changed.
2024-08-20 12:34:01 +08:00
chinglee-iot
ba2306d098
Merge branch 'main' into update-pxcurrentTCB 2024-08-20 10:56:51 +08:00
Chen YM
294569e495
Optimize xTaskIncrementTick for configNUMBER_OF_CORES > 1 (#1118)
The original implementation only initializes the first
variable. After executing xTaskIncrementTick, the schedule
might not behave as expected.

When configUSE_PREEMPTION == 1 & configUSE_TIME_SLICING == 1,
replace setting xYieldRequiredForCore[ xCoreID ] with setting
xYieldPendings[ xCoreID ].

And when configUSE_PREEMPTION == 1, simplify the check
condition to only check xYieldPendings[ xCoreID ].

Signed-off-by: cymzier <cymb103u@cs.ccu.edu.tw>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2024-08-19 10:34:33 +05:30
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