Skip to content

Commit

Permalink
Merge branch 'main' into clear-pending-signals
Browse files Browse the repository at this point in the history
  • Loading branch information
johnboiles authored Jan 29, 2025
2 parents 2fcb0ad + ad4e723 commit 0e644d3
Show file tree
Hide file tree
Showing 43 changed files with 797 additions and 294 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/kernel-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,25 @@ jobs:
with:
path: ./FreeRTOS/Source

- name: Install MSP430 Toolchain
- env:
stepName: Install MSP430 Toolchain
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install gcc-msp430 build-essential
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
curl -L -O https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
sudo apt update -y
sudo apt install -y p7zip-full
7z x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
chmod +x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run
sudo ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run --prefix /usr/bin/msp430-gcc --mode unattended
echo "::endgroup::"
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
- name: Build msp430_GCC Demo
shell: bash
working-directory: FreeRTOS/Demo/msp430_GCC
run: make -j
run: make -j CC=/usr/bin/msp430-gcc/bin/msp430-elf-gcc OPT="-Os -I/usr/bin/msp430-gcc/include -L/usr/bin/msp430-gcc/include"

MicroBlaze-GCC:
name: GCC MicroBlaze Toolchain
Expand Down Expand Up @@ -259,12 +268,12 @@ jobs:
fetch-depth: 1

- env:
stepName: Fetch Community-Supported-Demos Submodule
stepName: Fetch Dependencies
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
# Checkout user pull request changes
Expand Down
19 changes: 19 additions & 0 deletions MISRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,25 @@ _Ref 11.5.5_
because data storage buffers are implemented as uint8_t arrays for the
ease of sizing, alignment and access.

#### Rule 14.3

MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.

_Ref 14.3_
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` are
evaluated to constants at compile time and may vary based on the build
configuration.

#### Rule 18.1

MISRA C-2012 Rule 18.1: A pointer resulting from arithmetic on a pointer operand
shall address an element of the same array as that pointer operand.

_Ref 18.1_
- Array access remains within bounds since either the null terminator in
the IDLE task name will break the loop, or the loop will break normally
if the array size is smaller than the IDLE task name length.

#### Rule 21.6

MISRA C-2012 Rule 21.6: The Standard Library input/output functions shall not
Expand Down
8 changes: 8 additions & 0 deletions include/FreeRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,14 @@
#define traceRETURN_xQueueCreateSet( pxQueue )
#endif

#ifndef traceENTER_xQueueCreateSetStatic
#define traceENTER_xQueueCreateSetStatic( uxEventQueueLength )
#endif

#ifndef traceRETURN_xQueueCreateSetStatic
#define traceRETURN_xQueueCreateSetStatic( pxQueue )
#endif

#ifndef traceENTER_xQueueAddToSet
#define traceENTER_xQueueAddToSet( xQueueOrSemaphore, xQueueSet )
#endif
Expand Down
60 changes: 30 additions & 30 deletions include/message_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
* writer and reader to be different tasks or interrupts, but, unlike other
* FreeRTOS objects, it is not safe to have multiple different writers or
* multiple different readers. If there are to be multiple different writers
* then the application writer must place each call to a writing API function
* (such as xMessageBufferSend()) inside a critical section and set the send
* block time to 0. Likewise, if there are to be multiple different readers
* then the application writer must place each call to a reading API function
* (such as xMessageBufferRead()) inside a critical section and set the receive
* timeout to 0.
* then the application writer must serialize calls to writing API functions
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
* different readers then the application writer must serialize calls to reading
* API functions (such as xStreamBufferReceive()). One way to achieve such
* serialization in single core or SMP kernel is to place each API call inside a
* critical section and use a block time of 0.
*
* Message buffers hold variable length messages. To enable that, when a
* message is written to the message buffer an additional sizeof( size_t ) bytes
Expand Down Expand Up @@ -306,12 +306,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
* writer and reader to be different tasks or interrupts, but, unlike other
* FreeRTOS objects, it is not safe to have multiple different writers or
* multiple different readers. If there are to be multiple different writers
* then the application writer must place each call to a writing API function
* (such as xMessageBufferSend()) inside a critical section and set the send
* block time to 0. Likewise, if there are to be multiple different readers
* then the application writer must place each call to a reading API function
* (such as xMessageBufferRead()) inside a critical section and set the receive
* block time to 0.
* then the application writer must serialize calls to writing API functions
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
* different readers then the application writer must serialize calls to reading
* API functions (such as xStreamBufferReceive()). One way to achieve such
* serialization in single core or SMP kernel is to place each API call inside a
* critical section and use a block time of 0.
*
* Use xMessageBufferSend() to write to a message buffer from a task. Use
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
Expand Down Expand Up @@ -409,12 +409,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
* writer and reader to be different tasks or interrupts, but, unlike other
* FreeRTOS objects, it is not safe to have multiple different writers or
* multiple different readers. If there are to be multiple different writers
* then the application writer must place each call to a writing API function
* (such as xMessageBufferSend()) inside a critical section and set the send
* block time to 0. Likewise, if there are to be multiple different readers
* then the application writer must place each call to a reading API function
* (such as xMessageBufferRead()) inside a critical section and set the receive
* block time to 0.
* then the application writer must serialize calls to writing API functions
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
* different readers then the application writer must serialize calls to reading
* API functions (such as xStreamBufferReceive()). One way to achieve such
* serialization in single core or SMP kernel is to place each API call inside a
* critical section and use a block time of 0.
*
* Use xMessageBufferSend() to write to a message buffer from a task. Use
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
Expand Down Expand Up @@ -516,12 +516,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
* writer and reader to be different tasks or interrupts, but, unlike other
* FreeRTOS objects, it is not safe to have multiple different writers or
* multiple different readers. If there are to be multiple different writers
* then the application writer must place each call to a writing API function
* (such as xMessageBufferSend()) inside a critical section and set the send
* block time to 0. Likewise, if there are to be multiple different readers
* then the application writer must place each call to a reading API function
* (such as xMessageBufferRead()) inside a critical section and set the receive
* block time to 0.
* then the application writer must serialize calls to writing API functions
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
* different readers then the application writer must serialize calls to reading
* API functions (such as xStreamBufferReceive()). One way to achieve such
* serialization in single core or SMP kernel is to place each API call inside a
* critical section and use a block time of 0.
*
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
* xMessageBufferReceiveFromISR() to read from a message buffer from an
Expand Down Expand Up @@ -610,12 +610,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
* writer and reader to be different tasks or interrupts, but, unlike other
* FreeRTOS objects, it is not safe to have multiple different writers or
* multiple different readers. If there are to be multiple different writers
* then the application writer must place each call to a writing API function
* (such as xMessageBufferSend()) inside a critical section and set the send
* block time to 0. Likewise, if there are to be multiple different readers
* then the application writer must place each call to a reading API function
* (such as xMessageBufferRead()) inside a critical section and set the receive
* block time to 0.
* then the application writer must serialize calls to writing API functions
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
* different readers then the application writer must serialize calls to reading
* API functions (such as xStreamBufferReceive()). One way to achieve such
* serialization in single core or SMP kernel is to place each API call inside a
* critical section and use a block time of 0.
*
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
* xMessageBufferReceiveFromISR() to read from a message buffer from an
Expand Down
6 changes: 6 additions & 0 deletions include/mpu_prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
StaticQueue_t * pxStaticQueue,
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) FREERTOS_SYSTEM_CALL;
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
uint8_t * pucQueueStorage,
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
Expand All @@ -294,6 +297,9 @@ uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
StaticQueue_t * pxStaticQueue,
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
uint8_t * pucQueueStorage,
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
Expand Down
1 change: 1 addition & 0 deletions include/mpu_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
#define xQueueGenericReset MPU_xQueueGenericReset
#define xQueueCreateSet MPU_xQueueCreateSet
#define xQueueCreateSetStatic MPU_xQueueCreateSetStatic
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet

#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
Expand Down
74 changes: 67 additions & 7 deletions include/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -1638,12 +1638,12 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
* function.
*
* A queue set must be explicitly created using a call to xQueueCreateSet()
* before it can be used. Once created, standard FreeRTOS queues and semaphores
* can be added to the set using calls to xQueueAddToSet().
* xQueueSelectFromSet() is then used to determine which, if any, of the queues
* or semaphores contained in the set is in a state where a queue read or
* semaphore take operation would be successful.
* A queue set must be explicitly created using a call to xQueueCreateSet() or
* xQueueCreateSetStatic() before it can be used. Once created, standard
* FreeRTOS queues and semaphores can be added to the set using calls to
* xQueueAddToSet(). xQueueSelectFromSet() is then used to determine which, if
* any, of the queues or semaphores contained in the set is in a state where a
* queue read or semaphore take operation would be successful.
*
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
* for reasons why queue sets are very rarely needed in practice as there are
Expand Down Expand Up @@ -1683,9 +1683,69 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
#endif

/*
* Queue sets provide a mechanism to allow a task to block (pend) on a read
* operation from multiple queues or semaphores simultaneously.
*
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
* function.
*
* A queue set must be explicitly created using a call to xQueueCreateSet()
* or xQueueCreateSetStatic() before it can be used. Once created, standard
* FreeRTOS queues and semaphores can be added to the set using calls to
* xQueueAddToSet(). xQueueSelectFromSet() is then used to determine which, if
* any, of the queues or semaphores contained in the set is in a state where a
* queue read or semaphore take operation would be successful.
*
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
* for reasons why queue sets are very rarely needed in practice as there are
* simpler methods of blocking on multiple objects.
*
* Note 2: Blocking on a queue set that contains a mutex will not cause the
* mutex holder to inherit the priority of the blocked task.
*
* Note 3: An additional 4 bytes of RAM is required for each space in a every
* queue added to a queue set. Therefore counting semaphores that have a high
* maximum count value should not be added to a queue set.
*
* Note 4: A receive (in the case of a queue) or take (in the case of a
* semaphore) operation must not be performed on a member of a queue set unless
* a call to xQueueSelectFromSet() has first returned a handle to that set member.
*
* @param uxEventQueueLength Queue sets store events that occur on
* the queues and semaphores contained in the set. uxEventQueueLength specifies
* the maximum number of events that can be queued at once. To be absolutely
* certain that events are not lost uxEventQueueLength should be set to the
* total sum of the length of the queues added to the set, where binary
* semaphores and mutexes have a length of 1, and counting semaphores have a
* length set by their maximum count value. Examples:
* + If a queue set is to hold a queue of length 5, another queue of length 12,
* and a binary semaphore, then uxEventQueueLength should be set to
* (5 + 12 + 1), or 18.
* + If a queue set is to hold three binary semaphores then uxEventQueueLength
* should be set to (1 + 1 + 1 ), or 3.
* + If a queue set is to hold a counting semaphore that has a maximum count of
* 5, and a counting semaphore that has a maximum count of 3, then
* uxEventQueueLength should be set to (5 + 3), or 8.
*
* @param pucQueueStorage pucQueueStorage must point to a uint8_t array that is
* at least large enough to hold uxEventQueueLength events.
*
* @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
* will be used to hold the queue's data structure.
*
* @return If the queue set is created successfully then a handle to the created
* queue set is returned. If pxQueueBuffer is NULL then NULL is returned.
*/
#if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
QueueSetHandle_t xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
uint8_t * pucQueueStorage,
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
#endif

/*
* Adds a queue or semaphore to a queue set that was previously created by a
* call to xQueueCreateSet().
* call to xQueueCreateSet() or xQueueCreateSetStatic().
*
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
* function.
Expand Down
Loading

0 comments on commit 0e644d3

Please sign in to comment.