Author Options:

2 questions about avrdude? Answered

first question, in the code, i can get notes ( with // if im correct) but will that influence the file by size?
like if a code is a bit to big, i can simply delete notes and it will be down in size when i flash the chip?

second, can i compile a .c file with avrdude via command prompt or any other way without a makefile? i really get to much problems with makefiles...



Best Answer 8 years ago

I think you are a little confused as to what avrdude does. The two questions you asked are related to avr-gcc, which compiles the code. Avrdude is responsible for uploading the already compiled code onto the microcontroller.

With that in mind, the answer to your first question is; No. When avr-gcc compiles code it will ignore the comments (//) since these are only there to make it more human readable. The machine does not care what is after a // and therefore ignores it. While removing the comments from the .c file will probably reduce the size of the .c file. It will not make the .o (or more importantly, .hex) files any smaller.

Your second question, you can compile a .c file with avr-gcc through a terminal using this command.
avr-gcc -g -O -mmcu=atmega168 -Wall progamsource.c -o programout.o

You will then have to convert the .o file that is made into a .hex file for programming it to the chip. Then you will actually have to program it to the chip using avrdude.

It is in your best interest to just learn how to use a Makefile. It will save you all kinds of time in the end.

ah, i thought avrdude was the name for everything in that package, but its actually avr-gcc?

well, its nice to know that i can go berserk with the notes without the chip complaining about a to big file XD

and that command prompt line, does it work the same way as the avrdude's line to upload a .hex file (ie same tags for chip like t13 for attiny13)
and how would i convert the .o file to a .hex file?

well, maybe its better to know about makefiles, but im a bit confused about them at this moment, so if i can get this to work, it would save alot of time for now.

btw, what are those other files u get from compiling a .c file using PN and a makefile (.elf .lss) and what are the differences (uses) between (for) the .hex, .o and those other files?