Commit Graph

3544 Commits (3ddfffda048a6991f5059332e949a2ee084a5173)
 

Author SHA1 Message Date
Soren Ptak ad13a1f8df
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.
1 year ago
Darian 9c649ea7d1
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>
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
Devaraj Ranganna 83083a8a13
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>
1 year ago
ActoryOu ef0104e768
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>
1 year ago
Tony Josi 1c465a0890
update coverity scan email (#871) 1 year ago
Joe Benczarski 37678b0656
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>
1 year ago
Tony Josi 5281427a99
Add nightly coverity scan (#859)
* coverity scan job

* coverity scan badge in readme

* Update cron schedule

* revert adding badge

* update description

* updating review feedback
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
Tony Josi a8650b99a3
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
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
Boris van der Meer 9f4a0e308b
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>
1 year ago
Gaurav-Aggarwal-AWS 7562ebc6e1
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>
1 year ago
Soren Ptak a936a1b156
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
1 year ago
Rahul Kar b32aafe4dc
Fix size alignment in the integer overflow issue (#839) 1 year ago
Rahul Kar 220771565f
Removes redundant API calls in MPU wrappers (#838)
* Remove redundant API calls in Queue wrappers
1 year ago
Gaurav-Aggarwal-AWS 4ada1d7d5e
Fix possible integer overflow (#836)
* Fix possible integer overflow

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
Rahul Kar 59ba98b2e3
Fix reliability issues in CMake sample (#835)
* Fix reliability issues in CMake example sample.
1 year ago
Rahul Kar 30283b57df
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>
1 year ago
chinglee-iot 7ffc6a7465
Add base priority get APIs (#818)
* Add base priority get APIs
* Add MPU changes

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
Sudeep Mohanty 631ae9e6e4
Add option to set the core affinity for the Timer Svc Task on SMP systems (#805)
This PR introduces the configTIMER_SERVICE_TASK_CORE_AFFINITY option
which allows the system to configure the core affinity of the Timer
Service Task on an SMP system. The default affinity of the Timer Service
Task is set to tskNO_AFFINITY which is the current behavior on SMP
systems.

Signed-off-by: Sudeep Mohanty <sudp.mohanty@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Joseph Julicher 1b2b0904ce
Added the minimal example (#823)
* re-adding main.c to the minimal example

* Uncrustify: triggered by comment.

* Update minimal_freertos_example/main.c

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

* Add in the deleted cmake list

* Added a single newline at the end of the cmake

* Cleanup the CMakelists

* updates the main & Cmake

* Formatting

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
1 year ago
chinglee-iot 2be332ae21
Separate the task create function for core affinity (#789)
* Separate the task create function for core affinity
* Update function prototype and comment
* Code review suggestions

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

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: kar-rahul-aws <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>
1 year ago
chinglee-iot 4bfb9b2d70
Update SMP get idle task memory for static allocation (#784)
* Add static idle task memory support for SMP
* Rename vApplicationMinimalIdleTask to vApplicationPassiveIdleTask
* Rename the macro configUSE_MINIMAL_IDLE_HOOK to configUSE_PASSIVE_IDLE_HOOK
* Update xTaskGetIdleTaskHandle for SMP
* Add more check in xTaskGetIdleTaskHandle
* Support configKERNEL_PROVIDED_STATIC_MEMORY for SMP

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Soren Ptak 92a4d175e6
Link to the CONTRIBUTING.md file in this repo, not the github repo itself (#827) 1 year ago
Monika Singh abb5452a12
Update pull request information in readme (#821)
* Update pull request infomation in readme.

* Update link
1 year ago
Gaurav-Aggarwal-AWS 3d575b58a4
Make taskYIELD available to unprivileged tasks (#817)
Make taskYIELD available to unprivileged tasks on ARMv8-M
ports.
1 year ago
chinglee-iot d442d7908a
Add configCONTROL_INFINITE_LOOP for loop control in unit test (#783)
* Add configCONTROL_INFINITE_LOOP in FreeRTOS.h
* Use configCONTROL_INFINITE_LOOP in tasks.c and timer.c

---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com>
1 year ago
chinglee-iot 97d48ba94a
Add more comment for core affinity in prvSelectHighestPriorityTask (#801)
* Add more comment for core affinity in prvSelectHighestPriorityTask

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

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
chinglee-iot 317bc0c89c
Move trace macro after declaration (#820)
* Move trace macro after declaration to comply with ISO C90
1 year ago
chinglee-iot 30e13dac2b
Implement prvYieldCore with macro (#785)
* Implement prvYieldCore with macro for performance and memory
* Remove the portCHECK_IF_IN_ISR macro check. It is not required in SMP
  now

Co-authored-by: kar-rahul-aws <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 830533d49e
Add taskYIELD_WITHIN_API macro (#782)
Add taskYIELD_WITHIN_API macro for readability improvement.
1 year ago
Joseph Julicher 5cdb1bc4e1
removed the copyright and license header for select files (#815)
* removed the copyright and license header for files expected to be copied by users

* fixed a bug in the kernel checker.  temporarily restored the copyright in the sample config to allow this PR to pass the checks.

* Uncrustify: triggered by comment.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 year ago
Michael Fairman 57f9eed00d
bugfix: correct computation of stack size on Mac Posix port (#816)
Aligns the stack end to a page boundary before computing its
size, since the size depends on both the start and end.

The original change which introduced stack alignment (#674)
only worked for cases where the round + trunc operation would
wind up within the same area, but would lead to segfaults in
other cases.

Also adds a typecast to the `mach_vm_round_page()` call, as
it is actually a macro which casts to `mach_vm_offset_t` and
the result here is used as a `StackType_t` pointer.

Tested on ARM64 and Intel MacOS, as well as ARM64 and Intel
Linux.  The test code included a single-task case, as well
as a case with two tasks passing queue messages.
1 year ago
Joseph Julicher 5a9d7c8388
Sample FreeRTOSConfig.h and template port (#812)
* config file experiments

* adding a config file for an example

* Added a template port and updated the CMakeLists

* template and default configuration build

* finalising the sample FreeRTOSConfig.h header file

* removed .config hidden file

* further reductions in the template port

* Uncrustify: triggered by comment.

* Uncrustify: triggered by comment.

* minor readme updates

* fixed spelling error in HTTP

* fixed a type and added a link to the sample readme

* uncrustified FreeRTOSConfig.h

* Uncrustify: triggered by comment.

* Revert "Uncrustify: triggered by comment."

This reverts commit e534f46f2d.

* Revert "Revert "Uncrustify: triggered by comment.""

This reverts commit c9058dd383.

* excluding the FreeRTOSConfig.h from copyright+license check because this file is intended to be incorporated into user code

* Removed the copyright and license from the template files

* put license copy in the template and sample files

* Uncrustify: triggered by comment.

---------

Co-authored-by: GitHub Action <action@github.com>
1 year ago
Devaraj Ranganna 9d2571d2ed
Cortex-M23: Do not use PSPLIM_NS (#791)
According to Armv8-M technical reference manual, if the main extension
is not implemented then PSPLIM_NS is RES0. Update the cortex-M23
port to not use the reserved PSPLIM_NS.
1 year ago
Soren Ptak a695b671aa
Apply formatting bot fix (#806) 1 year ago
Gaurav-Aggarwal-AWS 96d6190b61
Replace sprintf with snprintf (#802)
This change necessitates the introduction of 2 new APIs:

void vTaskListTasks( char * pcWriteBuffer, size_t uxBufferLength );
void vTaskGetRunTimeStatistics( char * pcWriteBuffer, size_t uxBufferLength );

These 2 APIs behave exactly as vTaskList and vTaskGetRunTimeStats
except the fact that they take the length of the pcWriteBuffer as the
second argument to ensure that we do not write past the buffer.

vTaskList and vTaskGetRunTimeStats assume that the length of the
buffer is configSTATS_BUFFER_MAX_LENGTH which defaults to 0xFFFF.
This is done to ensure that the existing applications do not break.
New applications should use the new APIs to avoid memory corruption.
1 year ago
Soren Ptak 84bdb05bd2
Fix portSWITCH_TO_USER_MODE() on Armv7-M MPU ports (#803)
A task's privilege level is stored in ulTaskFlag member in the TCB. Current
implementation of portSWITCH_TO_USER_MODE() does not update this
flag but just lowers the processor's privilege level. This results in many
APIs incorrectly determining task's privilege level and access permissions -

- xPortIsAuthorizedToAccessBuffer
- xPortIsTaskPrivileged
- xPortIsAuthorizedToAccessKernelObject

This PR fixes the portSWITCH_TO_USER_MODE() implementation to correctly
update the ulTaskFlag member in the TCB before lowering the processor's
privilege level.
1 year ago
kar-rahul-aws ac5deb155d
Remove unwanted variable portACL_ENTRY_SIZE_BYTES (#810) 1 year ago
Moral-Hao 2f25cb94f5
Reduce memory usage of ACL. (#809)
Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com>
1 year ago
chinglee-iot 2bc6188be3
Update pxMutexHolder is NULL check description (#800) 1 year ago
Boris van der Meer d43062ba78
Add trace hook macro for most ports (#794)
Add trace hook macro for most ports

In pull request #659 we introduced better support for tracing
tools like systemview. This patchset adds support for more
ports as requested in the original pull request.
1 year ago
Sebastian Brosch 83861f5b1d
Add Trace Hook Macros to all API calls (#786)
This pull-request adds out-of-the-box support for different tracing
tools. New trace hook macros have been added for all public API
functions, one for each function entry and one for each exit. There are
no functional changes, as the macros are by default empty.

For more information see following forum post:
https://forums.freertos.org/t/add-tracing-functionality-for-all-api-calls/18007.
1 year ago
Robert Berger 15e0364968
xQueueSendToFromFromISR --> xQueueSendToFrontFromISR (#795)
Co-authored-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
1 year ago
Robert Berger c59ce22c8f
Fix xQueueSendToFront code comment (#796)
Co-authored-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
1 year ago
kar-rahul-aws c6ec8295e8
Remove CORTEX_M3_MPS2_QEMU_GCC Demo from kernel demos yaml file (#798) 1 year ago
Mehdi 7cd201c290
Add default implementations of vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory (#790)
This PR introduces configKERNEL_PROVIDED_STATIC_MEMORY option
which the application can set to 1 to use the default implementations
of vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory
functions.

If the application enables static allocation (i.e. sets
configUSE_STATIC_ALLOCATION to 1) and does not provide the above 2
functions, it will result in linker error. The application has two options:

1. Set configKERNEL_PROVIDED_STATIC_MEMORY to 1 to use the default
    implementations of these functions.
2. Provide implementations of these 2 functions.

Note that default definitions are only available for non-MPU ports. The
reason is that the stack alignment requirements vary for different
architectures.
1 year ago
Gaurav-Aggarwal-AWS c3ece08119
Fix prototype in mpu_prototypes.h (#797)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago