Skip to main content
MSant.11
Associate III
October 14, 2021
Question

Why .elf file does not exist ?

  • October 14, 2021
  • 2 replies
  • 3898 views

I'm trying to validate on target the example proposed in https://www.youtube.com/watch?v=k8AAr84z27s concerning the asc NN implementation with X-CUBE AI.

My target is the NUCLEO-F401RE instead.

After generating code I try to build and I get the warnings:

..........................................................................................

../Core/Src/main.c:179:13: warning: 'MX_GPIO_Init' defined but not used [-Wunused-function]

 179 | static void MX_GPIO_Init(void)

   |       ^~~~~~~~~~~~

../Core/Src/main.c:146:13: warning: 'MX_USART2_UART_Init' defined but not used [-Wunused-function]

 146 | static void MX_USART2_UART_Init(void)

   |       ^~~~~~~~~~~~~~~~~~~

../Core/Src/main.c:120:13: warning: 'MX_CRC_Init' defined but not used [-Wunused-function]

 120 | static void MX_CRC_Init(void)

............

c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: ./Core/Startup/startup_stm32f401retx.o: in function `LoopFillZerobss':

C:/Users/marco/STM32CubeIDE/workspace_1.6.1/testing ai sound/Debug/../Core/Startup/startup_stm32f401retx.s:100: undefined reference to `main'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:66: testing ai sound.elf] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

...........................................................................................................................

Launching the program I get: Program file does not exist

C:\Users\marco\STM32CubeIDE\workspace_1.6.1\testing ai sound\Debug\testing ai sound.elf not found

I updated to PE64 Windows binary parser, but without success.

What can I do? Thanks

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    October 14, 2021

    >>Why .elf file does not exist ?

    Because the linker didn't get closure and so didn't generate it?

    It's complaining it can't find a main() function.

    Do you have one in your compiled files? Are you using C++ / .cpp files?

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    MSant.11
    MSant.11Author
    Associate III
    October 15, 2021

    Thanks DeLorean.

    The reason was the Application Structure of STM32CubeMX.

    It was selected the option "Do not generate the main ()"

    Now I get this warning instead:

    "c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: ./X-CUBE-AI/App/app_x-cube-ai.o: in function `MX_X_CUBE_AI_Init':

    C:/Users/marco/STM32CubeIDE/workspace_1.6.1/test ai ASC/Debug/../X-CUBE-AI/App/app_x-cube-ai.c:73: undefined reference to `MX_USART2_UART_Init'

    collect2.exe: error: ld returned 1 exit status

    make: *** [makefile:66: test ai ASC.elf] Error 1

    "make -j8 all" terminated with exit code 2. Build might be incomplete.

    12:02:28 Build Failed. 3 errors, 0 warnings. (took 2s.464ms)"

    and USART2 is the standard COM port for NUCLEO-F401RE.