]> begriffs open source - freertos/log
freertos
3 years agoUpdate of three badly terminated macro definitions (#555)
newbrain [Thu, 8 Sep 2022 17:33:41 +0000 (19:33 +0200)]
Update of three badly terminated macro definitions (#555)

* Update of three badly terminated macro definitions
- vTaskDelayUntil() to conform to usual pattern do { ... } while(0)
- vTaskNotifyGiveFromISR() and
- vTaskGenericNotifyGiveFromISR() to remove extra terminating semicolons
- This PR addresses issues #553 and #554

* Adjust formatting of task.h

Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoAdded checks for index in ThreadLocalStorage APIs (#552)
Aniruddha Kanhere [Thu, 1 Sep 2022 20:23:02 +0000 (13:23 -0700)]
Added checks for index in ThreadLocalStorage APIs (#552)

Added checks for ( xIndex >= 0 ) in ThreadLocalStorage APIs

3 years agoRISC-V: Add support for RV32E extension in GCC port (#543)
Jakub Lužný [Tue, 30 Aug 2022 23:49:37 +0000 (01:49 +0200)]
RISC-V: Add support for RV32E extension in GCC port (#543)

Co-authored-by: Joseph Julicher <jjulicher@mac.com>
3 years ago[Fix] Type for pointers operations (#550)
Octaviarius [Tue, 30 Aug 2022 20:27:39 +0000 (23:27 +0300)]
[Fix] Type for pointers operations (#550)

* fix type for pointers operations in some places: size_t -> portPOINTER_SIZE_TYPE

* fix pointer arithmetics

* fix xAddress type

3 years agoAdd FreeRTOS config directory to include dirs (#548)
Gaurav-Aggarwal-AWS [Mon, 22 Aug 2022 15:28:07 +0000 (20:58 +0530)]
Add FreeRTOS config directory to include dirs (#548)

This allows the application write to set FREERTOS_CONFIG_FILE_DIRECTORY
to whichever directory the FreeRTOSConfig.h file exists in.

This was reported here - https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/545

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd support for MISRA rule 20.7 (#546)
Monika Singh [Fri, 19 Aug 2022 10:21:57 +0000 (15:51 +0530)]
Add support for MISRA rule 20.7 (#546)

Misra rule 20.7 requires parenthesis to all parameter names
in macro definitions.

The issue was reported here : https://forums.freertos.org/t/misra-20-7-compatibility/15385

3 years agoFix warnings in posix port (#544)
Archit Gupta [Tue, 16 Aug 2022 11:11:17 +0000 (04:11 -0700)]
Fix warnings in posix port (#544)

Fixes warnings about unused parameters and variables when built with
`-Wall -Wextra`.

3 years agocorrect grammar in include/FreeRTOS.h
Paul Bartell [Tue, 9 Aug 2022 22:48:56 +0000 (15:48 -0700)]
correct grammar in include/FreeRTOS.h

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
3 years agoFix formatting of FreeRTOS.h
Paul Bartell [Tue, 9 Aug 2022 18:13:12 +0000 (11:13 -0700)]
Fix formatting of FreeRTOS.h

3 years agoMove some of the complex pre-processor guards on prvWriteNameToBuffer() to compile...
RichardBarry [Sun, 19 Dec 2021 19:18:54 +0000 (11:18 -0800)]
Move some of the complex pre-processor guards on prvWriteNameToBuffer() to compile time checks in FreeRTOS.h.

Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoInclude string.h at the top of portable/GCC/ARM_CA9/port.c to prevent memset() genera...
RichardBarry [Tue, 9 Aug 2022 17:37:24 +0000 (10:37 -0700)]
Include string.h at the top of portable/GCC/ARM_CA9/port.c to prevent memset() generating a warning. (#430)

Co-authored-by: none <unknown>
3 years agoChange default value of INCLUDE_xTaskGetCurrentTaskHandle (#542)
Ravishankar Bhagavandas [Tue, 9 Aug 2022 16:48:44 +0000 (09:48 -0700)]
Change default value of INCLUDE_xTaskGetCurrentTaskHandle (#542)

3 years agoGeneralize Thread Local Storage (TLS) support (#540)
Gaurav-Aggarwal-AWS [Mon, 8 Aug 2022 15:53:29 +0000 (21:23 +0530)]
Generalize Thread Local Storage (TLS) support (#540)

* Generalize Thread Local Storage (TLS) support

FreeRTOS's Thread Local Storage (TLS) support used variables and
functions from newlib, thereby making the TLS support specific to
newlib. This commit generalizes the TLS support so that it can be used
with other c-runtime libraries also. The default behavior for newlib
support is still kept same for backward compatibility.

The application writer would need to set configUSE_C_RUNTIME_TLS_SUPPORT
to 1 in their FreeRTOSConfig.h and define the following macros to
support TLS for a c-runtime library:

1. configTLS_BLOCK_TYPE - Type used to define the TLS block in TCB.
2. configINIT_TLS_BLOCK( xTLSBlock ) - Allocate and initialize memory
   block for the task's TLS Block.
3. configSET_TLS_BLOCK( xTLSBlock ) - Switch C-Runtime's TLS Block to
   point to xTLSBlock.
4. configDEINIT_TLS_BLOCK( xTLSBlock ) - Free up the memory allocated
   for the task's TLS Block.

The following is an example to support TLS for picolibc:

 #define configUSE_C_RUNTIME_TLS_SUPPORT        1
 #define configTLS_BLOCK_TYPE                   void*
 #define configINIT_TLS_BLOCK( xTLSBlock )      _init_tls( xTLSBlock )
 #define configSET_TLS_BLOCK( xTLSBlock )       _set_tls( xTLSBlock )
 #define configDEINIT_TLS_BLOCK( xTLSBlock )

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd .syntax unified to GCC assembly functions (#538)
Gaurav-Aggarwal-AWS [Sun, 7 Aug 2022 17:16:11 +0000 (22:46 +0530)]
Add .syntax unified to GCC assembly functions (#538)

This fixes the compilation issue with XC32 compiler.

It was reported here - https://forums.freertos.org/t/xc32-v4-00-error-with-building-freertos-portasm-c/14357/4

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoUpdate History.txt (#535)
Gaurav-Aggarwal-AWS [Sun, 7 Aug 2022 17:01:47 +0000 (22:31 +0530)]
Update History.txt (#535)

* Update History.txt

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoBlock SIG_RESUME in the main thread of the Posix port so that sigwait works as expect...
Chris Copeland [Thu, 4 Aug 2022 18:11:31 +0000 (11:11 -0700)]
Block SIG_RESUME in the main thread of the Posix port so that sigwait works as expected (#532)

Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
3 years agoChange type of message buffer handle (#537)
Ravishankar Bhagavandas [Thu, 4 Aug 2022 17:07:49 +0000 (10:07 -0700)]
Change type of message buffer handle (#537)

3 years agoFix NULL pointer dereference in vPortGetHeapStats
Gaurav Aggarwal [Thu, 4 Aug 2022 11:11:33 +0000 (16:41 +0530)]
Fix NULL pointer dereference in vPortGetHeapStats

When the heap is exhausted (no free block), start and end markers are
the only blocks present in the free block list:

     +---------------+     +-----------> NULL
     |               |     |
     |               V     |
+ ----- +            + ----- +
|   |   |            |   |   |
|   |   |            |   |   |
+ ----- +            + ----- +
  xStart               pxEnd

The code block which traverses the list of free blocks to calculate heap
stats used a do..while loop that moved past the end marker when the heap
had no free block resulting in a NULL pointer dereference. This commit
changes the do..while loop to while loop thereby ensuring that we never
move past the end marker.

This was reported here - https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/534

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd vPortRemoveInterruptHandler API (#533)
Gaurav-Aggarwal-AWS [Wed, 3 Aug 2022 20:45:27 +0000 (13:45 -0700)]
Add vPortRemoveInterruptHandler API (#533)

* Add xPortRemoveInterruptHandler API

This API is added to the MicroBlazeV9 port. It enables the application
writer to remove an interrupt handler.

This was originally contributed in this PR - https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/523

* Change API signature to return void

This makes the API similar to vPortDisableInterrupt.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gavin Lambert <uecasm@users.noreply.github.com>
3 years agoUpdate codecov action to v3.1.0
Paul Bartell [Tue, 28 Jun 2022 21:07:17 +0000 (14:07 -0700)]
Update codecov action to v3.1.0

3 years agoImplement MicroBlazeV9 stack protection (#523)
Gavin Lambert [Wed, 3 Aug 2022 06:31:18 +0000 (18:31 +1200)]
Implement MicroBlazeV9 stack protection (#523)

* Implement stack protection for MicroBlaze (without MPU wrappers)

3 years agoadd portDONT_DISCARD to pxCurrentTCB (#479)
Patrick Oppenlander [Tue, 2 Aug 2022 10:39:58 +0000 (20:39 +1000)]
add portDONT_DISCARD to pxCurrentTCB (#479)

This fixes link failures with LTO:

/tmp/ccJbaKaD.ltrans0.ltrans.o: in function `pxCurrentTCBConst2':
/root/project/FreeRTOS/portable/GCC/ARM_CM4F/port.c:249: undefined reference to `pxCurrentTCB'
/usr/lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /tmp/ccJbaKaD.ltrans0.ltrans.o: in function `pxCurrentTCBConst':
/root/project/FreeRTOS/portable/GCC/ARM_CM4F/port.c:443: undefined reference to `pxCurrentTCB'

3 years agoAdd SBOM Generation in auto_release.yml (#524)
Xin Lin [Thu, 28 Jul 2022 17:35:29 +0000 (10:35 -0700)]
Add SBOM Generation in auto_release.yml (#524)

3 years agoPosix: Removed unused signal set from port (#528)
0xjakob [Mon, 25 Jul 2022 17:05:30 +0000 (01:05 +0800)]
Posix: Removed unused signal set from port (#528)

Co-authored-by: Jakob Hasse <0xjakob@users.noreply.github.com>
3 years agoRP2040: Use indirect reference for pxCurrentTCB (#525)
NomiChirps [Mon, 18 Jul 2022 23:05:30 +0000 (16:05 -0700)]
RP2040: Use indirect reference for pxCurrentTCB (#525)

3 years agoAdd Cortex M7 r0p1 Errata 837070 workaround to CM4_MPU ports (#513)
Paul Bartell [Thu, 30 Jun 2022 05:05:26 +0000 (22:05 -0700)]
Add Cortex M7 r0p1 Errata 837070 workaround to CM4_MPU ports (#513)

* Clarify Cortex M7 r0p1 errata number in r0p1 specific port.

* Add ARM Cortex M7 r0p0 / r0p1 Errata 837070 workaround to CM4 MPU ports.

Optionally, enable the errata workaround by defining configTARGET_ARM_CM7_r0p0 or configTARGET_ARM_CM7_r0p1 in FreeRTOSConfig.h.

* Add r0p1 errata support to IAR port as well

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Change macro name to configENABLE_ERRATA_837070_WORKAROUND

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoUpdate submodule pointer of Community Supported Ports (#486)
Gaurav-Aggarwal-AWS [Wed, 29 Jun 2022 15:01:00 +0000 (08:01 -0700)]
Update submodule pointer of Community Supported Ports (#486)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
3 years agoUpdate to TF-M version TF-Mv1.6.0 (#517)
Xinyu Zhang [Wed, 29 Jun 2022 06:52:30 +0000 (14:52 +0800)]
Update to TF-M version TF-Mv1.6.0 (#517)

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I0c15564b342873f9bd7a8240822e770950a0563e

3 years agoRP2040: Allow FreeRTOS to be added to the parent CMake project post initialization...
Graham Sanderson [Fri, 24 Jun 2022 11:52:49 +0000 (06:52 -0500)]
RP2040: Allow FreeRTOS to be added to the parent CMake project post initialization of the Pico SDK (#497)

Co-authored-by: graham sanderson <graham.sanderson@raspeberryi.com>
3 years agoEnsure that xTaskGetCurrentTaskHandle is included (#507)
Gaurav-Aggarwal-AWS [Thu, 23 Jun 2022 17:17:17 +0000 (10:17 -0700)]
Ensure that xTaskGetCurrentTaskHandle is included (#507)

This commits adds a check that INCLUDE_xTaskGetCurrentTaskHandle is
set to 1. A compile time error message is produced if it is not set to
1. This is needed because stream_buffer.c uses xTaskGetCurrentTaskHandle.

This was reported here - https://forums.freertos.org/t/xstreambufferreceive-include-xtaskgetcur/15283

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoRP2040: Remove incorrect assertion (#508)
Graham Sanderson [Wed, 22 Jun 2022 17:27:26 +0000 (12:27 -0500)]
RP2040: Remove incorrect assertion (#508)

After the xEventGroupWaitBits in vProtLockInternalSpinUnlockWithWait there was an assertion about
pxYiledSpinLock being NULL, however when xEventGroupWaitBits returns, IRQs have been re-enabled
and so it is no longer safe to assert on the state which is protected by IRQs being disabled.

Co-authored-by: graham sanderson <graham.sanderson@raspeberryi.com>
3 years agoAdd configUSE_MUTEXES to function declarations in header (#504)
Gaurav-Aggarwal-AWS [Tue, 21 Jun 2022 10:34:52 +0000 (03:34 -0700)]
Add configUSE_MUTEXES to function declarations in header (#504)

This commit adds the configUSE_MUTEXES guard to the function
declarations in semphr.h which are only available when configUSE_MUTEXES
is set to 1.

It was reported here - https://forums.freertos.org/t/mutex-missing-reference-to-configuse-mutexes-on-the-online-documentation/15231

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd callback overrides for stream buffer and message buffers (#437)
Ravishankar Bhagavandas [Tue, 21 Jun 2022 00:48:34 +0000 (17:48 -0700)]
Add callback overrides for stream buffer and message buffers (#437)

* Let each stream/message can use its own sbSEND_COMPLETED

In FreeRTOS.h, set the default value of configUSE_SB_COMPLETED_CALLBACK
to zero, and add additional space for the function pointer when
the buffer created statically.

In stream_buffer.c, modify the macro of sbSEND_COMPLETED which let
the stream buffer to use its own implementation, and then add an
pointer to the stream buffer's structure, and modify the
implementation of the buffer creating and initializing

Co-authored-by: eddie9712 <qw1562435@gmail.com>
3 years agoUpdate feature_request.md (#500)
Tanmoy Sen [Wed, 8 Jun 2022 17:09:39 +0000 (10:09 -0700)]
Update feature_request.md (#500)

* Update feature_request.md

* Remove trailing spaces

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoadd extra check for compiler time (#499)
AndreiCherniaev [Thu, 2 Jun 2022 17:03:37 +0000 (21:03 +0400)]
add extra check for compiler time (#499)

minor change to add extra check for compiler time to prevent bad config

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
3 years agoAdd suppport for ARM CM55 (#494)
alfred gedeon [Wed, 1 Jun 2022 22:00:10 +0000 (00:00 +0200)]
Add suppport for ARM CM55 (#494)

* Add supposrt for ARM CM55

* Fix file header

* Remove duplicate code

* Refactor portmacro.h

1. portmacro.h is re-factored into 2 parts - portmacrocommon.h which is
   common to all ARMv8-M ports and portmacro.h which is different for
   different compiler and architecture. This enables us to provide
   Cortex-M55 ports without code duplication.
2. Update copy_files.py so that it copies Cortex-M55 ports correctly -
   all files except portmacro.h are used from Cortex-M33 ports.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAligned nullptr check for heap3. (#493)
Dusan Cervenka [Tue, 17 May 2022 16:56:01 +0000 (18:56 +0200)]
Aligned nullptr check for heap3. (#493)

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
3 years agoqueue.h: cTaskWokenByPost -> xTaskWokenByReceive (#491)
Robert Berger [Mon, 25 Apr 2022 21:11:51 +0000 (00:11 +0300)]
queue.h: cTaskWokenByPost -> xTaskWokenByReceive (#491)

Co-authored-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoFormat code, and rmove implicit tests (#489)
alfred gedeon [Thu, 21 Apr 2022 17:18:58 +0000 (10:18 -0700)]
Format code, and rmove implicit tests (#489)

3 years agoAdd atomic flag for 16-bit ticks PIC24 (#488)
Kody Stribrny [Fri, 15 Apr 2022 15:13:14 +0000 (08:13 -0700)]
Add atomic flag for 16-bit ticks PIC24 (#488)

This change allows the PIC24 family of
16 bit processors to read the tick count
without a critical section when the tick
count is 16 bits.

Inspired from discussion - https://forums.freertos.org/t/xtaskgettickcount-with-critical-section-on-16-bit-mcu/14860/5

3 years agoCorrected spelling mistake in mpu_prototypes.h
Anton Lagerholm [Thu, 14 Apr 2022 06:09:38 +0000 (08:09 +0200)]
Corrected spelling mistake in mpu_prototypes.h

tasks.h doesn't exist.

3 years agoCorrect spelling mistake in mpu_wrappers.h
Anton Lagerholm [Thu, 14 Apr 2022 06:05:42 +0000 (08:05 +0200)]
Correct spelling mistake in mpu_wrappers.h

tasks.h doesn't exist.

3 years agoDeclare vApplicationMallocFailedHook function in task.h instead in each C heap file...
pierrenoel-bouteville-act [Wed, 13 Apr 2022 17:44:14 +0000 (19:44 +0200)]
Declare vApplicationMallocFailedHook function in task.h instead in each C heap file (#483)

vApplicationMallocFailedHook was declared in each Heap file. which forces users to declare it and can cause problems if the prototype of the function changes.

Co-authored-by: Pierre-Noel Bouteville <pnb990@gmail.com>
3 years agoEnable use of --text-section-literals in Xtensa port (#485)
Archit Gupta [Mon, 11 Apr 2022 22:07:08 +0000 (15:07 -0700)]
Enable use of --text-section-literals in Xtensa port (#485)

Patch submitted by customer on forums here: https://forums.freertos.org/t/cannot-compile-xtensa-port-assembly-with-text-section-literals/14838

3 years agoAdd configSYSTICK_CLOCK_HZ to Cortex-M0 ports (#484)
Gaurav-Aggarwal-AWS [Fri, 8 Apr 2022 18:13:11 +0000 (23:43 +0530)]
Add configSYSTICK_CLOCK_HZ to Cortex-M0 ports (#484)

This is needed to support the case when SysTick timer is not clocked
from the same source as CPU. This support already exists in other
Cortex-M ports.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agotasks.c:2067:11: warning: this condition has identical branches [-Wduplicated-branche...
pierrenoel-bouteville-act [Wed, 6 Apr 2022 18:08:44 +0000 (20:08 +0200)]
tasks.c:2067:11: warning: this condition has identical branches [-Wduplicated-branches] (#482)

* replace duplicated if branch because empty by a comment to avoid warning/error with option GCC -Wduplicated-branches

* Missing ';'

* cosmetic comment

* update comment as suggested by Gaurav-Aggarwal-AWS

* cosmetic

Co-authored-by: Pierre-Noel Bouteville <pnb990@gmail.com>
3 years agoAdd a guard around mpu_wrappers.c (#480)
Gaurav-Aggarwal-AWS [Tue, 5 Apr 2022 17:29:30 +0000 (22:59 +0530)]
Add a guard around mpu_wrappers.c (#480)

* Add a guard around mpu_wrappers.c

This avoid linker errors when this file is accidently compiled in
projects using non-MPU ports.

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

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoUpdate portable/ThirdParty/README.md (#474)
Gaurav-Aggarwal-AWS [Fri, 11 Mar 2022 03:41:45 +0000 (19:41 -0800)]
Update portable/ThirdParty/README.md (#474)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agofix: add additional .ltorg directives to GCC CM3/CM4 mpu ports (#473)
niniemann [Thu, 10 Mar 2022 17:19:58 +0000 (18:19 +0100)]
fix: add additional .ltorg directives to GCC CM3/CM4 mpu ports (#473)

Co-authored-by: Nils Niemann <Niemann.N@eppendorf.de>
3 years agoUpdate the README to align with TF-M v1.5.0 in TF-M integration (#469)
xinyu-tfm [Sun, 6 Mar 2022 00:31:08 +0000 (08:31 +0800)]
Update the README to align with TF-M v1.5.0 in TF-M integration (#469)

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Ic04b82259ac17d5e0f8662118385c803e68af3e5

3 years agoCheck for add overflow only once (#467)
Gaurav-Aggarwal-AWS [Thu, 3 Mar 2022 23:16:39 +0000 (15:16 -0800)]
Check for add overflow only once (#467)

Update the size calculations such that we only need to check for add
overflow only once. Also, change the way we detect add overflow so that
we do not need to cause an overflow to detect an overflow.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoMove MSB check after final size calculation (#463)
Gaurav-Aggarwal-AWS [Mon, 28 Feb 2022 19:59:00 +0000 (11:59 -0800)]
Move MSB check after final size calculation (#463)

We use the MSB of the size member of a BlockLink_t to track whether not
a block is allocated. Consequently, the size must not be so large that
the MSB is set. The check to see if the MSB in the size is set needs to
be done after the final size (metadata + alignment) is calculated.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoHeap improvements (#462)
Gaurav-Aggarwal-AWS [Thu, 24 Feb 2022 18:52:10 +0000 (10:52 -0800)]
Heap improvements (#462)

* Heap improvements

This commit makes the following improvements:

1. Add a check to heap_2 to track if a memory block is allocated to the
   application or not. The MSB of the size field is used for this
   purpose. The same check already exists in heap_4 and heap_5. This
   check prevents against double free.

2. Add a new flag configHEAP_CLEAR_MEMORY_ON_FREE to heap_2, heap_4 and
   heap_5. The application writer can set it to 1 in their
   FreeRTOSConfig.h to ensure that a block of memory allocated using
   pvPortMalloc is cleared (i.e. set to zero) when it is freed using
   vPortFree. If left undefined, configHEAP_CLEAR_MEMORY_ON_FREE
   defaults to 0 for backward compatibility. We recommend setting
   configHEAP_CLEAR_MEMORY_ON_FREE to 1 for better security.

3. Add a new API pvPortCalloc to heap_2, heap_4 and heap_5. This API
   has the following signature:
   void * pvPortCalloc( size_t xNum, size_t xSize );
   It allocates memory for an array of xNum objects each of which is of
   xSize and initializes all bytes in the allocated storage to zero. If
   allocation succeeds, it returns a pointer to the lowest byte in the
   allocated memory block. On failure, it returns a null pointer.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoMigrated RL78/IAR port to EWRL78v3+ (#461)
Felipe Torrezan [Thu, 24 Feb 2022 17:04:46 +0000 (18:04 +0100)]
Migrated RL78/IAR port to EWRL78v3+ (#461)

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
3 years agoUpdate documentation of uxTaskGetTaskNumber function (#460)
Gaurav-Aggarwal-AWS [Tue, 22 Feb 2022 18:44:05 +0000 (10:44 -0800)]
Update documentation of uxTaskGetTaskNumber function (#460)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoCMake: Move mpu_wrapper to ports library. (#459)
imi415 [Tue, 22 Feb 2022 15:30:09 +0000 (00:30 +0900)]
CMake: Move mpu_wrapper to ports library. (#459)

3 years agoRemove exception loop tags. (#457)
Ming Yue [Thu, 17 Feb 2022 23:28:04 +0000 (15:28 -0800)]
Remove exception loop tags. (#457)

3 years agoUse a dedicated symbol for in-function loop to avoid the weak symbol JAL range error...
Ming Yue [Tue, 15 Feb 2022 22:56:13 +0000 (14:56 -0800)]
Use a dedicated symbol for in-function loop to avoid the weak symbol JAL range error when a strong symbol is defined outside. (#455)

3 years agoFix typo (#454)
mikisama [Sun, 13 Feb 2022 23:47:52 +0000 (07:47 +0800)]
Fix typo (#454)

3 years agoFix some warnings in doxygen comments (#453)
Muneeb Ahmed [Thu, 10 Feb 2022 19:36:42 +0000 (12:36 -0700)]
Fix some warnings in doxygen comments (#453)

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
3 years agoportable/Xtensa_ESP32: Add SPDX license identifiers (#452)
Shubham Kulkarni [Wed, 9 Feb 2022 00:28:07 +0000 (05:58 +0530)]
portable/Xtensa_ESP32: Add SPDX license identifiers (#452)

Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoAdd alignment for the direct mode handler (#449)
Gaurav-Aggarwal-AWS [Tue, 8 Feb 2022 19:51:25 +0000 (11:51 -0800)]
Add alignment for the direct mode handler (#449)

It is still possible to further relax the alignment using linker script
if needed.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd support for 16 MPU regions to GCC Cortex-M33 ports (#448)
Gaurav-Aggarwal-AWS [Tue, 8 Feb 2022 00:51:19 +0000 (16:51 -0800)]
Add support for 16 MPU regions to GCC Cortex-M33 ports (#448)

* Add support for 16 MPU regions to GCC Cortex-M33 TZ port

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Add support for 16 MPU regions to Cortex-M33 NTZ GCC port

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoUpdate History.txt to include 10.4.6 changes (#451)
Gaurav-Aggarwal-AWS [Tue, 8 Feb 2022 00:33:53 +0000 (16:33 -0800)]
Update History.txt to include 10.4.6 changes (#451)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoFix description of configQUEUE_REGISTRY_SIZE (#446)
Tobias Nießen [Mon, 31 Jan 2022 19:12:47 +0000 (20:12 +0100)]
Fix description of configQUEUE_REGISTRY_SIZE (#446)

3 years agoUpdate uncrustify configuration to 0.69 (#445)
swaldhoer [Fri, 28 Jan 2022 18:48:03 +0000 (19:48 +0100)]
Update uncrustify configuration to 0.69 (#445)

The configuration was updated using

    uncrustify -c .github/uncrustify.cfg -o .github/uncrustify.cfg --update-config-with-doc

to align with the actually used uncrustify version used, i.e., all
configuration is now explicitly set (and no longer implicit).

The files that are common to all ports ("portable/MemMang*" and
"portable/Common/mpu_wrappers.c" are now also autoformatted.

Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
3 years agoRiscv re-factoring (#444)
Gaurav-Aggarwal-AWS [Thu, 27 Jan 2022 01:55:01 +0000 (17:55 -0800)]
Riscv re-factoring (#444)

* Refactor RISCV port

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Changes to make re-factoring work on ESP32-C3

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Remove alignment and place handlers in separate sections

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Correct section names

This is needed so that the assemblers correctly recognizes functions.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Move mtvec programming to the application

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Refactor mtimer udpate code

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
* Move critical nesting to port layer

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

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

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoFix warning message error. (#443)
isus-ipanienko [Fri, 21 Jan 2022 18:10:22 +0000 (19:10 +0100)]
Fix warning message error. (#443)

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
3 years agoAdd CMake build (#421)
yhsb2k [Thu, 20 Jan 2022 20:35:04 +0000 (22:35 +0200)]
Add CMake build (#421)

* Add CMake build

Allows to build and link FreeRTOS using CMake build system.
From top-level project it looks like this:

set(FREERTOS_PORT_GCC_ARM_CM4F ON)
set(FREERTOS_CONFIG_FILE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "")
add_subdirectory(third_party/FreeRTOS-Kernel)

Where FREERTOS_PORT_GCC_ARM_CM4F is FreeRTOS port name.
freertos is target name, which can be used in target_link_libraries()

* Add feature to set custom heap source file

Example how to set it from top-level project:
set(FREERTOS_HEAP ${CMAKE_CURRENT_LIST_DIR}/path_to/my_heap.c CACHE STRING "")

* Set cmake_minimum_required to 3.15

* Fail build when FREERTOS_CONFIG_FILE_DIRECTORY not set

* Rename library to freertos_kernel

* Rework FREERTOS_PORT option to act as combobox

* Use freertos_kernel_port cmake target

* Split port sources multiline

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
Co-authored-by: Paul Bartell <pbartell@amazon.com>
3 years agoAdd configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type...
Paul Bartell [Wed, 19 Jan 2022 21:12:57 +0000 (13:12 -0800)]
Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. (#433)

* Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type.

When configUSE_MINI_LIST_ITEM == 0:
MiniListItem_t and ListItem_t are both typedefs of struct xLIST_ITEM.

When configUSE_MINI_LIST_ITEM == 1 (the default in projdefs.h):
MiniListItem_t is a typedef of struct xMINI_LIST_ITEM, which contains 3 fewer fields than a struct xLIST_ITEM.
This configuration saves approximately sizeof(TickType_t) + 2 * sizeof( void * ) bytes of ram, however it also violates strict aliasing rules which some compilers depend on for optimization.

configUSE_MINI_LIST_ITEM defaults to 1 when not defined.

* Add pp_indent_brace option to uncrustify config

Improves compliance with the FreeRTOS code style guide:
https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html

3 years agoFix GCC/RX100 function naming error. (#440)
Ming Yue [Thu, 13 Jan 2022 18:30:26 +0000 (10:30 -0800)]
Fix GCC/RX100 function naming error. (#440)

3 years agoFix support for stepping tick by xExpectedIdleTime (#73)
Jeff Tenney [Mon, 10 Jan 2022 19:44:12 +0000 (12:44 -0700)]
Fix support for stepping tick by xExpectedIdleTime (#73)

* Fix support for stepping maximum number of ticks

This commit fixes support for tickless implementations that call
vTaskStepTick() with the maximum number of allowed ticks to step.

vTaskStepTick()
---------------
Function vTaskStepTick() provides a way for the tickless idle
implementation to account for ticks that elapse during tickless idle.
The maximum number of stepped ticks allowed is the number passed to
portSUPPRESS_TICKS_AND_SLEEP().  It is the number of ticks between
xTickCount and xNextTaskUnblockTime.

vTaskStepTick() is specifically intended for use with tickless idle,
so it always executes with the scheduler disabled.  For reference,
compare it with the more general function xTaskCatchUpTicks().

Without this Change
-------------------
Prior to this commit, if a task is supposed to wake at xTickCount ==
0xFFFFFFFF, then when tickless idle ends, function vTaskStepTick()
sets the tick to 0xFFFFFFFF but the task remains on the delayed list
because xTaskIncrementTick() does not execute.  One tick later,
xTaskIncrementTick() executes because it's time to increment xTickCount
to 0x00000000.  An assertion failure occurs in
taskSWITCH_DELAYED_LISTS() because the delayed task list is not
empty.  Other examples of valling vTaskStepTick() with the maximum
allowed number of ticks merely result in a task waking one tick late.

Default Tickless Implementations
--------------------------------
Note that the default tickless implementations never pass the maximum
allowed value to vTaskStepTick().  The default implementations use the
tick interrupt to finish the sleep and allow that one tick to be
counted normally via the tick ISR and xTaskIncrementTick().

* Protect xPendedTicks with critical section

Function xTaskIncrementTick() increments xPendedTicks when the
scheduler is disabled.  That function typically executes inside the tick
ISR.  So code in xTaskCatchUpTicks() must mask interrupts when modifying
xPendedTicks.

* uncrustify tasks.c

* Update tasks.c

Style changes only - added comment and indentation to the two modified files.

* uncrustify

* Add test coverage for new conditional

* Add typecast

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com>
3 years agoClean some spell check words. (#439)
Jon Enz [Fri, 7 Jan 2022 18:45:58 +0000 (10:45 -0800)]
Clean some spell check words. (#439)

3 years agoFeature: Add task top/end of stack to task info report (#436)
Joseph Julicher [Thu, 6 Jan 2022 19:03:56 +0000 (12:03 -0700)]
Feature: Add task top/end of stack to task info report (#436)

uncrustify

Co-authored-by: Shreyas Balakrishna <shreyasbharath@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
3 years agoAdd a cap to the queue locks (#435)
Gaurav-Aggarwal-AWS [Thu, 6 Jan 2022 05:14:01 +0000 (21:14 -0800)]
Add a cap to the queue locks (#435)

Add a cap to the queue locks

cRxLock and cTxLock members of the queue data structure count the
number items received and sent to the queue while the queue was locked.
These are later used to unblock tasks waiting on the queue when the
queue is unlocked. The data type of these members is int8_t and this can
trigger overflow check assert if an ISR continuously reads/writes to the
queue in a loop as reported in this issue: https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/419.

Note due to the length of the operation is it not recommended to write to
the queue that many times from an ISR - stream buffers are a better option,
or alternatively, defer the operation to a task by just having the ISR send a
direct to task notification to unblock the task.

This PR caps the values of the cRxLock and cTxLock to the number of tasks in
the system because we cannot unblocks more tasks than there are in the system.
Note that the same assert could still be triggered is the application creates more
than 127 tasks.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
3 years agoAdd a Known Issues file in the Third Party folder (#434)
Gaurav-Aggarwal-AWS [Mon, 3 Jan 2022 21:26:43 +0000 (13:26 -0800)]
Add a Known Issues file in the Third Party folder (#434)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agofix alignment exception for ullPortInterruptNesting. (#317)
Amit Tomar [Wed, 29 Dec 2021 20:53:10 +0000 (02:23 +0530)]
fix alignment exception for ullPortInterruptNesting. (#317)

* fix alignment exception for ullPortInterruptNesting.

While loading (LDR X5, ullPortInterruptNestingConst) the ullPortInterruptNesting
variable, the program control seems to be stuck and there is no abort or stack
trace observed (as there is no exception handler is installed to catch unaligned
access exception).

Program control moves forward, if one just declares this varible to be 2 bytes
aligned but then varible is not updated properly.

One of my colleague, pointed out that issue is due to the fact that
ullPortInterruptNesting must be at 8 bytes aligned address but since
"vApplicationIRQHandler" (that has 4 bytes of address) is sitting between
two 8 bytes aligned addresses that forces ullPortInterruptNesting to be at
4 byte aligned address, causing all sort of mess.

It works on QEMU (on ARM64) as it is, since there is no such check for
unaligned access but on real hardware it is prohibited.

Workaround to this problem is, either we skip 4 byets (using .align 4) after
vApplicationIRQHandler declaration or declare it the end of all declarations.
This commit does the latter one.

Signed-off-by: Amit Singh Tomar <atomar25opensource@gmail.com>
* Update portASM.S

Remove 1 tab = 4 spaces

Co-authored-by: Amit Singh Tomar <atomar25opensource@gmail.com>
Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
4 years agofixed deadlock in event groups when a mutex is used for memory allocation (#284)
clemenskresser [Wed, 29 Dec 2021 16:58:24 +0000 (17:58 +0100)]
fixed deadlock in event groups when a mutex is used for memory allocation (#284)

Co-authored-by: Clemens Kresser <clemens.kresser@gmail.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
4 years agoDocumentation update for xEventGroupClearBitsFromISR (#432)
Joseph Julicher [Tue, 28 Dec 2021 21:20:33 +0000 (14:20 -0700)]
Documentation update for xEventGroupClearBitsFromISR (#432)

* Documented the correct use of xEventGroupClearBitsFromISR

* removed typo

4 years agoRISC-V: No #error on RV64 regarding byte alignment (#367)
Fabian [Tue, 28 Dec 2021 19:52:33 +0000 (20:52 +0100)]
RISC-V: No #error on RV64 regarding byte alignment (#367)

Co-authored-by: Joseph Julicher <jjulicher@mac.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
4 years agoFix: Interrut Handler Register Function and Exception Process (#41)
leona [Tue, 28 Dec 2021 17:54:23 +0000 (02:54 +0900)]
Fix: Interrut Handler Register Function and Exception Process (#41)

Signed-off-by: shiode <shiode@aptpod.co.jp>
Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
Co-authored-by: David Chalco <59750547+dachalco@users.noreply.github.com>
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
4 years agouxAutoReload replaced with xAutoReload to improve MISRA compliance (#429)
Joseph Julicher [Mon, 27 Dec 2021 18:36:59 +0000 (11:36 -0700)]
uxAutoReload replaced with xAutoReload to improve MISRA compliance (#429)

* Created xTimerGetReloadMode and uxTimerGetReloadMode.

* Changed the use of uxAutoReload to xAutoReload

* updated history.txt

* Update History.txt

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
* Update timers.c

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
* Added xTimerGetReloadMode to lexicon.txt

* uncrustified timers.c

* Fix formatting check

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>
4 years agoUpdate third party ports readme (#428)
Gaurav-Aggarwal-AWS [Tue, 21 Dec 2021 22:10:06 +0000 (14:10 -0800)]
Update third party ports readme (#428)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agoRP2040 fixes (#424)
Graham Sanderson [Tue, 21 Dec 2021 19:08:41 +0000 (13:08 -0600)]
RP2040 fixes (#424)

* RP2040: malloc needs to be thread safe for FreeRTOS whether both cores are used or not

* RP2040: CMake file had broken left over test code

* RP2040: portIS_FREE_RTOS_CORE() returned an incorrect value prior to scheduler init when the application was compiled without multicore support

* RP2040: Bad initialization code was causing IRQs to get disabled before main() was called when using non static allocation

4 years agoRemove tickless idle mode dependency with include v task suspend (#422)
Pramith K V [Wed, 8 Dec 2021 23:47:07 +0000 (05:17 +0530)]
Remove tickless idle mode dependency with include v task suspend (#422)

* Fix Remove tickless idle feature dependency with INCLUDE_vTaskSuspend
* fix unused variable warning
* Fix CI fomatting check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Authored-by: pramithkv <pramit@lifesignals.com>
4 years agoFix #415: Compiling tasks.c with configSUPPORT_DYNAMIC_ALLOCATION = 0 (#416)
R. Dunbar Poor [Thu, 18 Nov 2021 22:38:41 +0000 (14:38 -0800)]
Fix #415: Compiling tasks.c with configSUPPORT_DYNAMIC_ALLOCATION = 0 (#416)

* Fix #415: Compiling tasks.c with configSUPPORT_DYNAMIC_ALLOCATION = 0

4 years agoSimplify prvInitialiseNewTask() (#417)
RichardBarry [Thu, 18 Nov 2021 22:22:02 +0000 (14:22 -0800)]
Simplify prvInitialiseNewTask() (#417)

Memset newly allocated TCB structures to zero, and remove code
that set individual structure members to zero.

4 years agoFix keil compilation error (#418)
RichardBarry [Thu, 18 Nov 2021 19:04:57 +0000 (11:04 -0800)]
Fix keil compilation error (#418)

* Fix compilation error when using the Keil tools with the Keil compiler.

4 years agoFix formatting error
Gaurav Aggarwal [Fri, 12 Nov 2021 23:23:07 +0000 (23:23 +0000)]
Fix formatting error

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agoAdd option to disable unprivileged critical sections
Gaurav Aggarwal [Thu, 7 Oct 2021 02:00:39 +0000 (19:00 -0700)]
Add option to disable unprivileged critical sections

This commit introduces a new config
configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS which enables developers to
prevent critical sections from unprivileged tasks. It defaults to 1 for
backward compatibility. Application should set it to 0 to disable
critical sections from unprivileged tasks.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agoChange xPortRaisePrivilege and vPortResetPrivilege to macros
Gaurav Aggarwal [Thu, 7 Oct 2021 01:56:51 +0000 (18:56 -0700)]
Change xPortRaisePrivilege and vPortResetPrivilege to macros

This prevents non-kernel code from calling these functions.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agoFix code example in timers.h (#412)
Gaurav-Aggarwal-AWS [Fri, 12 Nov 2021 18:36:49 +0000 (10:36 -0800)]
Fix code example in timers.h (#412)

The example was trying to create a timer with period 0 which is not a
valid period.

This was reported here - https://forums.freertos.org/t/multiple-timers/13884

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agobugfix: Initialize uxTaskNumber at task initialization (#374)
Laukik Hase [Thu, 11 Nov 2021 22:17:21 +0000 (03:47 +0530)]
bugfix: Initialize uxTaskNumber at task initialization (#374)

* bugfix: Initialize uxTaskNumber at task initialization

4 years agoMention portMAX_DELAY in xEventGroupWaitBits docs (#411)
Tobias Nießen [Thu, 11 Nov 2021 01:39:01 +0000 (02:39 +0100)]
Mention portMAX_DELAY in xEventGroupWaitBits docs (#411)

The public function xEventGroupWaitBits passes xTicksToWait to the
function vTaskPlaceOnUnorderedEventList, which passes the number of
ticks to prvAddCurrentTaskToDelayedList and sets xCanBlockIndefinitely
to pdTRUE, causing the latter to block indefinitely if
xTicksToWait == portMAX_DELAY and INCLUDE_vTaskSuspend == 1.

4 years agoBuild with -Wmissing-prototypes flags vPortYieldFromISR() in the Posix port. (#409)
Kevin Thibedeau [Mon, 8 Nov 2021 21:51:25 +0000 (16:51 -0500)]
Build with -Wmissing-prototypes flags vPortYieldFromISR() in the Posix port. (#409)

There's already a portYIELD_FROM_ISR() macro that calls vPortYield() which wraps the FromISR code.
It doesn't appear that vPortYieldFromISR() is intended to be publicly accessible in this port so
I've marked it as private to silence the warning.

event_create() also got flagged due to missing void in prototype.

Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
4 years agoChange hyphen to ASCII character (#410)
Gaurav-Aggarwal-AWS [Mon, 8 Nov 2021 19:11:11 +0000 (11:11 -0800)]
Change hyphen to ASCII character (#410)

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
4 years agoChange taskYIELD_FROM_ISR to portYIELD_FROM_ISR in docs (#408)
Gaurav-Aggarwal-AWS [Fri, 5 Nov 2021 21:33:15 +0000 (14:33 -0700)]
Change taskYIELD_FROM_ISR to portYIELD_FROM_ISR in docs (#408)

4 years agoFix documentation mistake (#407)
prplz [Fri, 5 Nov 2021 17:55:17 +0000 (04:55 +1100)]
Fix documentation mistake (#407)

ulTaskNotification -> ulTaskNotify

4 years agobugfix: Initialise stack correctly on dsPIC port (#405)
andrewtjs [Mon, 1 Nov 2021 19:38:37 +0000 (03:38 +0800)]
bugfix: Initialise stack correctly on dsPIC port (#405)

* Use compiler predefined constants.

Use of MPLAB_DSPIC_PORT is deprecated.

4 years agoFix prvWriteMessageToBuffer on big endian (#391)
Archit Gupta [Sat, 16 Oct 2021 23:36:44 +0000 (16:36 -0700)]
Fix prvWriteMessageToBuffer on big endian (#391)

prvWriteMessageToBuffer wrote the first sbBYTES_TO_STORE_MESSAGE_LENGTH
bytes of the size_t-typed length to the buffer as the data length. While
this functions on little endian, it copies the wrong bytes on big
endian. This fix converts the length to configMESSAGE_BUFFER_LENGTH_TYPE
first, and then copies the exact amount, thus fixing the issue.
Additionally it adds an assert to verify the size is not greater than
the max value of configMESSAGE_BUFFER_LENGTH_TYPE; previously this would
truncate silently.

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