Commit bdb410919213e33c44b7c3968a78165870d1fcfe
1 parent
2056d0e3
MAJ
Showing
3 changed files
with
19 additions
and
19 deletions
Show diff stats
codes/Makefile
@@ -6,47 +6,41 @@ export TARGET_ARCH = -mmcu=$(MCU) | @@ -6,47 +6,41 @@ export TARGET_ARCH = -mmcu=$(MCU) | ||
6 | export CFLAGS = -Wall -I. -DF_CPU=16000000 -Os #-pedantic -std=c99#-g | 6 | export CFLAGS = -Wall -I. -DF_CPU=16000000 -Os #-pedantic -std=c99#-g |
7 | export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections # -Os | 7 | export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections # -Os |
8 | 8 | ||
9 | -TARGET = libretour | ||
10 | -TERM0 = /dev/ttyACM0 | ||
11 | -TERM1 = /dev/ttyACM1 | 9 | +TARGET = main |
10 | +TERM0 = /dev/ttyPR0 | ||
11 | +TERM1 = /dev/ttyPR1 | ||
12 | CPPFLAGS = -mmcu=$(MCU) | 12 | CPPFLAGS = -mmcu=$(MCU) |
13 | #PGMER = -c stk500v1 -b 57600 -P $(TERM) | 13 | #PGMER = -c stk500v1 -b 57600 -P $(TERM) |
14 | + | ||
14 | #Dans le cas de l'upload par USB (selon le port) | 15 | #Dans le cas de l'upload par USB (selon le port) |
15 | PGMERISP0 = -c stk500v1 -b 115200 -P $(TERM0) | 16 | PGMERISP0 = -c stk500v1 -b 115200 -P $(TERM0) |
16 | PGMERISP1 = -c stk500v1 -b 115200 -P $(TERM1) | 17 | PGMERISP1 = -c stk500v1 -b 115200 -P $(TERM1) |
17 | -ARVDUDECONF= -C /usr/local/arduino/arduino-0021/hardware/tools/avrdude.conf | 18 | +ARVDUDECONF= -C /etc/avrdude.conf |
18 | export DUDE = /usr/bin/avrdude -F -v -p $(MCU) $(AVRDUDECONF) | 19 | export DUDE = /usr/bin/avrdude -F -v -p $(MCU) $(AVRDUDECONF) |
20 | + | ||
19 | #Dans le cas de l'upload par SPI depuis la raspberry | 21 | #Dans le cas de l'upload par SPI depuis la raspberry |
20 | PGMERISP_RPI = -c pi_3 | 22 | PGMERISP_RPI = -c pi_3 |
21 | ARVDUDECONF_RPI = -C ~/avrdude_gpio.conf | 23 | ARVDUDECONF_RPI = -C ~/avrdude_gpio.conf |
22 | -export DUDE_RPI = avrdude -v -p $(MCU) $(AVRDUDECONF_RPI) | 24 | +export DUDE_RPI = /usr/bin/avrdude -F -v -p $(MCU) $(AVRDUDECONF_RPI) |
23 | 25 | ||
24 | -CLIB=ar cq | ||
25 | C_SRC = $(wildcard *.c) | 26 | C_SRC = $(wildcard *.c) |
26 | OBJS = $(C_SRC:.c=.o) | 27 | OBJS = $(C_SRC:.c=.o) |
27 | 28 | ||
28 | -all: $(TARGET).a | ||
29 | - | 29 | +all: $(TARGET).hex |
30 | 30 | ||
31 | clean: | 31 | clean: |
32 | - rm -f *.o *.hex *.elf *.a build-uno | ||
33 | - | ||
34 | -$(TARGET).o: $(TARGET).c $(TARGET).h | ||
35 | - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ | 32 | + rm -f *.o *.hex *.elf |
36 | 33 | ||
34 | +%.o:%.c | ||
35 | + $(CC) -c $< $(CPPFLAGS) $(CFLAGS) | ||
37 | 36 | ||
38 | $(TARGET).elf: $(OBJS) | 37 | $(TARGET).elf: $(OBJS) |
39 | - $(CC) $(LDFLAGS) -o $@ $(OBJS) | 38 | + $(CC) -o $@ $^ $(LDFLAGS) |
40 | 39 | ||
41 | $(TARGET).hex: $(TARGET).elf | 40 | $(TARGET).hex: $(TARGET).elf |
42 | avr-objcopy -j .text -j .data -O ihex $(TARGET).elf $(TARGET).hex | 41 | avr-objcopy -j .text -j .data -O ihex $(TARGET).elf $(TARGET).hex |
43 | avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $(TARGET).elf eeprom.hex | 42 | avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $(TARGET).elf eeprom.hex |
44 | 43 | ||
45 | -$(TARGET).a: $(TARGET).o | ||
46 | - rm -rf $@ | ||
47 | - $(CLIB) $@ $+ | ||
48 | - | ||
49 | - | ||
50 | #UPLOAD CONDITIONNEL | 44 | #UPLOAD CONDITIONNEL |
51 | FOLDER = $(notdir $(CURDIR)) | 45 | FOLDER = $(notdir $(CURDIR)) |
52 | 46 |
site/fichiersRPI/port.sh
@@ -12,6 +12,7 @@ commande=$(udevadm info --name=$name --attribute-walk | egrep "idVendor|idProduc | @@ -12,6 +12,7 @@ commande=$(udevadm info --name=$name --attribute-walk | egrep "idVendor|idProduc | ||
12 | idProduct=$(echo $commande | cut -f 1 -d " ") | 12 | idProduct=$(echo $commande | cut -f 1 -d " ") |
13 | idVendor=$(echo $commande | cut -f 2 -d " ") | 13 | idVendor=$(echo $commande | cut -f 2 -d " ") |
14 | serial=$(echo $commande | cut -f 3 -d " ") | 14 | serial=$(echo $commande | cut -f 3 -d " ") |
15 | +#echo $commande | ||
15 | #echo $idProduct | 16 | #echo $idProduct |
16 | #echo $idVendor | 17 | #echo $idVendor |
17 | #echo $serial | 18 | #echo $serial |
@@ -20,5 +21,5 @@ newname="$newdev$port" | @@ -20,5 +21,5 @@ newname="$newdev$port" | ||
20 | #echo $newname | 21 | #echo $newname |
21 | rule="SUBSYSTEM==\"tty\", $serial, $idVendor, $idProduct, SYMLINK+=\"$newname\"" | 22 | rule="SUBSYSTEM==\"tty\", $serial, $idVendor, $idProduct, SYMLINK+=\"$newname\"" |
22 | #echo $rule | 23 | #echo $rule |
23 | -echo $rule > /etc/udev/rules.d/usb-serial.rules | 24 | +echo $rule >> /etc/udev/rules.d/usb-serial.rules |
24 | udevadm trigger | 25 | udevadm trigger |
site/fichiersRPI/script.sh
@@ -2,6 +2,11 @@ | @@ -2,6 +2,11 @@ | ||
2 | 2 | ||
3 | echo $$ > /var/run/script.pid | 3 | echo $$ > /var/run/script.pid |
4 | 4 | ||
5 | +echo 4 > /sys/class/gpio/unexport | ||
6 | +echo 9 > /sys/class/gpio/unexport | ||
7 | +echo 10 > /sys/class/gpio/unexport | ||
8 | +echo 11 > /sys/class/gpio/unexport | ||
9 | + | ||
5 | sudo make clean | 10 | sudo make clean |
6 | sudo make | 11 | sudo make |
7 | sudo make upload | 12 | sudo make upload |