AnsweredAssumed Answered

How should I use Makefile in stm32cubeMX?

Question asked by Bin Wu on Jun 4, 2017
Latest reply on Aug 3, 2017 by ST Renegade

I generated a 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.

Outcomes