Error about "collect2.exe: error: ld returned 1 exit status"

Hello everyone. I now have a FreeRTOS project, and there is a problem compiling, as the title shows. I don’t know why this is, can you solve this problem for me?

Here is the project source code source code

  • FreeRTOS folder must be inside src/ otherwise it won’t be compiled…
  • Keil and IAR folders from the FreeRTOS/ports directory must be deleted, they contain source code meant for the assembler of these toolchains. Only GCC must prevail
  • include paths in build_flags must be adapted accordingly
  • needs additional build flags -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp so that the assembly builds correctly (see here)

Fixed project: here.


Also you did not choose a FreeRTOS heap, is that wanted?

Thank you for your answer. I have changed the project file according to your prompt, but there are still errors. I can’t understand the “platformio.ini” of “platformIO”. It is a bit difficult for me to configure it.

Here is the changed project source code


Did you see my download link? It should work for reference (

Have you changed the files in this link? Why is it the same as what I uploaded?:grinning::grinning:

You are right, I somehow zipped the wrong file… Redoing…


Thank you for your answer. You solved a big problem for me.

1 Like