c-program compiling for microcontroller...pls help....

Status
Not open for further replies.

nirmal_rockin

Junior Member level 2
Joined
Aug 8, 2009
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,452
Hi...
I'm in urgent need.. i got this program somewher from the net and i've edited it for my line follower which i'm building....but the program shows some errors(the microcontroller used is atmega16) and i'm totally confused about the header files 'delay.h' and 'mega16.h' i tried using the header files provided in the avr_libc..but it shows several errors.... can anyone help me resolving this problem...
how can i create an errorless program....
pls help me..... i dono much about microcontrollers....
thank you...



 

Los Frijoles said:
Could you post the error list as well?

dep/delay.h:1: *** missing separator. Stop.
Build failed with 1 errors and 0 warnings...

i'm using avr studio 4......

i'm not so good at c programming so i donno much abt debugging....
this delay file. i got from the avr_libc....
**broken link removed**
 

That looks like a makefile error. If you made your own makefile, be sure that it uses tabs instead of spaces for indentations. If not, then try making your own makefile (there are dozens of tutorials out there) and see if it works correctly.
 

ok sir but is the program correct....

even if i correct the above error i'm getting several other errors.....(about 25errors)
i think all this is due to only linking of other files which is not done properly..and tats wat i donno.....

Added after 11 minutes:

This is the make file for the program..
###############################################################################
# Makefile for the project trial
###############################################################################

## General Flags
PROJECT = trial
MCU = atmega16
TARGET = trial.elf
CC = avr-gcc

CPP = avr-g++

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += -Wl,-Map=trial.map


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings


## Objects that must be built in order to link
OBJECTS = trial.o

## Objects explicitly added by the user
LINKONLYOBJECTS =

## Build
all: $(TARGET) trial.hex trial.eep trial.lss size

## Compile
trial.o: ../trial.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@

%.eep: $(TARGET)
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0

%.lss: $(TARGET)
avr-objdump -h -S $< > $@

size: ${TARGET}
@echo
@avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
-rm -rf $(OBJECTS) trial.elf dep/* trial.hex trial.eep trial.lss trial.map


## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…