]> begriffs open source - freertos/log
freertos
23 months agoPOSIX port - Switch from allowing the user to specify the stack memory itself, to...
Chris Morgan [Wed, 29 Nov 2023 13:15:50 +0000 (08:15 -0500)]
POSIX port - Switch from allowing the user to specify the stack memory itself, to allowing them to specify the stack size

Change from pthread_attr_setstack() to pthread_attr_setstacksize(), and automatically adjust the stack size
to be at least PTHREAD_STACK_MIN if it wasn't already, removing the size warning.

This permits the user to increase the pthread stack size beyond the PTHREAD_STACK_MIN default of 16384 if
desired, without producing a warning in the typical case where stacks are minimized for RAM limited targets.

Continue to store thread paramters on the provided stack, for consistency with the MCU targets.

Previously pthread_attr_setstack() was used to enable user defined stacks.

Note that:

1. The stack size can still be specified by the user.

2. pxPortInitialiseStack(), and pthread_addr_setstack() was failing on stacks of typical size, as
   these are smaller than PTHREAD_STACK_MIN (16384) bytes, and printing out a series of warnings.
   Improve usability by having the posix port automatically increase the stack size to be
   at least PTHREAD_STACK_MIN as posix platforms have enough memory for this not to be a concern.

3. Reuse of stack memory will also result in valgrind 'invalid write' errors to what is demonstrably
   valid memory. Root cause is that Valgrind is tracking a stack pointer as the stack is used.
   Reuse of a stack buffer results in the stack being used at its start, in an area that Valgrind thinks
   is far away from the start of the stack. There are ways to notify Valgrind of these changes
   however this would require linking against and calling Valgrind functions from the FreeRTOS application using
   the posix port, https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq.

   Also, apparently it isn't permitted by posix to reuse stack memory once its been used in a pthread via pthread_attr_setstack(),
   see https://stackoverflow.com/a/5422134

23 months agoRevert pthread_attr_setstacksize
Ching-Hsin Lee [Wed, 10 Jan 2024 12:30:46 +0000 (20:30 +0800)]
Revert pthread_attr_setstacksize

23 months agoRevert timer tick function
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:48:35 +0000 (05:48 +0000)]
Revert timer tick function

23 months agoAdd back event signal
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:45:02 +0000 (05:45 +0000)]
Add back event signal

23 months agoRemove redundent cancellation point
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:39:27 +0000 (05:39 +0000)]
Remove redundent cancellation point

23 months agoformat and header file
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:38:18 +0000 (05:38 +0000)]
format and header file

23 months agoAdd back heap setup code
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:32:14 +0000 (05:32 +0000)]
Add back heap setup code

23 months agoUPdate format
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:20:51 +0000 (05:20 +0000)]
UPdate format

23 months agoAdd back the pthread stack fit
Ching-Hsin Lee [Wed, 10 Jan 2024 05:18:55 +0000 (13:18 +0800)]
Add back the pthread stack fit

23 months agoFix potential race condition
Ching-Hsin,Lee [Wed, 10 Jan 2024 05:08:03 +0000 (05:08 +0000)]
Fix potential race condition

23 months agoPOSIX port - Cancel and join all FreeRTOS managed pthreads upon shutdown
Chris Morgan [Tue, 28 Nov 2023 13:57:37 +0000 (08:57 -0500)]
POSIX port - Cancel and join all FreeRTOS managed pthreads upon shutdown

For a clean shutdown where memory is freed, it is necessary for all pthreads to be joined
at shutdown.

Previously there was explicit cancellation of the idle task and timer daemon task, however
there may be a number of other tasks in the system, both system created and user created,
and those tasks/threads were being left at shutdown.

This change calls pthread_cancel()/pthread_join() on all FreeRTOS managed pthreads upon
shutdown.

23 months agoPOSIX - Switch from posix timers to a timer thread to fix signal handling with non...
Chris Morgan [Tue, 28 Nov 2023 12:40:11 +0000 (07:40 -0500)]
POSIX - Switch from posix timers to a timer thread to fix signal handling with non-FreeRTOS pthreads

Improve upon the elegant approach of using signals to cause task/pthreads
suspension and scheduler execution by using directed signals.

This fixes:
- Deadlocks in non-FreeRTOS pthreads
- Multiple FreeRTOS tasks(pthreads) incorrectly running at the same time

By directing the signals using pthread_kill() the signal handler in the presently running
FreeRTOS task/pthread will be called, ensuring that the scheduler runs both in the context
of a FreeRTOS task/pthread and from the presently executing FreeRTOS task/pthread.

Details
==============

The POSIX port uses signals to preempt FreeRTOS tasks (implemented as pthreads), a very neat and elegant
approach to forcing tasks/pthreads to suspend and run the scheduler.

Signal handlers are process global.

Posix timers generate signals when the timer expires, and the signal is sent to the currently
running pthread.

In systems where there are pthreads that are NOT a result of creating FreeRTOS tasks, such as the
entry point thread that calls main(), or user created pthreads, this poses a serious issue.

While the POSIX port only allows a single FreeRTOS pthread to run at once, by causing all suspended
threads to not be scheduled due to their waiting on a pthread condition variable,
this isn't the case with non-FreeRTOS pthreads.

Thus it is possible that a non-FreeRTOS pthread is running when the timer expires and the signal
is generated. This results in the signal handler running in the non-FreeRTOS thread.

The sequence of events results in these events from signal handler context:
- vPortSystemTickHandler() being called
- The scheduler running
- Selecting another FreeRTOS task to run and switching the active task
- The newly selected task released from suspension by pthread_cond_signal()
- The presently active thread calling event_wait()
- The pthread calling pthread_cond_wait(), suspending the thread and allowing the host OS scheduler
  to schedule another thread to run.

If this occurs from a non-FreeRTOS thread this results in:
- The active FreeRTOS pthread (Task A/Thread A) continuing to run (as the signal handler that calls
  event_wait() ran instead in a non-FreeRTOS pthread.
- The pthread where the signal handler did run (Thread B) will call event_wait() and pthread_cond_wait(),
  but on the condition variable of the previously active FreeRTOS task, oops. This causes the
  non-FreeRTOS pthread to block unexpectedly relative to what the developer might have expected.
- The newly selected FreeRTOS Task (Task C/Thread C) will resume and start running.

At this point Task A/Thread A is running concurrently with Task C/Thread C. While this may not
necessarily be an issue, it does not replicate the expected behavior of a single Task running at
once.

Note that Thread B will resume if/when Task A/ThreadA is switched to. However, this could be delayed
by an arbitrary amount of time, or could never occur.

Also note that if there are multiple non-FreeRTOS pthreads that Thread D, E, F...etc could suffer the
same fate as Thread B, if the scheduler were to suspend Task C/Thread C and resume Task E/Thread E.

Implementation
==============

Timer details
-------------
A standalone pthread for the signal generation thread was chosen, rather than using
a posix timer_settime() handler function because the latter creates a temporary
pthread for each handler callback. This makes debugging much more difficult due to
gdb detecting the creation and destruction of these temporary threads.

Signal delivery
--------------
While signal handlers are per-thread, it is possible for pthreads to selectively block
signals, rather than using thread directed signals. However, the approach of blocking
signals in non-FreeRTOS pthreads adds complexity to each of these non-FreeRTOS pthreads
including ensuring that these signals are blocked at thread creation, prior to the thread
starting up. Directed signals removes the requirement for non-FreeRTOS pthreads to be aware
of and take action to protect against these signals, reducing complexity.

23 months agoRevert #768 on the XCC/Xtensa portable files (#948)
Soren Ptak [Wed, 10 Jan 2024 14:58:45 +0000 (09:58 -0500)]
Revert #768 on the XCC/Xtensa portable files (#948)

23 months agoAssign idle task to each core before SMP scheduler start (#945)
chinglee-iot [Tue, 9 Jan 2024 06:03:47 +0000 (14:03 +0800)]
Assign idle task to each core before SMP scheduler start (#945)

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
23 months agoAdd new common words to the cSpellWordList.txt (#946)
Soren Ptak [Mon, 8 Jan 2024 06:28:18 +0000 (01:28 -0500)]
Add new common words to the cSpellWordList.txt (#946)

23 months agoAdded ability to change task notification index for streambuffers (#939)
Gabriele Monaco [Thu, 4 Jan 2024 19:43:34 +0000 (22:43 +0300)]
Added ability to change task notification index for streambuffers (#939)

* Added possibility to change notification index for streambuffers

* Uncrustify: triggered by comment.

* Minor code review suggestions.

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

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2 years agoFix documentation for xQueueTakeMutexRecursive (#943)
Eric Jackson [Wed, 3 Jan 2024 19:49:02 +0000 (11:49 -0800)]
Fix documentation for xQueueTakeMutexRecursive (#943)

2 years agoFix portSET_INTERRUPT_MASK_FROM_ISR definition for atomic operation (#940)
chinglee-iot [Wed, 3 Jan 2024 07:47:05 +0000 (15:47 +0800)]
Fix portSET_INTERRUPT_MASK_FROM_ISR definition for atomic operation (#940)

* Introduce portHAS_NESTED_INTERRUPTS to identify if port has nested interrupt or not.
* Update atomic.h to use portHAS_NESTED_INTERRUPTS instead of portSET_INTERRUPT_MASK_FROM_ISR definition.

---------

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: ActoryOu <jay2002824@gmail.com>
2 years agoRP2040: Fix removal of idle_task_static_memory.c (#935)
dps.lwk [Wed, 3 Jan 2024 05:36:04 +0000 (05:36 +0000)]
RP2040: Fix removal of idle_task_static_memory.c (#935)

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2 years agoFix build error for MSP430 and Cortex A with IAR (#937)
Jeff Tenney [Fri, 29 Dec 2023 19:48:56 +0000 (12:48 -0700)]
Fix build error for MSP430 and Cortex A with IAR (#937)

* fix whitespace in asm macros

* Revert formatting ARM_CA5_No_GIC and ARM_CA9

2 years agoExport MPU Section Attributes (#931)
Soren Ptak [Tue, 26 Dec 2023 10:36:50 +0000 (05:36 -0500)]
Export MPU Section Attributes (#931)

Export the PRIVILEGED_FUNCTION, PRIVILEGED_DATA, and FREERTOS_SYSTEM_CALL
attributes to make it easier for end users to add their own privileged functions and
system calls.

2 years agoRP2040: FreeRTOS-Kernel-Static use configKERNEL_PROVIDED_STATIC_MEMORY (#934)
dps.lwk [Tue, 26 Dec 2023 09:02:47 +0000 (09:02 +0000)]
RP2040: FreeRTOS-Kernel-Static use configKERNEL_PROVIDED_STATIC_MEMORY (#934)

Remove the idle_task_static_memory.c and use the new default implementations
to allows for FreeRTOS-Kernel-Static to be used with configNUMBER_OF_CORES > 1

2 years agoFix build with modern GCC (#933)
Forty-Bot [Fri, 22 Dec 2023 21:09:55 +0000 (16:09 -0500)]
Fix build with modern GCC (#933)

* GCC: MSP430F449: Add missing attributes

Apparently at some point in the past, GCC (or TI's GCC) used to define
these attributes. Define them ourselves so that we can compile the demo
application.

* GCC: MSP430F449: Make interrupts return void

If a return type of a function is not specified, it defaults to int. Set
the return type of interrupts to void to avoid warnings.

* GCC: MSP430F449: Define portPOINTER_SIZE_TYPE

portPOINTER_SIZE_TYPE defaults to uint32_t if undefined. Define it to
uint16_t, which is correct for this port.

2 years agoUpdate History.txt for V11.0.1 (#932)
Rahul Kar [Thu, 21 Dec 2023 06:13:30 +0000 (11:43 +0530)]
Update History.txt for V11.0.1 (#932)

* Update History for V11.0.1

2 years agoUpdate History.txt for v11.0.0 (#926)
chinglee-iot [Mon, 18 Dec 2023 09:16:22 +0000 (17:16 +0800)]
Update History.txt for v11.0.0 (#926)

* Update History.txt for v11.0.0

2 years agoRename sample configuration to template configuration (#927)
Rahul Kar [Mon, 18 Dec 2023 05:13:08 +0000 (10:43 +0530)]
Rename sample configuration to template configuration (#927)

* Rename sample configuration to template configuration

* Rename sample configuration to template configuration in cmake example file

2 years agoUpdate comments related to portYIELD_FROM_ISR() in queue.h #925
Soren Ptak [Fri, 15 Dec 2023 17:34:52 +0000 (12:34 -0500)]
Update comments related to portYIELD_FROM_ISR() in queue.h #925

2 years agoUpdate sample configuration file (#923)
Rahul Kar [Fri, 15 Dec 2023 04:31:18 +0000 (10:01 +0530)]
Update sample configuration file  (#923)

* Update sample configuration file in the examples folder

* Add SMP Configuration definitions

* Fix build issue in cmake example

* Add CoRoutine Configuration definitions

* Code review suggestions

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

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

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2 years agoRemove the sample smp configuration folder (#922)
chinglee-iot [Wed, 13 Dec 2023 08:11:29 +0000 (16:11 +0800)]
Remove the sample smp configuration folder (#922)

* Remove the sample smp configuration folder

2 years agoAdd portTASK_SWITCH_HOOK (#867)
Darian [Mon, 11 Dec 2023 07:12:53 +0000 (15:12 +0800)]
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>
2 years agoDetect more startup config errors on Cortex M (#832)
Jeff Tenney [Mon, 11 Dec 2023 04:57:47 +0000 (21:57 -0700)]
Detect more startup config errors on Cortex M (#832)

Verify that the application has correctly installed PendSV
and SVCall handlers. The application can choose to
disable these checks by setting configCHECK_HANDLER_INSTALLATION
to 0 in their FreeRTOSConfig.h.

2 years agoUpdate the memory alignment within the Cortex-A9 port asm code (#426)
RichardBarry [Sat, 9 Dec 2023 09:19:39 +0000 (01:19 -0800)]
Update the memory alignment within the Cortex-A9 port asm code (#426)

Update alignment in ARM_CA9 port.

2 years agoRemove lint suppression comment (#920)
chinglee-iot [Fri, 8 Dec 2023 06:49:42 +0000 (14:49 +0800)]
Remove lint suppression comment (#920)

Remove lint suppression comment

2 years agoAdd constanst suffix to prevent potential type conversion (#921)
chinglee-iot [Fri, 8 Dec 2023 06:06:55 +0000 (14:06 +0800)]
Add constanst suffix to prevent potential type conversion (#921)

Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
2 years agoAdd coverity example (#870)
chinglee-iot [Thu, 7 Dec 2023 19:24:20 +0000 (03:24 +0800)]
Add coverity example (#870)

* Add coverity example

* Update for CI

* Fix for CI 2

* Update kernel_misra.config

* Rename coverity example to coverity

* Update FreeRTOSConfig.h for coverity project

* Update MISRA.md

* Move coverity config to coverity_misra.config

* Update coverity misra config

* Add README.md file

* Update FreeRTOSConfig.h for coverity

* Fix uncrustify and spell

* Update README.md for relative link path

Update README.md for relative link path

* Update README.md for relative link 2

* Update MISRA.md for relateive path

* Fix for format

* Update coverity_misra.config

* Update configuration folder

* Update README.md for link

* 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: 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>
2 years agoRevert Portable/BCC formatting (#828)
Soren Ptak [Thu, 7 Dec 2023 16:51:11 +0000 (11:51 -0500)]
Revert Portable/BCC formatting (#828)

Revert Portable/BCC formatting

2 years agoRevert Portable/oWatcom formatting (#829)
Soren Ptak [Thu, 7 Dec 2023 16:40:50 +0000 (11:40 -0500)]
Revert Portable/oWatcom formatting (#829)

Revert the formatting on oWatcom ports

2 years agoRevert Portable/Paradigm formatting (#830)
Soren Ptak [Thu, 7 Dec 2023 16:32:49 +0000 (11:32 -0500)]
Revert Portable/Paradigm formatting (#830)

Revert the formatting on Paradigm ports

2 years agoRevert Portable/CodeWarrior formatting (#831)
Soren Ptak [Thu, 7 Dec 2023 16:16:33 +0000 (11:16 -0500)]
Revert Portable/CodeWarrior formatting (#831)

Revert the formatting on CodeWarrior ports

2 years agoUpdate partner and community supported port submodule pointer (#919)
chinglee-iot [Thu, 7 Dec 2023 11:43:02 +0000 (19:43 +0800)]
Update partner and community supported port submodule pointer (#919)

2 years agoSuppress MISRA C:2012 rule 21.6 for snprintf (#877)
chinglee-iot [Thu, 7 Dec 2023 10:51:14 +0000 (18:51 +0800)]
Suppress MISRA C:2012 rule 21.6 for snprintf (#877)

Suppress MISRA C:2012 rule 21.6 for snprintf

2 years agoFix MISRA C 2012 Rule 11.1 deviations (#856)
chinglee-iot [Thu, 7 Dec 2023 10:15:19 +0000 (18:15 +0800)]
Fix MISRA C 2012 Rule 11.1 deviations (#856)

* Update callback function prototype to align with definition
* Suppress unused function pointer parameter

---------

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: GitHub Action <action@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>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2 years agoAdd description about overrun warning in queue.c (#869)
chinglee-iot [Thu, 7 Dec 2023 09:52:21 +0000 (17:52 +0800)]
Add description about overrun warning in queue.c (#869)

* Add description about overrun warning in queue.c

* Remove the unreachable configASSERT

* Code review suggestions

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

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: 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>
2 years agoDeclare variable without initializer (#841)
Rahul Kar [Thu, 7 Dec 2023 09:26:44 +0000 (14:56 +0530)]
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>
2 years agoFix MISRA C 2012 rule 8.6 errors (#862)
chinglee-iot [Thu, 7 Dec 2023 08:53:02 +0000 (16:53 +0800)]
Fix MISRA C 2012 rule 8.6 errors (#862)

* Fix MISRA C 2012 rule 8.6 errors

* Add suppression for hook function

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>
2 years agoFix MISRA_C_2012 rule 13.2 violation (#855)
Rahul Kar [Thu, 7 Dec 2023 06:45:09 +0000 (12:15 +0530)]
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>
2 years agoFix MISRA_C_2012 rule 8.4 violation (#844)
Rahul Kar [Thu, 7 Dec 2023 05:57:50 +0000 (11:27 +0530)]
Fix MISRA_C_2012 rule 8.4 violation (#844)

Fix MISRA_C_2012 rule 8.4 violation

2 years agoAdd parameter name for function type (#845)
Rahul Kar [Wed, 6 Dec 2023 16:23:52 +0000 (21:53 +0530)]
Add parameter name for function type (#845)

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2 years agoFix MISRA_C_2012 rule 7.2 violation (#842)
Rahul Kar [Wed, 6 Dec 2023 16:07:52 +0000 (21:37 +0530)]
Fix MISRA_C_2012 rule 7.2 violation (#842)

* Add a u or U suffix for unsigned numerical literals

* Fix formatting

* Replace u with U for naming convention

---------

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>
2 years agoFix MISRA_C_2012 rule 17.7 violation (#848)
Rahul Kar [Wed, 6 Dec 2023 11:03:18 +0000 (16:33 +0530)]
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>
2 years agoFix MISRA_C_2012 rule 20.7 violation (#843)
Rahul Kar [Wed, 6 Dec 2023 08:27:10 +0000 (13:57 +0530)]
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>
2 years agoSuppress MISRA C:2012 rule 11.5 deviations (#878)
chinglee-iot [Wed, 6 Dec 2023 01:51:52 +0000 (09:51 +0800)]
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>
2 years agoUpdate xTaskGetIdleTaskHandle() For SMP (#868)
Darian [Tue, 5 Dec 2023 06:31:11 +0000 (14:31 +0800)]
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>
2 years agoAdd SMP template port and example (#900)
chinglee-iot [Mon, 4 Dec 2023 02:49:41 +0000 (10:49 +0800)]
Add SMP template port and example (#900)

* Add SMP template port and example
* Add readme file for smp configuration
* Update SMP build flow and add CI build

---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2 years agoFix prototype of MPU_vTimerSetReloadMode (#913)
Rahul Kar [Thu, 30 Nov 2023 00:17:56 +0000 (05:47 +0530)]
Fix prototype of MPU_vTimerSetReloadMode (#913)

2 years agoFix typo in comment (#910)
Legend [Wed, 29 Nov 2023 15:32:30 +0000 (23:32 +0800)]
Fix typo in comment (#910)

Co-authored-by: Tony Josi <tonyjosi@amazon.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: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com>
2 years agoAdd portMEMORY_BARRIER() to RX MCU ports (#864)
Soren Ptak [Wed, 29 Nov 2023 10:22:16 +0000 (05:22 -0500)]
Add portMEMORY_BARRIER() to RX MCU ports (#864)

* Add portMEMORY_BARRIER() to RX MCU ports

* Remove the memory barrier from the SH2A_FPU portable directory

---------

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2 years agoUpgrade msvc port to winsock2 (#895)
Soren Ptak [Tue, 28 Nov 2023 20:16:16 +0000 (15:16 -0500)]
Upgrade msvc port to winsock2 (#895)

* Add the changes needed to the MSVC windows port to get it to build with winsock2.h
* Rely upon the WIN32_LEAN_AND_MEAN define to include winsock2.h

2 years agoRevert Portable/Renesas formatting (#876)
Soren Ptak [Tue, 28 Nov 2023 18:56:15 +0000 (13:56 -0500)]
Revert Portable/Renesas formatting (#876)

* Revert the formatting on Renesas ports

2 years agoCoverity Report Directory Fix (#909)
Rahul Kar [Tue, 28 Nov 2023 13:46:15 +0000 (19:16 +0530)]
Coverity Report Directory Fix (#909)

* Revert "The curl command to send the report expects the tar file to be in its current directory. The step either needed to have the working-directory: set to the build directory, or the tar file needs to be created in the parent directory. (#903)"

This reverts commit 76f3aa5b05e5c38e423e83eea23f5b34c15d3316.

* Update to separate build and upload steps

---------

Co-authored-by: tony-josi-aws <tonyjosi@amazon.com>
2 years agoSuppress MISRA C rule 11.3 in MISRA.md (#857)
chinglee-iot [Tue, 28 Nov 2023 13:34:29 +0000 (21:34 +0800)]
Suppress MISRA C rule 11.3 in MISRA.md (#857)

Suppress MISRA C rule 11.3 in MISRA.md

2 years agoFix MISRA 2012 Rule 10.8 violation (#853)
chinglee-iot [Tue, 28 Nov 2023 11:34:13 +0000 (19:34 +0800)]
Fix MISRA 2012 Rule 10.8 violation (#853)

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>
2 years agoFix MISRA 2012 rule 10.4 violations (#852)
chinglee-iot [Tue, 28 Nov 2023 11:21:03 +0000 (19:21 +0800)]
Fix MISRA 2012 rule 10.4 violations (#852)

Fix MISRA 2012 rule 10.4 violations

2 years agoFix MISRA C 2012 Rule 10.3 errors (#860)
chinglee-iot [Tue, 28 Nov 2023 05:29:07 +0000 (13:29 +0800)]
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>
2 years agoThe curl command to send the report expects the tar file to be in its current directo...
Soren Ptak [Tue, 28 Nov 2023 05:08:57 +0000 (00:08 -0500)]
The curl command to send the report expects the tar file to be in its current directory. The step either needed to have the working-directory: set to the build directory, or the tar file needs to be created in the parent directory. (#903)

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2 years agoCoverity scan and upload in single step (#902)
Tony Josi [Mon, 27 Nov 2023 03:50:41 +0000 (09:20 +0530)]
Coverity scan and upload in single step (#902)

2 years agoNot to use object modified in the loop body (#861)
chinglee-iot [Fri, 24 Nov 2023 06:08:34 +0000 (14:08 +0800)]
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>
2 years agoCoverity Scan Workflow Fix (#891)
Soren Ptak [Thu, 23 Nov 2023 16:47:31 +0000 (08:47 -0800)]
Coverity Scan Workflow Fix (#891)

Currently the Coverity Scan attempts to run on every fork that pulls
the file. This leads to anybody who pulls this file getting emails that
their workflow failed to run when the cron job attempts to run. This
PR sets the scan to only run if the repo is FreeRTOS/FreeRTOS-Kernel.
Also, change the scan from a cron job to a job that runs on a commit
to mainline, or if triggered manually.

2 years agoRevert Portable/WizC Formatting (#888)
Soren Ptak [Thu, 23 Nov 2023 12:04:07 +0000 (04:04 -0800)]
Revert Portable/WizC Formatting (#888)

* Revert formatting on WizC ports

* Fix spelling mistakes

---------

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>
2 years agoRevert formatting on Tasking ports (#887)
Soren Ptak [Thu, 23 Nov 2023 11:51:23 +0000 (03:51 -0800)]
Revert formatting on Tasking ports (#887)

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>
2 years agoRevert Portable/Softune Formatting (#886)
Soren Ptak [Thu, 23 Nov 2023 11:39:28 +0000 (03:39 -0800)]
Revert Portable/Softune Formatting (#886)

* Revert formatting on Softune ports

* Fix spelling mistakes

---------

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>
2 years agoRevert formatting on SDCC ports (#885)
Soren Ptak [Thu, 23 Nov 2023 11:14:36 +0000 (03:14 -0800)]
Revert formatting on SDCC ports (#885)

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>
2 years agoRevert formatting on Rowley ports (#884)
Soren Ptak [Thu, 23 Nov 2023 10:53:55 +0000 (02:53 -0800)]
Revert formatting on Rowley ports (#884)

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>
2 years agoRevert Portable/MPLAB Formatting (#883)
Soren Ptak [Thu, 23 Nov 2023 10:29:40 +0000 (02:29 -0800)]
Revert Portable/MPLAB Formatting (#883)

* Revert the formatting PR

* Fix spelling mistakes

---------

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>
2 years agoRevert the formatting changes on MikroC ports. (#882)
Soren Ptak [Thu, 23 Nov 2023 10:20:15 +0000 (02:20 -0800)]
Revert the formatting changes on MikroC ports. (#882)

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>
2 years agoRevert formatting on CCS port files (#881)
Soren Ptak [Thu, 23 Nov 2023 10:09:09 +0000 (02:09 -0800)]
Revert formatting on CCS port files (#881)

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>
2 years agoUpdate system call entry mechanism (#898)
Gaurav-Aggarwal-AWS [Thu, 23 Nov 2023 05:17:47 +0000 (10:47 +0530)]
Update system call entry mechanism (#898)

Earlier the System Call entry from an unprivileged task
looked like:

1. SVC for entering system call.
2. System call implementation.
3. SVC for exiting system call.

Now, the system call entry needs to make only one SVC
call and everything else is handled internally.

This PR also makes the following changes:

1. Update the Access Control List (ACL) mechanism to
    grant access to all the kernel objects before the
    scheduler is started.
2. Add one struct param for system calls with 5 parameters.
    This removes the need for special handling for system
    calls with 5 parameters.
3. Remove raise privilege SVC when MPU wrapper v2 is used.
4. Add additional run time parameter checks to MPU wrappers
    for xTaskGenericNotify and xQueueTakeMutexRecursive APIs.

2 years agofix IAR/CM0/portmacro.h missing semicolon (#894)
Ha Thach [Sat, 18 Nov 2023 08:01:50 +0000 (15:01 +0700)]
fix IAR/CM0/portmacro.h missing semicolon (#894)

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2 years agoIn smp, every core has a idle task. (#893)
Moral-Hao [Thu, 16 Nov 2023 19:53:27 +0000 (03:53 +0800)]
In smp, every core has a idle task. (#893)

Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
2 years agoAdd vApplicationGetPassiveIdleTaskMemory for SMP (#890)
chinglee-iot [Thu, 16 Nov 2023 01:04:05 +0000 (09:04 +0800)]
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.

2 years agoCI-CD URL Check Change (#880)
Soren Ptak [Thu, 9 Nov 2023 23:00:06 +0000 (15:00 -0800)]
CI-CD URL Check Change (#880)

* Remove the Kernel's custom URL check to just use the CI-CD Actions one
* Exclude portable directory from formatting check.

2 years agoAdd time conversion macros (#866) 762/head
Darian [Wed, 8 Nov 2023 05:34:53 +0000 (13:34 +0800)]
Add time conversion macros (#866)

This commit updates the following time conversion macros:

- pdMS_TO_TICKS: Added cast to "uint64_t" to prevent overflow
- pdTICKS_TO_MS: Added macro to convert ticks to milliseconds

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2 years agoDistinguish waiting for notify status from suspend status (#865)
Moral-Hao [Tue, 7 Nov 2023 07:33:07 +0000 (15:33 +0800)]
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>
2 years agoFix vTaskSwitchContext for smp. (#879)
Moral-Hao [Mon, 6 Nov 2023 09:50:32 +0000 (17:50 +0800)]
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>
2 years agoaarch64: Rename ARM_CA53_64_BIT/_SRE to Arm_AARCH64/_SRE (#822)
Devaraj Ranganna [Tue, 31 Oct 2023 04:36:39 +0000 (04:36 +0000)]
aarch64: Rename ARM_CA53_64_BIT/_SRE to Arm_AARCH64/_SRE (#822)

The Cortex-A53 ports are generic and can be used as a starting point
for other Armv8-A application processors. Therefore, rename
`ARM_CA53_64_BIT` to `Arm_AARCH64` and `ARM_CA53_64_BIT_SRE` to
`Arm_AARCH64_SRE`.

With this renaming, existing projects that use old port, should
migrate to renamed port as follows:

* `ARM_CA53_64_BIT` -> `Arm_AARCH64`
* `ARM_CA53_64_BIT_SRE` -> `Arm_AARCH64_SRE`

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2 years agoMove cmake compile options to the example project (#872)
ActoryOu [Mon, 30 Oct 2023 15:35:42 +0000 (23:35 +0800)]
Move cmake compile options to the example project (#872)

* Move GCC compile option to GCC folder with toolchain option

* Add CI flow to build cmake example

* Fix CI

* formatting && enable Werror

* Add useless variable to test CI

* revert useless variable

* Add comments as examples.

* Remove default compile options.

* Formatting

* Remove compile option in kernel cmake and put the sample in examples/cmake_example

---------

Co-authored-by: Joseph Julicher <jjulicher@mac.com>
2 years agoupdate coverity scan email (#871)
Tony Josi [Mon, 30 Oct 2023 12:49:29 +0000 (18:19 +0530)]
update coverity scan email (#871)

2 years agoSupport configurable RISC-V chip extension (#773)
Joe Benczarski [Fri, 27 Oct 2023 18:57:52 +0000 (14:57 -0400)]
Support configurable RISC-V chip extension (#773)

* Support configurable RISC-V chip extension

Added the FREERTOS_RISCV_EXTENSION option to allow the user
to select which chip extension they want included. Removed the
port for pulpino to instead use the new option.

* Add port GCC_RISC_V_GENERIC and IAR_RISC_V_GENERIC

* Add two rics-v generic ports to support FREERTOS_RISCV_EXTENSION
  config

---------

Co-authored-by: Joe Benczarski <jbenczarski@trijicon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
2 years agoAdd nightly coverity scan (#859)
Tony Josi [Thu, 26 Oct 2023 05:57:45 +0000 (11:27 +0530)]
Add nightly coverity scan (#859)

* coverity scan job

* coverity scan badge in readme

* Update cron schedule

* revert adding badge

* update description

* updating review feedback

2 years agovTaskListTasks prints core affinity mask (#850)
Darian [Wed, 25 Oct 2023 21:45:03 +0000 (05:45 +0800)]
vTaskListTasks prints core affinity mask (#850)

This commit updates vTaskListTasks so that it prints uxCoreAffinityMask if
core affinity is enabled in configuration.

2 years agoUpdate example cmake project path (#851)
Tony Josi [Mon, 23 Oct 2023 09:20:41 +0000 (14:50 +0530)]
Update example cmake project path (#851)

* fix build on 64 bit platform

* moving sample cmake project to a separate root level dir

* moving sample cmake project to a separate root level dir

* updating paths for the sample cmake project

* rename example folder

* use configKERNEL_PROVIDED_STATIC_MEMORY

* update comments

* update comments

* rename folder to examples

* fix formatting

2 years agoRename CPU to Core (#849)
Darian [Mon, 23 Oct 2023 07:20:24 +0000 (15:20 +0800)]
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>
2 years agoRemove default behaviour of FREERTOS_HEAP. (#807)
Boris van der Meer [Mon, 23 Oct 2023 06:57:54 +0000 (08:57 +0200)]
Remove default behaviour of FREERTOS_HEAP. (#807)

To build a complete static application (configSUPPORT_DYNAMIC_ALLOCATION
set to 0) an ugly workaround is necessary, because when FREERTOS_HEAP is
not set, heap 4 is automatically selected in the current CMake.

Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.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>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
2 years agoCovert object type check to runtime check (#846)
Gaurav-Aggarwal-AWS [Fri, 20 Oct 2023 16:38:03 +0000 (22:08 +0530)]
Covert object type check to runtime check (#846)

* Covert object type check to runtime check

It was checked using assert earlier.

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2 years agoKernel Checker CI Workflow File Updates (#804)
Soren Ptak [Thu, 19 Oct 2023 17:08:24 +0000 (10:08 -0700)]
Kernel Checker CI Workflow File Updates (#804)

* Perform sparse checkout of just the .github folder for the header check instead of all the files. Update python checkout version being used. Update the version of the get changed files action being used.

* Use echo groups on the header check

2 years agoFix size alignment in the integer overflow issue (#839)
Rahul Kar [Thu, 19 Oct 2023 06:38:22 +0000 (12:08 +0530)]
Fix size alignment in the integer overflow issue (#839)

2 years agoRemoves redundant API calls in MPU wrappers (#838)
Rahul Kar [Thu, 19 Oct 2023 05:50:19 +0000 (11:20 +0530)]
Removes redundant API calls in MPU wrappers (#838)

* Remove redundant API calls in Queue wrappers

2 years agoFix possible integer overflow (#836)
Gaurav-Aggarwal-AWS [Tue, 17 Oct 2023 16:01:43 +0000 (21:31 +0530)]
Fix possible integer overflow (#836)

* Fix possible integer overflow

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2 years agoFix reliability issues in CMake sample (#835)
Rahul Kar [Tue, 17 Oct 2023 14:29:37 +0000 (19:59 +0530)]
Fix reliability issues in CMake sample (#835)

* Fix reliability issues in CMake example sample.

2 years agoFix xTaskNotifyWait & ulTaskNotifyTake determinism. (#833)
Rahul Kar [Tue, 17 Oct 2023 09:35:18 +0000 (15:05 +0530)]
Fix xTaskNotifyWait & ulTaskNotifyTake determinism. (#833)

This PR fixes the bug described in the following issue:
https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/612.
This was originally contributed in the following PR:
https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/625.

The implementation suspends the scheduler before exiting the
critical section (i.e. before enabling interrupts). If we do not do
so, a notification sent from an ISR, which happens after exiting
the critical section and before suspending the scheduler, will
get lost. The sequence of events will be:

1. Exit critical section.
2. Interrupt - ISR calls xTaskNotifyFromISR which adds the task to
    the Ready list.
3. Suspend scheduler.
4. prvAddCurrentTaskToDelayedList moves the task to the delayed
    or suspended list.
5. Resume scheduler does not touch the task (because it is not on
    the pendingReady list), effectively losing the notification from
    the ISR.

The same does not happen when we suspend the scheduler before
exiting the critical section. The sequence of events in this case will
be:

1. Suspend scheduler.
2. Exit critical section.
3. Interrupt - ISR calls xTaskNotifyFromISR which adds the task to
    the pendingReady list as the scheduler is suspended.
4. prvAddCurrentTaskToDelayedList adds the task to delayed or
    suspended list. Note that this operation does not nullify the add
    to pendingReady list done in the above step because a different
    list item, namely xEventListItem, is used for adding the task to the
    pendingReady list. In other words, the task still remains on the
    pendingReady list.
5. Resume scheduler moves the task from pendingReady list to the Ready list.

------------

Co-authored-by: Jacob Carver <karver8@github.com>