cancel
Showing results for 
Search instead for 
Did you mean: 

How should I use Makefile in stm32cubeMX?

Bin Wu
Associate
Posted on June 04, 2017 at 10:46

I generated a

https://community.st.com/tags♯/?tags=makefile

project with STM32cubeMX(4.21.0).But Makefile can't work well.

It looks like this:

F:\stm32\project\cubemx\freeRTOS>make

The system cannot find the specified path.

/arm-none-eabi-gcc -c -mcpu=cortex-m3 -mthumb   -DUSE_HAL_DRIVER -DSTM32F103xB -IInc -IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 -IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IMiddlewares/Third_Party/FreeRTOS/Source/include -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF'build/tasks.d' -MT'build/tasks.d' -Wa,-a,-ad,-alms=build/tasks.lst Middlewares/Third_Party/FreeRTOS/Source/tasks.c -o build/tasks.o

'/arm-none-eabi-gcc' is not an internal or external command, nor is it a program to run

Or batch files

Makefile:186: recipe for target 'build/tasks.o' failed

make: *** [build/tasks.o] Error 1

Then I checked the Makefile and I find:

♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯

♯ binaries

♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯

BINPATH

=

PREFIX

= arm-none-eabi-

CC

=

$(

BINPATH

)

/

$(

PREFIX

)

gcc

AS

=

$(

BINPATH

)

/

$(

PREFIX

)

gcc -x assembler-with-cpp

CP

=

$(

BINPATH

)

/

$(

PREFIX

)

objcopy

AR

=

$(

BINPATH

)

/

$(

PREFIX

)

ar

SZ

=

$(

BINPATH

)

/

$(

PREFIX

)

size

HEX

=

$(

CP

)

-O ihex

BIN

=

$(

CP

)

-O binary -S

I did't set $(BINPATH) but It will add a '/' before $(PREFIX).

'/arm-none-eabi-gcc' is not an internal or external command,

$(

BINPATH

)

/

$(

PREFIX

)

gcc

Well,I delated the '/' .The Makefile worked normally.

How should I use makefile in stm32cubeMX?

What's your good idea?

Thanks.

#makefile
1 REPLY 1
ST Renegade
Senior
Posted on August 03, 2017 at 09:14

The Makefile is not in 100% shape, so as you suggested, you need to delete the slash or call makefile with an input argument like this:

make BINPATH=/usr/bin all

Best idea is to remove also the $(BINPATH)/ part... in case you don't want to call a specific arm-none-eabi-gcc binary.

Have a nice day,

Renegade

PS: Be aware, the Makefile is not able to rebuild your source code in case of a header file update! This applies to CubeMX version 4.22.0 and below. So don't be surprised...