Atmega16: cannot open include<avr/io.h>

Go To Last Post
31 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi,
I need to interface atmega16 and c3088.
include and cannot open in CVAVR.
Please can any1 help me in this. I am new to CVAVR as well as to avr.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The files and are GCC (WinAVR) files and not CVAVR.

Read the CVAVR manuals for the proper way to do I/O and use interrupts.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

for CVAVR you use:

#include 
// there is no 

CVAVR does not supply all the bit names and it uses different names for the interrupt vector numbers.

it looks like you have source written for avr-gcc.

post either your program or a link to it.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.robozes.com/inaki/dpr...

above is the link to the code which i am referring. I am using CVAVR compiler. Therefore i would need help in making the code cvavr compatible.

THANKYOU in advance

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Therefore i would need help

Well looking at it the key thing would be to find any use of SIGNAL() (which is the GCC way of hooking an interrupt vector) and convert this to the CV syntax for interrupts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have intalled avr-gcc in windowsXP.I have used "Programmer Notepad". I had used all the code file found from the link and tried making the file.
First I gave commond Tool>>Make Clean.
then gave Tool>> Make All
and i received following message

make.exe: *** No rule to make target `main.hex', needed by `all'. Stop.

What can i do. I also need to make few changes in the code as i wish to make a robot which works on its own and no eed of human interaction. I need to send commands from computer to the microcontroller to control the directions of robot.

i also dont know how to burn the code in microcontroller. I have downloaded "avrdude gui v0.2.0".

OR

Can i make the hex file using programmer notepad, and then burn the uC from cvavr?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At this point why bother with CVAVR? I don't know if it knows what AVRDUDE is anyway.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

i received following message

make.exe: *** No rule to make target `main.hex', needed by `all'. Stop.


But.. Before that I bet that you got an error
Quote:
In file included from main.c:10:
main.h:11:21: error: i2c-cam.h: No such file or directory

So main.c includes main.h that in turn includes i2c-cam.h but that file can not be found by the compiler (or more correctly, by the C Preprocessor).

As the compiler fails building main.o it can not build main.elf and thus can not build main.hex.

Now look at the source files you actually have, and you will find a file I2C_CAM.H. There are two things that differ in those filenames:
- The makefile filenames are lower-case, but the files in the ZIP you pointed to are upper-case. The avr-gcc tool chain, and GNU Make, stems from the GNU/Linux world and are case sensitive.
- The makefile filename has a dash/hyphen but the actual file in the ZIP has an underscore.
Correct the filename, eg in your file system rename the file to i2c-cam.h and there will pop up another such filename mismatch. Correct that and keep on doing that until you get rid of all mismatches.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am sorry, i forgot to tell you that but i had already rectified that error. Thee filenames in lowercase dont make any problem. Only the HYPHEN instead of a UNDERSCORE was the error.
Now the only problem is of "make.exe".
How can i overcome that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

How can i overcome that?

I have no idea. Yesterday I downloaded the ZIP, unpacked it, did a test build, analyzed the project for those errors and finally threw the project away. All for a problem that you didn't have. I'm out.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe his rectifier was installed backwards?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my apologies to u johan. But I need to get trhough this error son i am left wid only few days to complete my project.
so please help me in "make.exe" error, as mentioned above. and i am done wid the error due to i2c_cam error. please help.
I didnt understand your comment Bob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Assignment time again I see... so instead of writing the code yourself, you thought you could just download and submit something you found on the web... tsk tsk tsk... you'll learn nothing this way.... actually I stand corrected, you will learn one thing.... how to fail!

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

But I need to get trhough this error son i am left wid only few days to complete my project.

So? I also have things to get done within deadlines. My time is also prescious and a scarse resource. Again: I'm out.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As you have found out, you cant compile a gcc project with cv, you cant compile a cv project with gcc. I'd try compiling the cv project with cv. You might get a lot farther.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Quote:

i received following message

make.exe: *** No rule to make target `main.hex', needed by `all'. Stop.


But.. Before that I bet that you got an error
Quote:
In file included from main.c:10:
main.h:11:21: error: i2c-cam.h: No such file or directory

So main.c includes main.h that in turn includes i2c-cam.h but that file can not be found by the compiler (or more correctly, by the C Preprocessor).

As the compiler fails building main.o it can not build main.elf and thus can not build main.hex.

Now look at the source files you actually have, and you will find a file I2C_CAM.H. There are two things that differ in those filenames:
- The makefile filenames are lower-case, but the files in the ZIP you pointed to are upper-case. The avr-gcc tool chain, and GNU Make, stems from the GNU/Linux world and are case sensitive.
- The makefile filename has a dash/hyphen but the actual file in the ZIP has an underscore.
Correct the filename, eg in your file system rename the file to i2c-cam.h and there will pop up another such filename mismatch. Correct that and keep on doing that until you get rid of all mismatches.

I found this is project very interesting to be built. All the hardware part is almost complete. But, while trying to compile the code given, I'm getting following error,

../i2c-cam.h:44:21: error: avr/twi.h: No such file or directory

Has anyone compiled this code successfully? I have already done following things,
1] Changed i2c_cam.h to i2c-cam.h
2] Tried changing to as stated at few places over web. But that increased the number of errors to 88 :(
3] Downloaded twi.h from few places over the web and tried compiling using that, but then compiler asked for "globals.h" and "config.h". After downloading those headers too, "config.h" had an error saying this is for ATMega16 or ATMega164 only. :(

As I have ATMega32L spare with me, I'm compiling this code [originally written for ATMega16] for ATMega32. Is that a concern? Will that pose any problem? Or compiler version is a problem?

Thanks in advance! :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you mean ? If ever in doubt there's always the user manual as the point of last resort:

http://www.nongnu.org/avr-libc/u...

http://www.nongnu.org/avr-libc/u...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys... was just thinking

why don't compiler manufactures make compilers that can read compiler independent code.

or. is there a way that one can slip in a line of text that makes the code seem transparent to any c compiler.

i have worked only with GCC. but sometime come across code by CV or others. I can understand the code easily... but there is always this problem of tranlstion to make the code compiler friendly...

not a big issue.... just thinking!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

why don't compiler manufactures make compilers that can read compiler independent code.

or. is there a way that one can slip in a line of text that makes the code seem transparent to any c compiler.


This is the argument for adhering to the ANSI C Standard as much as possible. If it's written down in the standard and all the compilers adhere to the standard then the code WILL be totally portable. However the problem is that there are areas that the C standard does not cover and in the world of embedded programming this is probably worse than in "normal" C programming. For one thing the standard does not formalise the syntax for interrupt handlers and it seems that everyone who's ever written a C compiler has their own idea of how that should be done. Then the Harvard nature of the AVR makes things worse as the standard only really caters for the Von Neumann architectures for which it was written and does not consider the multiple memory space Harvard architecture in the AVR so things like EEPROM and code flash support will be at the discretion of the compiler implementor. Also the goal in 8 bit embedded micros is to try and emit a lot of 8-bit centric code whereas generic C tends to have a bias towards 32 bit and it's often tricky to try and over-ride this.

Moves are afoot to implement standards for things like Harvard multiple memory spaces so hopefully we will eventually see an across the board solution to that one.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Do you mean ? If ever in doubt there's always the user manual as the point of last resort:

http://www.nongnu.org/avr-libc/u...

http://www.nongnu.org/avr-libc/u...

Yeah, I even tried . But no success.

Got another twi.h from web, now it compiles but error is,

c:/winavr-20071221/bin/../avr/include/avr/twi.h:74: error: expected ';' before numeric constant

What does that mean ?

Last Edited: Wed. Apr 29, 2009 - 05:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

What does that mean ?

It means you cannot just pick files at random and hope that they are going to work. If those code was written by someone else to use a specific TWI library then you need to get a copy of exactly that one and it's associated .h file. Just throwing any twi.h you can find at it and hoping that it's going to magically work is not going to happen.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I downloaded the project, changed file names i2c_cam.h to i2c-cam.h and i2c_cam.c to i2c-cam.c and changed avr\twi.h to util\twi.h in i2c-cam.h and it compiled just fine!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rstahlhu wrote:
I downloaded the project, changed file names i2c_cam.h to i2c-cam.h and i2c_cam.c to i2c-cam.c and changed avr\twi.h to util\twi.h in i2c-cam.h and it compiled just fine!

Then what might be the problem. Which compiler do you use? I have AVR Studio v4.13 Build 528 and WinAVR 20071221. Does that make any difference?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I have AVR Studio v4.13 Build 528 and WinAVR 20071221. Does that make any difference?

Why would you be using versions from several years ago? I'd get 4.16.628 and the 2009 version of WinAVR

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But will that ultimately compile the code. I just wanted to be sure. That's why asked rstahlhu his version.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've still got the Dec 2008 release and I use programmers notepad with the supplied makefile. Have you used the original makefile or the internal one created by Studio?

Randy

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, I got it now. I always use the one created by studio. Don't know how to use original makefile :( Any tutorial to know how to use programmers notepad with the supplied makefile?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just copy all of the files to a directory (I make a projects directory and put code in their own directories under that one). Start PN and open the main.c file (after you change the names mentioned before). Then click Tools-->Make All. The results should appear in the bottom window (you can scroll back to see the results).

You can use the external Makefile from Studio, but I don't do much WINAVR programming and couldn't tell you how. Clif could tell you and it has been discussed before.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks guys! I'm on track now :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So is this still a codevision thread, or a 'newbie wants to know which keys to press to get gcc to work' thread?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

or a 'newbie wants to know which keys to press to get gcc to work' thread?

The latter - you win - moved.