-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The size of Queue_t and StaticQueue_t does not match, apparently typedef struct xSTATIC_QUEUE contains an extra pointer. (IDFGH-8303) #9785
Comments
Why do you want them to be the same size? |
@negativekelvin
probably such differences can lead to unpredictable behavior of user code if the programmer relies on guarantees. I understand that in most cases now static allocation just consumes 4 bytes more memory per structure. More is not less so it works. However, a bug is a bug. I apologize for my poor knowledge of English |
This exists in upstream freertos so maybe better to raise the issue there? |
The size was broken by modifying the file "queue.c" precisely in the ESP-IDF fork. In the vanilla version, everything just fits together. I was looking at the differences and came across this error. Before publishing, I checked the ESP-IDF code and vanilla FREERTOS code. The esp-idf version does not matter, there is a bug in both versions 4 and 5. |
Vanilla version still has 3 pointer vs 2 pointer issue. IDF added a mux to both structs. |
@negativekelvin queue.c 143-145
FreeRTOS.h 1298-1300
Thank you very much for the time spent on the proceedings. |
…S static data structs (v4.4) This commit adds the missing ESP_PLATFORM preprocessor directive to static data structures to wrap the extra variable added for SMP locks. Closes #9785
…S static data structs (v5.0) This commit adds the missing ESP_PLATFORM preprocessor directive to static data structures to wrap the extra variable added for SMP locks. Closes #9785
Thanks for reporting and sharing the updates, fix on release/4.4 is available at 06cad10. Feel free to reopen. |
Backporting this to v5.0 broke the following code: static struct {
TaskHandle_t task;
SemaphoreHandle_t sem;
StaticSemaphore_t _sem;
bool enabled;
const char *something;
} state;
void init(const char* something) {
state.something = something;
state.sem = xSemaphoreCreateMutexStatic(&state._sem);
// state.something is overwritten here
} After |
Disregard that comment as the issue only happens with FreeRTOS kernel from Amazon. |
Answers checklist.
General issue report
ESP_IDF 4.4.2
The size of Queue_t and StaticQueue_t does not match, apparently typedef struct xSTATIC_QUEUE contains an extra pointer.
"queue.c"
"FreeRTOS.h"
The text was updated successfully, but these errors were encountered: