avr:linux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
avr:linux [2013/08/30 09:25] – sdolt | avr:linux [2013/09/10 13:09] – sdolt | ||
---|---|---|---|
Line 28: | Line 28: | ||
</ | </ | ||
- | ===== Premier programme | + | ====== Utilisation ====== |
- | + | ||
- | Squelette de base pour les programmes AVR à créer dans un fichier main.c | + | |
- | < | + | |
- | # | + | |
- | # | + | |
- | #define F_CPU 1000000UL // | + | |
- | # | + | |
- | + | ||
- | int main(void) | + | |
- | { | + | |
- | return(0); | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Câblage pour STK500 ===== | + | |
- | + | ||
- | [[http:// | + | |
- | + | ||
- | ===== Compilation et programmation ===== | + | |
- | + | ||
- | Les commandes ci-dessous compile le fichier main.c en fichier main.elf, puis convertisse le fichier elf en fichier hex qui est ensuite programmé dans notre micro-processeur. | + | |
- | + | ||
- | Bien sur, il faut adapter les options au type de microprocesseur et au programmateur utilisé | + | |
- | ^uP^GCC^AVRDUDE^ | + | |
- | |ATtiny85|attiny85|t85| | + | |
- | |Autre|voir : [[http:// | + | |
- | + | ||
- | ^Programmateur^AVRDUDE^ | + | |
- | |Atmel STK500|stk500| | + | |
- | |Autre|Voir [[http:// | + | |
- | + | ||
- | + | ||
- | < | + | |
- | avr-gcc -mmcu=attiny85 -o main.elf main.c | + | |
- | objcopy -O ihex -R .eeprom main.elf main.hex | + | |
- | avrdude -p t85 -c stk500 -P / | + | |
- | + | ||
- | + | ||
- | </ | + | |
- | + | ||
- | ===== Déboguage ===== | + | |
- | + | ||
- | Debug-wire est une norme de communication basée sur le one-wire permettant une programmation basique ainsi que le déboguage de la série ATtiny. | + | |
- | + | ||
- | ==== Initialisation ==== | + | |
- | + | ||
- | Pour l' | + | |
- | des fusibles de configurations à l'aide du STK500 | + | |
- | <note important> | + | |
- | + | ||
- | Exemple pour l' | + | |
- | < | + | |
- | avrdude -p t85 -c stk500 -P / | + | |
- | </ | + | |
- | + | ||
- | ==== Câblage du JTAGICE mkII pour debug-wire ==== | + | |
- | + | ||
- | Il faut brancher trois câble : | + | |
- | ^STK500 PORTB^JTAGICE^ | + | |
- | |PB5|6-nSRST| | + | |
- | |VTG|4-VTREF| | + | |
- | |GND|2-GND| | + | |
- | + | ||
- | ==== Compilation et programmation ==== | + | |
- | + | ||
- | <note important> | + | |
- | + | ||
- | < | + | |
- | avr-gcc -g -mmcu=attiny85 -o main.elf main.c | + | |
- | objcopy -O ihex -R .eeprom main.elf main.hex | + | |
- | avrdude -c jtag2dw -P usb -p t85 -U flash: | + | |
- | </ | + | |
- | + | ||
- | Si l' | + | |
- | + | ||
- | ==== Déboguage ==== | + | |
- | + | ||
- | Pour débuguer, il faut tout d' | + | |
- | < | + | |
- | avarice -2 -w -P attiny85 --jtag usb :4242 | + | |
- | </ | + | |
- | Puis, dans un autre terminal, on lance avr-gdb: | + | |
- | < | + | |
- | avr-gdb main.elf | + | |
- | </ | + | |
- | + | ||
- | Dans l' | + | |
- | < | + | |
- | target remote :4242 | + | |
- | </ | + | |
- | + | ||
- | ==== Commande GDB ==== | + | |
- | + | ||
- | ^Commande^Effet^ | + | |
- | |continue|Continue jusqu' | + | |
- | |break main.c: | + | |
- | |break initADC|Met un point d' | + | |
- | |print variable|Affiche la variable si le programme est à l' | + | |
- | |set variable hello = 12|Met la variable hello à la valeur 12| | + | |
- | + | ||
- | Tutoriel : [[http:// | + | |
- | Info : | + | |
- | + | ||
- | ===== Liens utiles | + | |
- | + | ||
- | ^Description^Liens^ | + | |
- | |Calculateur de fusible|[[http:// | + | |
+ | Vous pouvez ensuite suivre les instructions |
avr/linux.txt · Last modified: 2013/09/18 12:53 by sdolt