7

Eclipse のコンソールからの出力は次のとおりです。

 **** Build of configuration Debug for project FatFstest ****

make all 
make: *** No rule to make target `main.o', needed by `FatFstest.elf'.  Stop.

FatFsライブラリをテストするために、Eclipse 用の AVR プラグインを使用してプロジェクトをビルドしようとしています。最初に FatFs コードをインポートし、それを実装するための main.c ファイルを作成しました。最初にビルドを試みた後、プロジェクトの src フォルダを [Properties] > [AVR Compiler] > [Directories] のディレクトリ リストに追加しましたが、それでもビルド エラーが発生します。何か助けはありますか?

これが私のメイクファイルです:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_DEPS)),)
-include $(S_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 
LSS += \
FatFstest.lss \

SIZEDUMMY += \
sizedummy \

AVRDUDEDUMMY += \
avrdudedummy \


# All Target
all: FatFstest.elf secondary-outputs

# Tool invocations
FatFstest.elf: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: AVR C Linker'
    avr-gcc -Wl,-Map,FatFstest.map -mmcu=atmega328p -o"FatFstest.elf" $(OBJS) $(USER_OBJS) $(LIBS)
    @echo 'Finished building target: $@'
    @echo ' '

FatFstest.lss: FatFstest.elf
    @echo 'Invoking: AVR Create Extended Listing'
    -avr-objdump -h -S FatFstest.elf  >"FatFstest.lss"
    @echo 'Finished building: $@'
    @echo ' '

sizedummy: FatFstest.elf
    @echo 'Invoking: Print Size'
    -avr-size --format=avr --mcu=atmega328p FatFstest.elf
    @echo 'Finished building: $@'
    @echo ' '

avrdudedummy: FatFstest.elf
    @echo 'Invoking: AVRDude'
    /usr/local/CrossPack-AVR-20100115/bin/avrdude -pm328p -Uflash:w:FatFstest.hex:a
    @echo 'Finished building: $@'
    @echo ' '

# Other Targets
clean:
    -$(RM) $(OBJS)$(C_DEPS)$(ASM_DEPS)$(ELFS)$(LSS)$(AVRDUDEDUMMY)$(S_DEPS)$(SIZEDUMMY)$(S_UPPER_DEPS) FatFstest.elf
    -@echo ' '

secondary-outputs: $(LSS) $(SIZEDUMMY) $(AVRDUDEDUMMY)

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

main.c

#include <diskio.h>
#include <ff.h>
#include <stdio.h>
 int main(void)
 {
   printf("hello world\n");
   return 0;
 }

subdir.mk

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables 
C_SRCS += \
../src/diskio.c \
../src/ff.c \
../src/main.c 

OBJS += \
./src/diskio.o \
./src/ff.o \
./src/main.o 

C_DEPS += \
./src/diskio.d \
./src/ff.d \
./src/main.d 


# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
    @echo 'Building file: $<'
    @echo 'Invoking: AVR Compiler'
    avr-gcc -I"/Users/nathannewcomb/Documents/Puzzles/FatFstest/src" -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -c -o"$@" "$<"
    @echo 'Finished building: $<'
    @echo ' '

オブジェクト.mk

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS :=

LIBS :=

ソース.mk

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

O_SRCS := 
C_SRCS := 
S_UPPER_SRCS := 
S_SRCS := 
OBJ_SRCS := 
ASM_SRCS := 
OBJS := 
C_DEPS := 
ASM_DEPS := 
ELFS := 
LSS := 
AVRDUDEDUMMY := 
S_DEPS := 
SIZEDUMMY := 
S_UPPER_DEPS := 

# Every subdirectory with source files must be described here
SUBDIRS := \
src \
4

4 に答える 4

1

main.c をディレクトリに置かず、プロジェクトの一番上に置きます。

于 2011-11-08T18:36:06.833 に答える
0

プロジェクトの src フォルダを [Properties] > [AVR Compiler] > [Directories] のディレクトリ リストに追加しました。

このフォルダーを削除/Users/nathannewcomb/Documents/Puzzles/FatFstest/srcして、再度コンパイルしてください。

subdir.mk ファイルの次の行:

avr-gcc -I"/Users/nathannewcomb/Documents/Puzzles/FatFstest/src" -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -c -o"$@" "$<"

なる必要があります:

avr-gcc -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -c -o"$@" "$<"

このsrcフォルダーは既に source.mk ファイルに追加されています。

# Every subdirectory with source files must be described here
SUBDIRS := \
src \
于 2011-08-10T22:40:15.637 に答える