Hi ! I've just started avr programming in C. Unfortunately I'm not being able to get off the ground. I'm using the WinAVR bundle. I write a simple piece of C code in Programmer's Notepad, save it as a .c file, make a corresponding makefile using Mfile, and then try to build the .c file and the makefile under a project....the error i get everytime irrespective of the code i write is (and the code's simple enough, so it cant be wrong i think !!! ) :
make.exe: *** No rule to make target `obj/main.o', needed by `test.elf'. Stop.
where test.c is my c file...
where am i making a mistake ? or is there something i should be doing ?
Hope to receive some advice quick !!! Thanks a lot !
P.S : 1. My C code is :
#include<avr/io.h>
void main() { while(1) { PORTD=0xFF; } }
2. My makefile is :
# MCU name MCU = atmega8
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the # processor frequency. You can then use this symbol in your source code to # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code. # Typical values are: # F_CPU = 1000000 # F_CPU = 1843200 # F_CPU = 2000000 # F_CPU = 3686400
# F_CPU = 4000000 # F_CPU = 7372800 # F_CPU = 8000000 # F_CPU = 11059200 # F_CPU = 14745600 # F_CPU = 16000000 # F_CPU = 18432000 # F_CPU = 20000000
F_CPU = 8000000
# Output format. (can be srec, ihex, binary) FORMAT = ihex
# Target file name (without extension). TARGET = test
# Object files directory OBJDIR = obj
# List C source files here. (C dependencies are automatically generated.) SRC ="">
# List C++ source files here. (C dependencies are automatically generated.) CPPSRC = main.cpp
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s # will not be considered source files but generated files (assembler # output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same, # it will preserve the spelling of the filenames, and gcc itself does # care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) OPT = s
# Debugging format. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. # AVR Studio 4.10 requires dwarf-2. # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. DEBUG = dwarf-2
# List any extra directories to look for include files here. # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level. # c89 = "ANSI" C # gnu89 = c89 plus GCC extensions # c99 = ISO C99 standard (not yet fully implemented) # gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources CDEFS = -DF_CPU=$(F_CPU)UL
# Place -D or -U options here for C++ sources CPPDEFS = -DF_CPU=$(F_CPU)UL #CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Assembler Options ---------------- # -Wa,...: tell GCC to pass this to the assembler. # -ahlms: create listing # -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames # and function names needs to be present in the assembler source # files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()). #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!), # only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
# Uncomment the following if you want avrdude's erase cycle counter. # Note that this counter needs to be initialized first using -Yn, # see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be # performed after programming the device. #AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> # to submit bug reports. #AVRDUDE_VERBOSE = -v -v
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight. # DEBUG_UI = gdb DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr. DEBUG_BACKEND = avarice #DEBUG_BACKEND = simulavr
# GDB Init Filename. GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr. DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally # just set to localhost unless doing some sort of crazy debugging when # avarice is running on a different computer.
DEBUG_HOST = localhost
# Eye candy. # AVR Studio 3.x does not check make's exit code but relies on # the following magic strings to be generated by the compile job. begin: @echo @echo $(MSG_BEGIN)
end: @echo $(MSG_END)
@echo
# Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex ELFSIZE = $(SIZE) -A $(TARGET).elf AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
sizebefore: @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
sizeafter: @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ $(AVRMEM) 2>/dev/null; echo; fi
# Display compiler version information.
gccversion : @$(CC) --version
# Program the device. program: $(TARGET).hex $(TARGET).eep $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set # a breakpoint at main(). gdb-config: @$(REMOVE) $(GDBINIT_FILE) @echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE) @echo end >> $(GDBINIT_FILE) @echo file $(TARGET).elf >> $(GDBINIT_FILE) @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr) @echo load >> $(GDBINIT_FILE) endif @echo break main >> $(GDBINIT_FILE)