Skip to content

Commit 0e644d3

Browse files
authored
Merge branch 'main' into clear-pending-signals
2 parents 2fcb0ad + ad4e723 commit 0e644d3

File tree

43 files changed

+797
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+797
-294
lines changed

.github/workflows/kernel-demos.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,25 @@ jobs:
150150
with:
151151
path: ./FreeRTOS/Source
152152

153-
- name: Install MSP430 Toolchain
153+
- env:
154+
stepName: Install MSP430 Toolchain
154155
shell: bash
155156
run: |
156-
sudo apt-get -y update
157-
sudo apt-get -y install gcc-msp430 build-essential
157+
# ${{ env.stepName }}
158+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
159+
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
160+
sudo apt update -y
161+
sudo apt install -y p7zip-full
162+
7z x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
163+
chmod +x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run
164+
sudo ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run --prefix /usr/bin/msp430-gcc --mode unattended
165+
echo "::endgroup::"
166+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
158167
159168
- name: Build msp430_GCC Demo
160169
shell: bash
161170
working-directory: FreeRTOS/Demo/msp430_GCC
162-
run: make -j
171+
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"
163172

164173
MicroBlaze-GCC:
165174
name: GCC MicroBlaze Toolchain
@@ -259,12 +268,12 @@ jobs:
259268
fetch-depth: 1
260269

261270
- env:
262-
stepName: Fetch Community-Supported-Demos Submodule
271+
stepName: Fetch Dependencies
263272
shell: bash
264273
run: |
265274
# ${{ env.stepName }}
266275
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
267-
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
276+
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace
268277
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
269278
270279
# Checkout user pull request changes

MISRA.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ _Ref 11.5.5_
115115
because data storage buffers are implemented as uint8_t arrays for the
116116
ease of sizing, alignment and access.
117117

118+
#### Rule 14.3
119+
120+
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
121+
122+
_Ref 14.3_
123+
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` are
124+
evaluated to constants at compile time and may vary based on the build
125+
configuration.
126+
127+
#### Rule 18.1
128+
129+
MISRA C-2012 Rule 18.1: A pointer resulting from arithmetic on a pointer operand
130+
shall address an element of the same array as that pointer operand.
131+
132+
_Ref 18.1_
133+
- Array access remains within bounds since either the null terminator in
134+
the IDLE task name will break the loop, or the loop will break normally
135+
if the array size is smaller than the IDLE task name length.
136+
118137
#### Rule 21.6
119138

120139
MISRA C-2012 Rule 21.6: The Standard Library input/output functions shall not

include/FreeRTOS.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,14 @@
14841484
#define traceRETURN_xQueueCreateSet( pxQueue )
14851485
#endif
14861486

1487+
#ifndef traceENTER_xQueueCreateSetStatic
1488+
#define traceENTER_xQueueCreateSetStatic( uxEventQueueLength )
1489+
#endif
1490+
1491+
#ifndef traceRETURN_xQueueCreateSetStatic
1492+
#define traceRETURN_xQueueCreateSetStatic( pxQueue )
1493+
#endif
1494+
14871495
#ifndef traceENTER_xQueueAddToSet
14881496
#define traceENTER_xQueueAddToSet( xQueueOrSemaphore, xQueueSet )
14891497
#endif

include/message_buffer.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
* writer and reader to be different tasks or interrupts, but, unlike other
4444
* FreeRTOS objects, it is not safe to have multiple different writers or
4545
* multiple different readers. If there are to be multiple different writers
46-
* then the application writer must place each call to a writing API function
47-
* (such as xMessageBufferSend()) inside a critical section and set the send
48-
* block time to 0. Likewise, if there are to be multiple different readers
49-
* then the application writer must place each call to a reading API function
50-
* (such as xMessageBufferRead()) inside a critical section and set the receive
51-
* timeout to 0.
46+
* then the application writer must serialize calls to writing API functions
47+
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
48+
* different readers then the application writer must serialize calls to reading
49+
* API functions (such as xStreamBufferReceive()). One way to achieve such
50+
* serialization in single core or SMP kernel is to place each API call inside a
51+
* critical section and use a block time of 0.
5252
*
5353
* Message buffers hold variable length messages. To enable that, when a
5454
* message is written to the message buffer an additional sizeof( size_t ) bytes
@@ -306,12 +306,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
306306
* writer and reader to be different tasks or interrupts, but, unlike other
307307
* FreeRTOS objects, it is not safe to have multiple different writers or
308308
* multiple different readers. If there are to be multiple different writers
309-
* then the application writer must place each call to a writing API function
310-
* (such as xMessageBufferSend()) inside a critical section and set the send
311-
* block time to 0. Likewise, if there are to be multiple different readers
312-
* then the application writer must place each call to a reading API function
313-
* (such as xMessageBufferRead()) inside a critical section and set the receive
314-
* block time to 0.
309+
* then the application writer must serialize calls to writing API functions
310+
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
311+
* different readers then the application writer must serialize calls to reading
312+
* API functions (such as xStreamBufferReceive()). One way to achieve such
313+
* serialization in single core or SMP kernel is to place each API call inside a
314+
* critical section and use a block time of 0.
315315
*
316316
* Use xMessageBufferSend() to write to a message buffer from a task. Use
317317
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
@@ -409,12 +409,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
409409
* writer and reader to be different tasks or interrupts, but, unlike other
410410
* FreeRTOS objects, it is not safe to have multiple different writers or
411411
* multiple different readers. If there are to be multiple different writers
412-
* then the application writer must place each call to a writing API function
413-
* (such as xMessageBufferSend()) inside a critical section and set the send
414-
* block time to 0. Likewise, if there are to be multiple different readers
415-
* then the application writer must place each call to a reading API function
416-
* (such as xMessageBufferRead()) inside a critical section and set the receive
417-
* block time to 0.
412+
* then the application writer must serialize calls to writing API functions
413+
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
414+
* different readers then the application writer must serialize calls to reading
415+
* API functions (such as xStreamBufferReceive()). One way to achieve such
416+
* serialization in single core or SMP kernel is to place each API call inside a
417+
* critical section and use a block time of 0.
418418
*
419419
* Use xMessageBufferSend() to write to a message buffer from a task. Use
420420
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
@@ -516,12 +516,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
516516
* writer and reader to be different tasks or interrupts, but, unlike other
517517
* FreeRTOS objects, it is not safe to have multiple different writers or
518518
* multiple different readers. If there are to be multiple different writers
519-
* then the application writer must place each call to a writing API function
520-
* (such as xMessageBufferSend()) inside a critical section and set the send
521-
* block time to 0. Likewise, if there are to be multiple different readers
522-
* then the application writer must place each call to a reading API function
523-
* (such as xMessageBufferRead()) inside a critical section and set the receive
524-
* block time to 0.
519+
* then the application writer must serialize calls to writing API functions
520+
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
521+
* different readers then the application writer must serialize calls to reading
522+
* API functions (such as xStreamBufferReceive()). One way to achieve such
523+
* serialization in single core or SMP kernel is to place each API call inside a
524+
* critical section and use a block time of 0.
525525
*
526526
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
527527
* xMessageBufferReceiveFromISR() to read from a message buffer from an
@@ -610,12 +610,12 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
610610
* writer and reader to be different tasks or interrupts, but, unlike other
611611
* FreeRTOS objects, it is not safe to have multiple different writers or
612612
* multiple different readers. If there are to be multiple different writers
613-
* then the application writer must place each call to a writing API function
614-
* (such as xMessageBufferSend()) inside a critical section and set the send
615-
* block time to 0. Likewise, if there are to be multiple different readers
616-
* then the application writer must place each call to a reading API function
617-
* (such as xMessageBufferRead()) inside a critical section and set the receive
618-
* block time to 0.
613+
* then the application writer must serialize calls to writing API functions
614+
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
615+
* different readers then the application writer must serialize calls to reading
616+
* API functions (such as xStreamBufferReceive()). One way to achieve such
617+
* serialization in single core or SMP kernel is to place each API call inside a
618+
* critical section and use a block time of 0.
619619
*
620620
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
621621
* xMessageBufferReceiveFromISR() to read from a message buffer from an

include/mpu_prototypes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
269269
StaticQueue_t * pxStaticQueue,
270270
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
271271
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) FREERTOS_SYSTEM_CALL;
272+
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
273+
uint8_t * pucQueueStorage,
274+
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL;
272275
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
273276
QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
274277
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
@@ -294,6 +297,9 @@ uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
294297
StaticQueue_t * pxStaticQueue,
295298
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
296299
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
300+
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
301+
uint8_t * pucQueueStorage,
302+
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
297303
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
298304
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
299305
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,

include/mpu_wrappers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
151151
#define xQueueGenericReset MPU_xQueueGenericReset
152152
#define xQueueCreateSet MPU_xQueueCreateSet
153+
#define xQueueCreateSetStatic MPU_xQueueCreateSetStatic
153154
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
154155

155156
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )

include/queue.h

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

1686+
/*
1687+
* Queue sets provide a mechanism to allow a task to block (pend) on a read
1688+
* operation from multiple queues or semaphores simultaneously.
1689+
*
1690+
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
1691+
* function.
1692+
*
1693+
* A queue set must be explicitly created using a call to xQueueCreateSet()
1694+
* or xQueueCreateSetStatic() before it can be used. Once created, standard
1695+
* FreeRTOS queues and semaphores can be added to the set using calls to
1696+
* xQueueAddToSet(). xQueueSelectFromSet() is then used to determine which, if
1697+
* any, of the queues or semaphores contained in the set is in a state where a
1698+
* queue read or semaphore take operation would be successful.
1699+
*
1700+
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
1701+
* for reasons why queue sets are very rarely needed in practice as there are
1702+
* simpler methods of blocking on multiple objects.
1703+
*
1704+
* Note 2: Blocking on a queue set that contains a mutex will not cause the
1705+
* mutex holder to inherit the priority of the blocked task.
1706+
*
1707+
* Note 3: An additional 4 bytes of RAM is required for each space in a every
1708+
* queue added to a queue set. Therefore counting semaphores that have a high
1709+
* maximum count value should not be added to a queue set.
1710+
*
1711+
* Note 4: A receive (in the case of a queue) or take (in the case of a
1712+
* semaphore) operation must not be performed on a member of a queue set unless
1713+
* a call to xQueueSelectFromSet() has first returned a handle to that set member.
1714+
*
1715+
* @param uxEventQueueLength Queue sets store events that occur on
1716+
* the queues and semaphores contained in the set. uxEventQueueLength specifies
1717+
* the maximum number of events that can be queued at once. To be absolutely
1718+
* certain that events are not lost uxEventQueueLength should be set to the
1719+
* total sum of the length of the queues added to the set, where binary
1720+
* semaphores and mutexes have a length of 1, and counting semaphores have a
1721+
* length set by their maximum count value. Examples:
1722+
* + If a queue set is to hold a queue of length 5, another queue of length 12,
1723+
* and a binary semaphore, then uxEventQueueLength should be set to
1724+
* (5 + 12 + 1), or 18.
1725+
* + If a queue set is to hold three binary semaphores then uxEventQueueLength
1726+
* should be set to (1 + 1 + 1 ), or 3.
1727+
* + If a queue set is to hold a counting semaphore that has a maximum count of
1728+
* 5, and a counting semaphore that has a maximum count of 3, then
1729+
* uxEventQueueLength should be set to (5 + 3), or 8.
1730+
*
1731+
* @param pucQueueStorage pucQueueStorage must point to a uint8_t array that is
1732+
* at least large enough to hold uxEventQueueLength events.
1733+
*
1734+
* @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
1735+
* will be used to hold the queue's data structure.
1736+
*
1737+
* @return If the queue set is created successfully then a handle to the created
1738+
* queue set is returned. If pxQueueBuffer is NULL then NULL is returned.
1739+
*/
1740+
#if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
1741+
QueueSetHandle_t xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
1742+
uint8_t * pucQueueStorage,
1743+
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
1744+
#endif
1745+
16861746
/*
16871747
* Adds a queue or semaphore to a queue set that was previously created by a
1688-
* call to xQueueCreateSet().
1748+
* call to xQueueCreateSet() or xQueueCreateSetStatic().
16891749
*
16901750
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
16911751
* function.

0 commit comments

Comments
 (0)