cancel
Showing results for 
Search instead for 
Did you mean: 

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

Kristof Mulier
Associate III
Posted on April 05, 2018 at 17:09

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 <http://gnu.org/licenses/gpl.html>

    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.

#stm32f746-cubemx #stm32f746-nucleo #nucleo-f746 #makefiles #makefile
2 REPLIES 2
David SIORPAES
ST Employee
Posted on April 05, 2018 at 18:13

You need to specify the directory where your GCC toolchain is installed by setting the BINPATH variable in the Makefile.

0690X0000060AS4QAM.png
Posted on April 05, 2018 at 18:42

You need to specify the directory where your GCC toolchain is installed by setting the BINPATH variable in the Makefile.

I would expect this to be configurable in Cube, or even better, auto-detected.

Other toolchains (even free one's) do this.