From 9fbd6e95e7077548260c64f4671741fd3c6aaefb Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 5 Feb 2025 14:31:43 +0100 Subject: [PATCH 1/3] makefile -> Makefile --- makefile => Makefile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename makefile => Makefile (100%) diff --git a/makefile b/Makefile similarity index 100% rename from makefile rename to Makefile From bcb7407ca923b41c3ef503f673caa11815ca707d Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 5 Feb 2025 14:45:00 +0100 Subject: [PATCH 2/3] Converting to c99, removing gnu specific features --- 74C922.h | 1 + GDM1602K.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/74C922.h b/74C922.h index a7ac22c..cda3d20 100644 --- a/74C922.h +++ b/74C922.h @@ -1,6 +1,7 @@ #ifndef H74C922_H #define H74C922_H #include +#include // Pin Definitions #define ENCODER_A_PIN PD6 diff --git a/GDM1602K.c b/GDM1602K.c index b642f70..8c442ff 100644 --- a/GDM1602K.c +++ b/GDM1602K.c @@ -58,10 +58,10 @@ void lcd_init() { lcd_4bit_init(); // lcd_send(1, 0b01111000); - lcd_send(0, 0x01); // Clear screen - lcd_send(0, 0x02); // Return home - lcd_send(0, 0b00001100); // Display on, no cursor - lcd_send(0, 0b00101000); + lcd_send(0, 0x01); // Clear screen + lcd_send(0, 0x02); // Return home + lcd_send(0, 0xC); // Display on, no cursor + lcd_send(0, 0x28); } void lcd_clear() { lcd_send(0, 0x01); } From 86973763d692d0fa9de1f0bc25bbb6d12d164e74 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 5 Feb 2025 14:47:46 +0100 Subject: [PATCH 3/3] Better flags --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0503c93..e45edf9 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,11 @@ MCU = atmega1284p QEMU_MACHINE_NAME = mega # Compiler flags -CFLAGS = -std=c2x -Wall -Wno-array-bounds -mmcu=$(MCU) -DF_CPU=16000000UL -O3 +CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -Wno-array-bounds -mmcu=$(MCU) \ + -DF_CPU=16000000UL -O2 -fno-common -ffunction-sections -fdata-sections + +# For debug +CFLAGS += -g3 -DDEBUG # Source files SRCS = $(wildcard *.c) @@ -34,6 +38,7 @@ $(TARGET).elf: $(OBJS) # Convert ELF to HEX $(TARGET).hex: $(TARGET).elf avr-objcopy -O ihex -R .eeprom $(TARGET).elf $(TARGET).hex + avr-size $< # Flash the program flash: $(TARGET).hex