2024-05-16 08:29 AM
I have a FreeRTOS queue with many calls from various tasks.
I would like to assign elements of a variable that is passed into the queue with the file name and line number of the task that is placing the variable on the queue.
I have a corruption issue that might be a stack or perhaps an array that is being sent to the queue that is not copied but sent as a reference?
At the moment I have started to hand code the line numbers, but it's not ideal.
Can anyone help?
Solved! Go to Solution.
2024-05-16 08:33 AM - edited 2024-05-16 08:37 AM
__FILE__ and __LINE__
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
EDIT:
GCC also provides __FILE_NAME__ to give just the name, without path:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
2024-05-16 08:33 AM - edited 2024-05-16 08:37 AM
__FILE__ and __LINE__
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
EDIT:
GCC also provides __FILE_NAME__ to give just the name, without path:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
2024-05-16 08:49 AM
Many thanks for the quick reply.
My previous google searched had failed me. I hadn't search with gnu or gcc.
I thought they must exist as they do for the IAR compiler.
2024-05-16 09:01 AM
You're welcome.
Yes, they are part of the C Standard - apart from __FILE_NAME__
If that's answered the question, please mark the solution.