Author Topic: Error when using vPortFree(ptr) CMSIS-RTOS on STM32F4  (Read 496 times)

0 Members and 1 Guest are viewing this topic.

Offline marcelogadotti

  • Newbie
  • Posts: 2
  • Country: br
  • Electrical Engineer and Ham Radio
Error when using vPortFree(ptr) CMSIS-RTOS on STM32F4
« on: April 01, 2019, 02:56:42 pm »
I will need to handle dynamic memory using malloc and free. Looking on FreeRTOS documentation, I found pvPortMalloc(size) and vPortFree(ptr) , pvPortMalloc(size) works fine. When try to release memory using vPortFree(ptr) inside a Thread, the code hangs on that call.

I'm using heap_4 for CMSIS-RTOS on TrueStudio.
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 403
  • Country: us
Re: Error when using vPortFree(ptr) CMSIS-RTOS on STM32F4
« Reply #1 on: April 01, 2019, 11:13:34 pm »
Is the pointer you are freeing NULL?     Did you single step to see what is happening?   You have the source code so it should be pretty straight forward.

Also,   I am not sure what the CMSIS layer does with freeRTOS but it is only an API layer.   There might be some goofiness going on here.  (I would not recommend using an API layer, it is generally a waste).

Lastly,  what are you FreeRTOS config settings?

 
The following users thanked this post: marcelogadotti

Offline marcelogadotti

  • Newbie
  • Posts: 2
  • Country: br
  • Electrical Engineer and Ham Radio
Re: Error when using vPortFree(ptr) CMSIS-RTOS on STM32F4
« Reply #2 on: April 02, 2019, 05:20:23 pm »
I did solve the problem, it happens when increment the pointer and try to free after this operation.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf