Search found 20 matches

by x-8973
Wed Jun 27, 2018 2:39 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

I understood you. Well, I'll try to reproduce my problem in a simpler example.
by x-8973
Tue Jun 26, 2018 8:37 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

If I understand correctly from the documentation, the pointer is stored inside the queue, but the copied value. Therefore, a pointer is passed to xQueueSend(): the function copies the required number of bytes from the memory by this pointer. The function xQueueReceive() also sends a pointer to the m...
by x-8973
Tue Jun 26, 2018 8:11 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

chegewara , the above code is an excerpt from the file queue.h. This is NOT my code :) OneTwo , I looked at the documentation on the freertos.org website: pvItemToQueue A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was ...
by x-8973
Tue Jun 26, 2018 6:29 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

I used xQueue according to the documentation and the official example. uint32_t ulVar = 10UL; void vATask( void *pvParameters ) { QueueHandle_t xQueue1; // Create a queue capable of containing 10 uint32_t values. xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) ); if( xQueue1 != 0 ) { // Send an uint3...
by x-8973
Tue Jun 26, 2018 5:01 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

Yes, it uses NVS to store some settings, and only today I found that if they are not there can be a drop. However, this does not seem to be an error with a heap damage.
I will try to fix this problem and make a fresh commit.
by x-8973
Mon Jun 25, 2018 3:38 pm
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

In fact, the project is already very large and quite confusing. In addition, comments in Russian) However, I can give a link to my SVN so you can take a look. I will send it to you with a personal message. Also I want to note that the error does not necessarily occur in the RTOS task. It can occur i...
by x-8973
Sun Jun 24, 2018 6:21 am
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

Why do you think so? I did not find a clear explanation of why the dynamic allocation of memory inside the RTOS task can mess up the heap. Perhaps at this point the system switches to another task, and the heap allocation table is corrupted. On freertos.org was about the same question, and there the...
by x-8973
Sat Jun 23, 2018 12:01 pm
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

I think the problem is solved. I added a file named heap_3.c to the project, which was taken from the full release of FreeRTOS, and replaced the definitions in the portable.h. It was: #define pvPortMalloc malloc #define vPortFree free Became: void *pvPortMalloc( size_t xWantedSize ); // In heap_3.c ...
by x-8973
Fri Jun 22, 2018 3:34 pm
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

Based on the results of the experiments, I determined that damage to the heap causes any malloc() call inside the RTOS task. After that, the application's operation becomes unstable, and any access to the heap causes crash or inadequate behavior. I found a description of thread-safe implementations,...
by x-8973
Wed Jun 20, 2018 7:51 pm
Forum: ESP-IDF
Topic: Heap corrupting when using xQueue
Replies: 29
Views: 32892

Re: Heap corrupting when using xQueue

I used EspStackTracesDeсoder. It works from the command line. In addition, he needs to specify the path to "addr2line.exe".