Add cast to xQueueGenericCreate to allow queue creation for 8-bit ports #1152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses the bug which fails to create Queues with more element bytes than
UBaseType_t
for 8-bit ports.The fault is caused by the size of
UBaseType_t
on 8-bit ports which isuint8_t
, meaning its maximum value is 255. This reduces the max "valid" size to a very small number.Bigger CPUs like SAM/ARM which have UBaseType_t defined as uint16_t/uint32_t do not suffer this issue because such a large queues are not allocated in practice.
The fix is adding the case
UBaseType_t
to the RHS of this checkTest Steps
Run the Posix_GCC demo with these changes:
main_full.c
O/p for Posix port
To simulate the 8-bit port behavior, this line in
queue.c
is changed to :Output :
Queue Creation fails and this configASSERT is triggered.
When this patch is applied :-
Output:
Checklist:
Related Issue
#1151
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.