Eclipse Compiling error with AVR

Status
Not open for further replies.
Dear All
I'v used Eclipse to create a simple AVr application for ATMEGA8A, but after compiling the code i got an errors which is generated with any avr application coded by the Eclipse,so pls help to solve these errors
my code is

Code:
#include <avr/io.h>
int main()
{
   DDRC |= 1<<PC0;
   while(1)
   {
     PORTC0 ^= 1<<PC0;
   }
}

and the errors are
make: *** [LedOnOff.o] Error 1
recipe for target 'LedOnOff.o' failed

and the details for the auto generated make file ,which contain the errors belong to subdir.mk file


################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../LedOnOff.c
OBJS += \
./LedOnOff.o
C_DEPS += \
./LedOnOff.d
# Each subdirectory must supply rules for building sources it contributes
%.o: ../%.c
echo 'Building file: $<' "the error is here"
echo 'Invoking: AVR Compiler'
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega8a -DF_CPU=16000000UL -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
echo 'Finished building: $<'
echo ' '


and the toolchain configuration as below

AVR-GCC C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin
GNU Make C:\Program Files (x86)\Atmel\Studio\7.0\shellutils
AVR Header Files C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include
AVRDude C:\Program Files (x86)\Arduino\hardware\tools\avr\bin


many thanks
 
I'm guessing your file is called LedOnOff.c and I would suspect that the compiler can't find it.

Mike.
 
I see some possible errors there.

First is You have to create a project with Your IDE.
There was normally a project file created, without Your knowlegde.
The name and the ending depends of Your IDE.
In a section of this project file is the startfile declared ( normally main.c ).
This is the startpoint of compiling.
Additional i would write the shift options into brackets.
You wrote
DDRC |= 1<<PC0;
I'll suggest
DDRC |=( 1<<PC0);

AVR GCC want to have a void here
int main(void)

When all having done this, it should compile and work.
 
sorry, I've did all the recommended instructions , but I've got the same error
 
I've tried Your code in ATMEL Studio 7, and it works after debugging?!
 

Attachments

  • LedOnOff.zip
    18.3 KB · Views: 243
Why do you need to use eclipse? I thought Atmel studio is bundled with an IDE... Eclipse is complicated.. I tried it with the android platform and gave up!! Some IDE's do not like multiple file compilation... If I were you I would just use Atmel Studio...
 

Thanks lan rogers for your advise which i will do

also thanks to wkrug
 
As a side note.. Do you use Proteus?? If you do it ships with VSM .. This is one of the best programming IDE's I have... It see's EVERY compiler I own and will compile link and assemble all of them..

I also use Textpad 8 but this needs a payment!!
 
I use pics predominately. But the process is the same... Start a new project in Proteus, select the Avr processor then the compiler.. t will start you off with a small skeletal program..
 
I don't know the Proteus IDE, but the standard IDE for ATMEL controllers is STUDIO x.x.
Version STUDIO 6 was overloaded with features.
STUDIO 7 is much smaller and works very good.
The syntax is like AVR GCC so You can find much support in the Internet.
STUDIO 7 is free to download an use.

An easy way to start is with CodeVision AVR.
For small projects the evaluation Software is free ( max 2k of code ).
A few features are not availible in the free version.
The most convinient feature is the Automatic Programm Generator ( APG ).
The full Version costs near 200$ including 1 Year support.
I guess that is to expensive for an hobbyist.
The syntax is a little different from AVR GCC.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…