【问题标题】:Makefile error compiling for STM32F4为 STM32F4 编译 Makefile 错误
【发布时间】:2013-01-13 06:26:35
【问题描述】:

我对 Makefiles 还是很陌生,所以我遇到了一些麻烦。我正在尝试为 STM32F4 编译一些代码,我得到了 STM32F3 的 Makefile.common 并且只是更改了工具链和目录以反映我将用于我的开发的那些。不幸的是,我收到了这个编译错误,虽然我已经尝试过广泛的谷歌搜索,但没有什么能帮助我解决它。

这是我遇到的错误

制作:执行vp: /home/wilfred/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin: 权限被拒绝 make: * [startup_stm32f4xx.o] 错误 127

这是我的 Makefile.common 的代码。谢谢!

# 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)

【问题讨论】:

  • 你检查过那个目录和里面工具的权限吗?
  • 如果错误消息中没有更多上下文,就不可能说出哪个规则正在尝试仅使用 $(TOOLROOT) 作为命令。您能否提供更多上下文,或缩小 Makefile 范围?
  • 看起来工具链二进制文件没有设置正确的执行权限位。您可以在 $TOOLROOT 目录中执行一个简单的 ls -l 并将该输出添加到原始帖子吗?

标签: c makefile stm32f4discovery


【解决方案1】:

您可以使用 chmod 更改权限(运行“man chmod”以获取更多信息)。

例如,

chmod 777 myfile.c

将 myfile.c 更改为对所有用户拥有所有权限 (rwx)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-17
    • 2011-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多