Error undefined reference to `pvPortMalloc and `vPortFree' 

Sysprogs forums Forums VisualGDB Error undefined reference to `pvPortMalloc and `vPortFree' 

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  support 2 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #29490


    VisualGBD V5.5R2

    FreeRTOS errors from importing STM32 CubeMX.

    Error undefined reference to pvPortMalloc’

    Error undefined reference to vPortFree’

    VisualGDB says Found 2 identified symbols, but by clicking on Review its just says “X missing” and no ability to resolve.

    I have tried several suggestions from the forum. None of them seem to resolve it. I wanted to use CMCIS_V2, but that gave even more missing references. Going back to CMCIS_V1 at least came back to this, which seems to be an issue with port.c, but I am unable to add that manually, since it says it already is added to the project…

    Opening the tasks.c it doesn’t show an error of not finding either of the mentions references. Enabling the FreeRTOS (and HAL/low-level) drivers in the VisualGDB leads to multiple definition errors. Then removing the Drivers from VisualGDB again gives an additional error and it is now not able to find MX_FREERTOS_Init().

    Also, there seems to be a bug while saving VisualGDB settings, see attachment.

    You must be logged in to view attached files.



    The “undefined reference” error means that a certain function has been declared, but not defined (see this tutorial for a detailed explanation). With FreeRTOS, it would happen if the heap_<N>.c file (that implements the heap functions) was not included in the project.

    First of all, please try creating a FreeRTOS-based project via the regular Embedded Project Wizard, then locate the heap file in Solution Explorer, and take a note of its location under the FreeRTOS directory (you can change the heap type via VisualGDB Project Properties -> Embedded Frameworks -> Configuration).

    Then, please check the .gpdsc file generated by STM32CubeMX for a reference to a similar file (heap_<N>.c). If the file is referenced, it’s a bug in our STM32CubeMX importer and we should be able to fix it if you could attach the .gpdsc and .ioc files. If the file is not referenced, it’s a bug in the STM32CubeMX generator, and you can work around it by manually adding the heap file to the project via Add->Existing Item (the menu option will not appear under the STM32CubeMX Project node in Solution Explorer, as this node’s contents are managed by STM32CubeMX).



    Thank you for the reply.

    I managed to add the heap_4.c file manually under Source files/STm32Cube HAL/FREERTOS. It does seem that it is missing in the .gpdsc file. This fixes it.

    Attached the .gpdsc file.

    This works for using the default CMSIS-V1. Switching to CMSIS-V2 introduces even more errors. I’ll stick with CMSIS-V1 for now.



    Thanks for letting us know. If the file is missing from the gpdsc file, please feel free to report this bug to ST, as this needs to be fixed on their side.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.