summaryrefslogtreecommitdiff
path: root/src/makefile
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2022-09-09 18:33:15 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2022-09-09 18:33:15 -0500
commit7b006d6f2032ac46074d693ae59a971bee327ace (patch)
tree60963598d99001e0850e34d6271db8bd65e04fa4 /src/makefile
init
Diffstat (limited to 'src/makefile')
-rw-r--r--src/makefile48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/makefile b/src/makefile
new file mode 100644
index 0000000..67a36c0
--- /dev/null
+++ b/src/makefile
@@ -0,0 +1,48 @@
+#compile options
+TOOLCHAIN_DIR=/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64
+CC=$(TOOLCHAIN_DIR)/bin/avr-gcc
+LD=$(TOOLCHAIN_DIR)/bin/avr-ld
+INC=$(TOOLCHAIN_DIR)/avr/include
+OUT=compiled_payload.elf
+DEVICE=atmega2560
+F_CPU=16000000
+
+DEBUG=1
+
+#avrdude options
+PARTNO=ATmega2560
+PORT=/dev/ttyACM1
+BAUD=115200
+
+
+#baudrate
+RUNTIME_BAUDRATE=9600
+
+
+make:
+ #$(CC) -mmcu=$(DEVICE) -I $(INC) -c debug_serial.o -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 debug_serial.c
+ #$(CC) -mmcu=$(DEVICE) -I $(INC) -c main.o -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 main.c
+ #$(CC) -mmcu=$(DEVICE) -I $(INC) -c debug_serial.o -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 i2c.c
+ #$(LD) -mavr6 -o $(OUT) -s main.o debug_serial.o #TODO wish I knew how to make -mavr6 dependent on DEVICE
+ #TODO no debug.c if debug disabled
+ $(CC) -mmcu=$(DEVICE) -I $(INC) -o $(OUT) -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 main.c debug.c i2c.c ssd1306_display_driver.c uart.c br24t_eeprom_driver.c paint.c -Wall
+ compiledb make --dry-run > /dev/null
+
+eeprom:
+ ./compile_eeprom.py
+
+eeprom_install:
+ $(CC) -lc -mmcu=$(DEVICE) -I $(INC) -o $(OUT) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -DEEPROM_INSTALL -Wall -O1 debug.c i2c.c ssd1306_driver.c uart.c main.c -Wall
+ doas avrdude -v -p $(PARTNO) -P $(PORT) -c wiring -b $(BAUD) -D -U flash:w:$(OUT):e
+ doas ./write_eeprom.py $(PORT) $(SPEED)
+
+
+install: $(OUT)
+ doas avrdude -v -p $(PARTNO) -P $(PORT) -c wiring -b $(BAUD) -D -U flash:w:$(OUT):e
+
+screen:
+ screen $(PORT) $(RUNTIME_BAUDRATE)
+
+clean:
+ rm -f *.o *.elf compiled_eeprom
+