summaryrefslogtreecommitdiff
path: root/n/avr/howto
diff options
context:
space:
mode:
Diffstat (limited to 'n/avr/howto')
-rw-r--r--n/avr/howto/avr-Makefile69
-rw-r--r--n/avr/howto/howto-avr.txt34
2 files changed, 103 insertions, 0 deletions
diff --git a/n/avr/howto/avr-Makefile b/n/avr/howto/avr-Makefile
new file mode 100644
index 0000000..ec87ca3
--- /dev/null
+++ b/n/avr/howto/avr-Makefile
@@ -0,0 +1,69 @@
+PRG = example
+OBJ = example.o
+# Principalemet atmega8 ou atmega8535
+MCU_TARGET = atmega8
+OPTIMIZE = -O2
+
+DEFS =
+LIBS =
+
+# You should not have to change anything below here.
+
+CC = avr-gcc
+
+CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
+LDFLAGS = -Wl,-Map,$(PRG).map
+
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+
+all: elf lst hex
+
+elf: $(PRG).elf
+lst: $(PRG).lst
+
+$(PRG).elf: $(OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+%.lst: %.elf
+ $(OBJDUMP) -h -S $< > $@
+
+clean:
+ rm -f *.o $(PRG).elf *.bak
+ rm -f *.lst *.map $(EXTRA_CLEAN_FILES)
+ rm -f $(PRG).hex $(PRG).bin $(PRG).srec $(PRG)_eeprom.hex $(PRG)_eeprom.bin $(PRG)_eeprom.srec
+
+# Rules for building the .text rom images.
+
+text: hex bin srec
+
+hex: $(PRG).hex
+bin: $(PRG).bin
+srec: $(PRG).srec
+
+%.hex: %.elf
+ $(OBJCOPY) -j .text -j .data -O ihex $< $@
+
+%.srec: %.elf
+ $(OBJCOPY) -j .text -j .data -O srec $< $@
+
+%.bin: %.elf
+ $(OBJCOPY) -j .text -j .data -O binary $< $@
+
+# Rules for building the .eeprom rom images.
+
+eeprom: ehex ebin esrec
+
+ehex: $(PRG)_eeprom.hex
+ebin: $(PRG)_eeprom.bin
+esrec: $(PRG)_eeprom.srec
+
+%_eeprom.hex: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
+
+%_eeprom.srec: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
+
+%_eeprom.bin: %.elf
+ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
+
diff --git a/n/avr/howto/howto-avr.txt b/n/avr/howto/howto-avr.txt
new file mode 100644
index 0000000..2376745
--- /dev/null
+++ b/n/avr/howto/howto-avr.txt
@@ -0,0 +1,34 @@
+*Title: Howto AVR
+*Author: Ni
+
+* Intro
+
+On utilisera principalement des ATmega8 et des ATmega8535. Ce sont des
+microcontrolleur 8 bits, avec 8 Ko de flash, 16 Mips, 28 ou 40 pattes, 1 Ko de
+ram, un bus TWI, SPI, un USART, la programmation en circuit, des entrées
+analogiques, des sorties PWM... Le tout pour 6 Euros.
+
+* Les sites à aller voir
+
+ [http://www.atmel.com/products/avr/] Lire la datasheet du ATmega8.
+ L'ATmega8535 ne différe que par le nombre de pattes et la ram.
+ Regarder les app-notes.
+
+ [http://www.avrfreaks.net/] Pas mal d'infos sur les AVRs, un forum,
+ des projets examples...
+
+ [http://www.nongnu.org/avr-libc/] Le site de la libc pour AVR. Tout ce
+ qu'il faut pour développer. _Lire_ particulièrement la doc, de haut en
+ bas. Il y a un programme d'exemple, mais on ne devrais pas manquer de
+ programmes d'exemples au robot d'ici quelque jours.
+
+* Les outils de dev.
+
+Sur le serveur du robot : gcc.
+
+Sur les Windows, on peut faire fonctionner gcc avec AVR Studio.
+
+Pour la programmation, il y a avrdude, programmation de l'AVR avec 3 fils.
+
+Le fichier avr-Makefile livré avec cet howto peut être utilisé pour compiler
+les projets.