debuggingcompiler-errorsstm32cubemxvisualgdb

Reference errors when importing CubeMx project into VisualGDB


I am having some issues when importing my fresh cubeMX project into VisualGDB. I get tonnes of errors that say: undefined reference to 'vPortFree' (for example)

Steps taken:

  1. Generate project files in CubeMX using "Other toolchain"
  2. Then in VS, create project using Embedded Visual GDB and mostly following default steps. I am following this process exactly. https://www.youtube.com/watch?v=XY4I0Nq6IGc

Once the project is created I try built it, but I get these errors:

Severity Description                                            Project                          File                                                                                                                               Line
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3920
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3921
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3927
Error    Build failed: arm-none-eabi-g++.exe exited with code 1 stm32nucleof429zi_freertos_tcpip                                                                                                                                    1   
Error    ld returned 1 exit status                              stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\collect2.exe                                    0   

When I right click on main.c however and compile, the project compiles without fault. Its when using the build tool and debugger that these errors come up.

Ive never had this problem before when importing projects. Any help would be greatly appreciated Thank you


Solution

  • After playing with configurations for some time I found the issues. The toolchain file that CubeMx created does not tell the linker to include all the files required for FreeRTOS to compile.

    This issue is only relevant if you are using CMSIS_RTOS_V2 and the following steps fixed it for me:

    Add CMSIS_RTOS_V2 to the project space by going to: Add missing includes:

    To resolve the unidentified reference ‘pvPortMalloc’ error: