diff --git a/README.md b/README.md index 04859cd..e466e89 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,4 @@ Git du projet CREP (projet IMA 2019 P42) + diff --git a/tests/atmega2560/makefile b/tests/atmega2560/makefile new file mode 100644 index 0000000..2c414c6 --- /dev/null +++ b/tests/atmega2560/makefile @@ -0,0 +1,37 @@ +export CC = avr-gcc + +export MCU = atmega2560 +export TARGET_ARCH = -mmcu=$(MCU) + +export CFLAGS = -Wall -I. -DF_CPU=16000000 -Os #-g +export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections # -Os + +TARGET = usb +TERM = /dev/ttyACM0 +CPPFLAGS = -mmcu=$(MCU) +PGMERISP = -c stk500v2 -b 115200 -P $(TERM) +ARVDUDECONF= -C /usr/local/arduino/arduino-0022/hardware/tools/avrdude.conf +export DUDE = /usr/bin/avrdude -F -v -p $(MCU) $(AVRDUDECONF) + +C_SRC = $(wildcard *.c) +OBJS = $(C_SRC:.c=.o) + +all: $(TARGET).hex + +clean: + rm -f *.o *.hex *.elf + +%.o:%.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + +$(TARGET).elf: $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) + +$(TARGET).hex: $(TARGET).elf + avr-objcopy -j .text -j .data -O ihex $(TARGET).elf $(TARGET).hex + avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $(TARGET).elf eeprom.hex + +upload: $(TARGET).hex + stty -F $(TERM) hupcl # reset + $(DUDE) $(PGMERISP) -U flash:w:$(TARGET).hex + make clean diff --git a/tests/atmega2560/servoControl.c b/tests/atmega2560/servoControl.c new file mode 100644 index 0000000..b182287 --- /dev/null +++ b/tests/atmega2560/servoControl.c @@ -0,0 +1,14 @@ +#include +#include + +int main(void){ + DDRC = 0x01; + + while(1){ + PORTC = 0x01; + _delay_ms(200); + PORTC = 0x00; + _delay_ms(200); + } + return 0; +} diff --git a/usefulllinks.txt b/usefulllinks.txt new file mode 100644 index 0000000..8dacce2 --- /dev/null +++ b/usefulllinks.txt @@ -0,0 +1,2 @@ +https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf + -- libgit2 0.21.2