简体   繁体   English

STM32F4的Makefile错误编译

[英]Makefile error compiling for STM32F4

I'm still pretty new to Makefiles so I'm having a little trouble with this. 我对Makefiles还是很陌生,所以对此有些麻烦。 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. 我正在尝试为STM32F4编译一些代码,获得了STM32F3的Makefile.common,只是更改了工具链和目录以反映我将在开发中使用的工具和目录。 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 品牌:execvp:/ home / wilfred / CodeSourcery / Sourcery_CodeBench_Lite_for_ARM_GNU_Linux / bin:权限被拒绝品牌: * [startup_stm32f4xx.o]错误127

Here's the code for my Makefile.common. 这是我的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). 您可以使用chmod更改权限(运行“ man chmod”以获取更多信息)。

for example, 例如,

chmod 777 myfile.c chmod 777 myfile.c

changes myfile.c to have all permissions (rwx) for all users. 将myfile.c更改为对所有用户具有所有权限(rwx)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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