______________________________________________________________________
Compilation steps using avrdude:
----------------------------------------------------------------------------------------------------------------
-g --> for debugging symbols
-Os --> for optimisation of the program there are 4 levels in the place of ' s ' you can place 1, 2, 3 , 4.
-c --> for the object file creation
-o --> Renaming the elf file or executable
-j --> used for the seperation of the section from the elf file
ihex --> is used to create the hex file
options for avrdude :
-c --> to tell the microcontrollerthat is the programmer being used
-p --> to tell the microcontroller which is being used
-U --> to tell that perticular file to be burnt or written.
______________________________________________________________________
Setting the fuse bit commands :
----------------------------------------------------------------------------------------------------------------
Writing fuses :
avrdude -c usbasp -p m8 -U lfuse:w:0xD9:m -U hfuse:w:0xD1:m
Reading fuses :
Never ever make SPI fuse to '1' if you make it you couldn't program your microcontroller as it dissables the function. Again using Parallel programmer you should make that pin as high which is very costly . so , never even try doing this ok. if you have parallel programmer try this otherwise no need.
Once you did this its no use until you reprogram it . you couldn't do this with your programmer because your programmer itself is not read by the microcontroller if you dissable that pin. so be carefull.
________________________________________________________________________
Setting the lock bits :
-------------------------------------------------------------------------------------------------------------------
Same as the fuse bits programming but these bits have special feature that it can protect your application section and bootloader section as well preventing others to see your hex file or not even to read the sections . Nice know but we don't use at present . so lets go into how to compile
Compilation steps using avrdude:
----------------------------------------------------------------------------------------------------------------
avr-gcc -g -Os -mmcu=atmega8 -c file.c
avr-gcc file.o -o file
avr-objcopy -j .text -j .data -O ihex file file.hex
avrdude -c usbasp -p m8 -U file.hex
option of gcc and objcopy:-g --> for debugging symbols
-Os --> for optimisation of the program there are 4 levels in the place of ' s ' you can place 1, 2, 3 , 4.
-c --> for the object file creation
-o --> Renaming the elf file or executable
-j --> used for the seperation of the section from the elf file
ihex --> is used to create the hex file
options for avrdude :
-c --> to tell the microcontrollerthat is the programmer being used
-p --> to tell the microcontroller which is being used
-U --> to tell that perticular file to be burnt or written.
______________________________________________________________________
Setting the fuse bit commands :
----------------------------------------------------------------------------------------------------------------
Writing fuses :
avrdude -c usbasp -p m8 -U lfuse:w:0xD9:m -U hfuse:w:0xD1:m
Reading fuses :
avrdude -v -c usbasp -p m8 -U lfuse:r:low.txt:r -U hfuse:r:high.txt:r
Never ever make SPI fuse to '1' if you make it you couldn't program your microcontroller as it dissables the function. Again using Parallel programmer you should make that pin as high which is very costly . so , never even try doing this ok. if you have parallel programmer try this otherwise no need.
Once you did this its no use until you reprogram it . you couldn't do this with your programmer because your programmer itself is not read by the microcontroller if you dissable that pin. so be carefull.
________________________________________________________________________
Setting the lock bits :
-------------------------------------------------------------------------------------------------------------------
Same as the fuse bits programming but these bits have special feature that it can protect your application section and bootloader section as well preventing others to see your hex file or not even to read the sections . Nice know but we don't use at present . so lets go into how to compile
avrdude -c usbasp -p m8 -U lock:w:0x3f:m
_________________________________________________________________________
EEPROM PROGRAMMING :
---------------------------------------------------------------------------------------------------------------------
In order to make eeprom perfectly work you should make EESAVE fuse bit programmed . EESAVE = '0'.
If you don't make it programmed and even though you store the values at the eeprom they doen't store they will also be get erased while flash write . everything will be cleared. so in order to tell the microcontroller to no clear the eeprom we use EESAVE fuse bit which will be present in high fuse.
Keep this in mind while you are programming an eeprom program .
Lets deal with this section someother time in detail.ok .i hope in this session you learnt how to compile the file .
Here are the Steps for creating the binary file of a perticular file see this POST
Lets deal with this section someother time in detail.ok .i hope in this session you learnt how to compile the file .
Here are the Steps for creating the binary file of a perticular file see this POST
No comments:
Post a Comment