started fixing makefile, created test function
This commit is contained in:
parent
b666668d0e
commit
a5984050eb
BIN
src/build/br24t_eeprom_driver.o
Normal file
BIN
src/build/br24t_eeprom_driver.o
Normal file
Binary file not shown.
BIN
src/build/debug.o
Normal file
BIN
src/build/debug.o
Normal file
Binary file not shown.
BIN
src/build/i2c.o
Normal file
BIN
src/build/i2c.o
Normal file
Binary file not shown.
BIN
src/build/main.o
Normal file
BIN
src/build/main.o
Normal file
Binary file not shown.
BIN
src/build/paint.o
Normal file
BIN
src/build/paint.o
Normal file
Binary file not shown.
BIN
src/build/pcf_clock_driver.o
Normal file
BIN
src/build/pcf_clock_driver.o
Normal file
Binary file not shown.
BIN
src/build/ssd1306_display_driver.o
Normal file
BIN
src/build/ssd1306_display_driver.o
Normal file
Binary file not shown.
BIN
src/build/uart.o
Normal file
BIN
src/build/uart.o
Normal file
Binary file not shown.
@ -3,16 +3,17 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-v",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"-o",
|
||||
"build/main.o",
|
||||
"main.c"
|
||||
],
|
||||
"file": "main.c"
|
||||
@ -21,21 +22,18 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-lc",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload.elf",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"main.c",
|
||||
"debug_serial.c",
|
||||
"i2c.c",
|
||||
"ssd1306_driver.h"
|
||||
"-o",
|
||||
"build/i2c.o",
|
||||
"i2c.c"
|
||||
],
|
||||
"file": "i2c.c"
|
||||
},
|
||||
@ -43,22 +41,18 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload.elf",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"main.c",
|
||||
"debug.c",
|
||||
"i2c.c",
|
||||
"ssd1306_driver.c",
|
||||
"uart.c",
|
||||
"-Wall"
|
||||
"-o",
|
||||
"build/uart.o",
|
||||
"uart.c"
|
||||
],
|
||||
"file": "uart.c"
|
||||
},
|
||||
@ -66,23 +60,18 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload.elf",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"main.c",
|
||||
"debug.c",
|
||||
"i2c.c",
|
||||
"ssd1306_display_driver.c",
|
||||
"uart.c",
|
||||
"br24t_eeprom_driver.c",
|
||||
"-Wall"
|
||||
"-o",
|
||||
"build/br24t_eeprom_driver.o",
|
||||
"br24t_eeprom_driver.c"
|
||||
],
|
||||
"file": "br24t_eeprom_driver.c"
|
||||
},
|
||||
@ -90,24 +79,18 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload.elf",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"main.c",
|
||||
"debug.c",
|
||||
"i2c.c",
|
||||
"ssd1306_display_driver.c",
|
||||
"uart.c",
|
||||
"br24t_eeprom_driver.c",
|
||||
"paint.c",
|
||||
"-Wall"
|
||||
"-o",
|
||||
"build/paint.o",
|
||||
"paint.c"
|
||||
],
|
||||
"file": "paint.c"
|
||||
},
|
||||
@ -115,26 +98,57 @@
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-mmcu=atmega2560",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-o",
|
||||
"compiled_payload.elf",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"main.c",
|
||||
"debug.c",
|
||||
"i2c.c",
|
||||
"ssd1306_display_driver.c",
|
||||
"uart.c",
|
||||
"br24t_eeprom_driver.c",
|
||||
"paint.c",
|
||||
"pcf_clock_driver.c",
|
||||
"-Wall"
|
||||
"-o",
|
||||
"build/pcf_clock_driver.o",
|
||||
"pcf_clock_driver.c"
|
||||
],
|
||||
"file": "pcf_clock_driver.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"-o",
|
||||
"build/debug.o",
|
||||
"debug.c"
|
||||
],
|
||||
"file": "debug.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/indigo/projects/watch/src",
|
||||
"arguments": [
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc",
|
||||
"-c",
|
||||
"-I",
|
||||
"/home/indigo/packs/avr8-gnu-toolchain-linux_x86_64/avr/include",
|
||||
"-mmcu=atmega2560",
|
||||
"-DDEBUG_BUILD=1",
|
||||
"-DBAUD=9600",
|
||||
"-DF_CPU=16000000",
|
||||
"-Wall",
|
||||
"-O1",
|
||||
"-o",
|
||||
"build/ssd1306_display_driver.o",
|
||||
"ssd1306_display_driver.c"
|
||||
],
|
||||
"file": "ssd1306_display_driver.c"
|
||||
}
|
||||
]
|
||||
|
@ -4,9 +4,7 @@
|
||||
#include <util/delay.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#ifdef DEBUG_BUILD
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
|
@ -21,11 +21,6 @@
|
||||
* organize i2c eeprom/timer code
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef FLASH_EEPROM
|
||||
int main() {
|
||||
LED_DEBUG_DDR |= _BV(LED_DEBUG); //TODO move to debug file or somethin
|
||||
|
24
src/makefile
24
src/makefile
@ -1,7 +1,6 @@
|
||||
#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
|
||||
@ -21,16 +20,19 @@ BAUD=115200
|
||||
#baudrate
|
||||
RUNTIME_BAUDRATE=9600
|
||||
|
||||
SRCFILES := $(wildcard *.c)
|
||||
OBJFILES := $(patsubst %.c,build/%.o,$(SRCFILES))
|
||||
|
||||
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 pcf_clock_driver.c -Wall
|
||||
|
||||
make: $(OBJFILES)
|
||||
echo $(SRCFILES)
|
||||
$(CC) -DDEBUG_BUILD=$(DEBUG) -mmcu=$(DEVICE) -o $(OUT) $(OBJFILES)
|
||||
compiledb make --dry-run > /dev/null
|
||||
|
||||
build/%.o: %.c
|
||||
if [ ! -d "build" ]; then mkdir -p build; fi
|
||||
$(CC) $(CCOPTS) -c -I $(INC) -mmcu=$(DEVICE) -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 -o $@ $<
|
||||
|
||||
reset:
|
||||
doas avrdude -c usbtiny -p $(PARTNO)
|
||||
|
||||
@ -41,8 +43,8 @@ eeprom_write:
|
||||
eeprom:
|
||||
./compile_eeprom.py
|
||||
|
||||
eeprom_install:
|
||||
$(CC) -mmcu=atmega2560 -I $(INC) -o $(OUT) -DFLASH_EEPROM -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
|
||||
#eeprom_install:
|
||||
#$(CC) -mmcu=atmega2560 -I $(INC) -o $(OUT) -DFLASH_EEPROM -DDEBUG_BUILD=$(DEBUG) -DBAUD=$(RUNTIME_BAUDRATE) -DF_CPU=$(F_CPU) -Wall -O1 main.c debug.c i-DDEBUG_BUILD=$(DEBUG)2c.c ssd1306_display_driver.c uart.c br24t_eeprom_driver.c paint.c -Wall
|
||||
doas avrdude -B 1 -v -p ATmega2560 -c usbtiny -U flash:w:$(OUT):e
|
||||
|
||||
|
||||
@ -56,5 +58,5 @@ screen:
|
||||
doas screen $(DEBUG_PORT) $(RUNTIME_BAUDRATE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.elf compiled_eeprom
|
||||
rm -f *.o *.elf compiled_eeprom build/*
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ssd1306_display_driver.h"
|
||||
#include "paint.h"
|
||||
@ -19,6 +20,7 @@
|
||||
|
||||
void screen_clear() { memset(&screen_buffer, 0, sizeof(screen_buffer)); }
|
||||
|
||||
|
||||
//images are optimized to follow page formatting
|
||||
void draw_image(EEPROM_ADDR image) {
|
||||
for(int on_pix = 0; on_pix < (SCREEN_RES_X * SCREEN_RES_Y) / 8; on_pix++)
|
||||
|
@ -73,6 +73,7 @@ void screen_init() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void screen_off() { i2c_write_reg(SSD1306_ADDR, SSD1306_CMD_REG, 0xaf); }
|
||||
|
||||
void screen_on() { i2c_write_reg(SSD1306_ADDR, SSD1306_CMD_REG, 0xae); }
|
||||
@ -86,3 +87,10 @@ void screen_update() {
|
||||
}
|
||||
}
|
||||
|
||||
void screen_test() {
|
||||
printf("testing screen\n");
|
||||
for(int on_pix = 0; on_pix < (SCREEN_RES_X * SCREEN_RES_Y) / 8; on_pix++)
|
||||
screen_buffer[on_pix] = 0b10101010;
|
||||
printf("done testing screen\n");
|
||||
screen_update();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user