From 1824ee6a071943c4d3989ccb18d2827a5985c3d9 Mon Sep 17 00:00:00 2001 From: grouille Date: Mon, 9 Mar 2020 15:16:08 +0100 Subject: [PATCH] Ajout du dossier complet Raspberry --- EXEC/Build/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ EXEC/Build/main.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXEC/Rpi_to_server.py | 24 ++++++++++++++++++++++++ EXEC/binaire.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EXEC/load.sh | 10 ++++++++++ EXEC/script.sh | 7 +++++++ 6 files changed, 311 insertions(+), 0 deletions(-) create mode 100644 EXEC/Build/Makefile create mode 100755 EXEC/Build/main.c create mode 100755 EXEC/Rpi_to_server.py create mode 100755 EXEC/binaire.c create mode 100755 EXEC/load.sh create mode 100755 EXEC/script.sh diff --git a/EXEC/Build/Makefile b/EXEC/Build/Makefile new file mode 100644 index 0000000..d501813 --- /dev/null +++ b/EXEC/Build/Makefile @@ -0,0 +1,42 @@ +export CC = avr-gcc + +export MCU = atmega328p +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 = blink +CPPFLAGS = -mmcu=$(MCU) +PGMERISP = -c pi_3 +ARVDUDECONF= -C ~/avrdude_gpio.conf +export DUDE = avrdude -v -p $(MCU) $(AVRDUDECONF) + +C_SRC = $(wildcard *.c) +OBJS = $(C_SRC:.c=.o) + + +all: $(TARGET).hex + + +clean: + rm -f *.o *.hex *.elf build-uno + +%.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 + $(DUDE) $(PGMERISP) -U flash:w:$(TARGET).hex + +size: $(TARGET).elf + avr-size --format=avr --mcu=$(MCU) $(TARGET).elf + diff --git a/EXEC/Build/main.c b/EXEC/Build/main.c new file mode 100755 index 0000000..4ca1fe9 --- /dev/null +++ b/EXEC/Build/main.c @@ -0,0 +1,114 @@ +#include // for the input/output register +#include +#include +#include +#include +#include +#define PRESCALER 1024 +#define TIME_SLOT 20 +#define BAUDRATE 103 + +#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) +#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) + +char Donnee[24]; +float temp; + +void init_serial(void) +{ + /* ACHTUNG : we suppose UBRR value < 0xff */ + /* Not true in all case */ + uint8_t baudrate = BAUDRATE; + /* Set baud rate */ + UBRR0H = 0; + UBRR0L = baudrate; + /* Enable transmitter *///task_led_red(); + //task_send_serial('A'); + UCSR0B = (1< // for the input/output register +#include +#include +#include +#include +#include +#define PRESCALER 1024 +#define TIME_SLOT 20 +#define BAUDRATE 103 + +#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) +#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) + +char Donnee[24]; +float temp; + +void init_serial(void) +{ + /* ACHTUNG : we suppose UBRR value < 0xff */ + /* Not true in all case */ + uint8_t baudrate = BAUDRATE; + /* Set baud rate */ + UBRR0H = 0; + UBRR0L = baudrate; + /* Enable transmitter *///task_led_red(); + //task_send_serial('A'); + UCSR0B = (1<