简体   繁体   中英

Makefile error compiling for STM32F4

I'm still pretty new to Makefiles so I'm having a little trouble with this. I'm trying to compile some code for an STM32F4, I got this Makefile.common for an STM32F3 and just changed the tool chains and directories to reflect the ones I'll be using for my development. Unfortunately I am getting this compile error, and while I've tried extensively googling it, nothing has been too helpful in helping me solve it.

Here's the error I'm getting

make: execvp: /home/wilfred/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin: Permission denied make: * [startup_stm32f4xx.o] Error 127

Here's the code for my Makefile.common. Thanks!

# name of executable

ELF=$(notdir $(CURDIR)).elf                    

# Tool path

TOOLROOT=/home/wilfred/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin                         

# Library path

LIBROOT=/home/wilfred/Computer-Science/STM32F/STM32F4-Discovery_FW_V1.1.0

# Tools

CC=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
LD=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
AR=$(TOOLROOT)/arm-none-linux-gnueabi-ar
AS=$(TOOLROOT)/arm-none-linux-gnueabi-as
OBJCOPY=$(TOOLROOT)/arm-none-linux-gnueabi-objcopy

# Code Paths

DEVICE=$(LIBROOT)/Libraries/CMSIS/ST/STM32F4xx
CORE=$(LIBROOT)/Libraries/CMSIS/Include
PERIPH=$(LIBROOT)/Libraries/STM32F4xx_StdPeriph_Driver
SYSTEM_FILE=$(LIBROOT)/Libraries/CMSIS/ST/STM32F4xx/Source/Templates
STARTUP_FILE=$(LIBROOT)/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/gcc_ride7

# Search path for standard files

vpath %.c $(TEMPLATEROOT)

# Search path for perpheral library

vpath %.c $(CORE)
vpath %.c $(PERIPH)/src
vpath %.c $(DEVICE)

vpath %.c $(SYSTEM_FILE)
vpath %.s $(STARTUP_FILE)



#  Processor specific

LDSCRIPT = $(LIBROOT)/Project/Peripheral_Examples/IO_Toggle/TrueSTUDIO/IO_Toggle/stm32_flash.ld
STARTUP = startup_stm32f4xx.o system_stm32f4xx.o

# Compilation Flags

FULLASSERT = -DUSE_FULL_ASSERT 

LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4
CFLAGS+= -mcpu=cortex-m4 -mthumb 
CFLAGS+= -I$(TEMPLATEROOT) -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I.
CFLAGS+= -DUSE_STDPERIPH_DRIVER $(FULLASSERT) 
CFLAGS+= -I$(DEVICE)/Include -I$(CORE)
CFLAGS+= -I$(LIBROOT)/Project/Peripheral_Examples/IO_Toggle

# Build executable 

$(ELF) : $(OBJS)
    $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)

# compile and generate dependency info

%.o: %.c
    $(CC) -c $(CFLAGS) $< -o $@
    $(CC) -MM $(CFLAGS) $< > $*.d

%.o: %.s
    $(CC) -c $(CFLAGS) $< -o $@

%.bin: %.elf
    $(OBJCOPY) -O binary $< $@

clean:
    rm -f $(OBJS) $(OBJS:.o=.d) $(ELF) startup_stm32f* $(CLEANOTHER) $(BIN)

debug: $(ELF)
    arm-none-linux-gnueabi-gdb $(ELF)

download: $(BIN)
    st-flash write $(BIN) 0x8000000

etags:
    find $(PERIPH) -type f -iname "*.[ch]" | xargs etags --append
    find $(DEVICE) -type f -iname "*.[ch]" | xargs etags --append
    find $(CORE) -type f -iname "*.[ch]" | xargs etags --append
    find . -type f -iname "*.[ch]" | xargs etags --append

all: $(ELF)

# pull in dependencies

-include $(OBJS:.o=.d)

You can change permissions with chmod (run 'man chmod' for more information).

for example,

chmod 777 myfile.c

changes myfile.c to have all permissions (rwx) for all users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM