AnsweredAssumed Answered

CubeMX generated code doesn't compile (Toolchain = Makefile)

Question asked by Kristof Mulier on Apr 5, 2018
Latest reply on Apr 5, 2018 by AvaTar

I've generated code with CubeMX, but it doesn't compile. I'll go through the steps I've taken.


1. CubeMX project

Starting a new project, I selected the board NUCLEO-F746ZG. Upon the question "Initialize all peripherals with their default Mode?" I answered "Yes".

I did not change anything in the pinout, clock settings, configuration, ... I only opened the Project Settings dialog, and entered a Project Name, Project Location and Toolchain:

Project Name: nucleo_f746zg_demo

Project Location: C:\CubeMX_test\

Toolchain / IDE: Makefile

Next, I clicked on "Generate Code" and closed CubeMX.


2. Compilation attempt

Because I've selected "Makefile" as my Toolchain of choice, I open the Windows CMD terminal and navigate to the project folder "C:\CubeMX_tests\nucleo_f746zg_demo".

I issue the following command:

 > make all

I get the following output, indicating that the compilation failed:

    The system cannot find the path specified.
    mkdir build
    /arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F746xx -IInc -IDrivers/STM32F7xx_HAL_Driver/Inc -IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f7xx_hal_pwr.d" -MT"build/stm32f7xx_hal_pwr.d" -Wa,-a,-ad,-alms=build/stm32f7xx_hal_pwr.lst Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c -o build/stm32f7xx_hal_pwr.o
    process_begin: CreateProcess(NULL, sh.exe -c "/arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F746xx -IInc -IDrivers/STM32F7xx_HAL_Driver/Inc -IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MFbuild/stm32f7xx_hal_pwr.d -MTbuild/stm32f7xx_hal_pwr.d -Wa,-a,-ad,-alms=build/stm32f7xx_hal_pwr.lst Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c -o build/stm32f7xx_hal_pwr.o", ...) failed.
    make (e=2): The system cannot find the file specified.
    make: *** [Makefile:176: build/stm32f7xx_hal_pwr.o] Error 2


3. My version of GNU make

I believe my version of GNU make is okay:

C:\CubeMX_tests\nucleo_f746zg_demo>make --version
    GNU Make 4.2
    Built for Windows32
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.


Please help me understand why this generated code is not compiling.

Thank you very much.