From 2e84b6849076571fe9a6dc38042b05dfd0a4cc18 Mon Sep 17 00:00:00 2001 From: Karolis Stasaitis Date: Mon, 12 Feb 2024 17:17:56 +0530 Subject: [PATCH] move lib/ to platform/ and build and link correct dependencies --- Makefile | 14 ++++++++------ src/keyboards/nuphy-air60/kbdef.h | 2 +- .../nuphy-air60/layouts/default/indicators.c | 4 ++-- src/main.c | 18 +++++++++--------- src/{lib => platform}/sh68f90a/clock.c | 0 src/{lib => platform}/sh68f90a/clock.h | 0 src/{lib => platform}/sh68f90a/delay.c | 0 src/{lib => platform}/sh68f90a/delay.h | 0 src/{lib => platform}/sh68f90a/gpio.c | 0 src/{lib => platform}/sh68f90a/gpio.h | 0 src/{lib => platform}/sh68f90a/isp.c | 0 src/{lib => platform}/sh68f90a/isp.h | 0 src/{lib => platform}/sh68f90a/keyboard.c | 0 src/{lib => platform}/sh68f90a/ldo.c | 0 src/{lib => platform}/sh68f90a/ldo.h | 0 src/{lib => platform}/sh68f90a/pwm.c | 0 src/{lib => platform}/sh68f90a/pwm.h | 0 src/{lib => platform}/sh68f90a/sh68f90a.h | 0 src/{lib => platform}/sh68f90a/uart.c | 0 src/{lib => platform}/sh68f90a/uart.h | 0 src/{lib => platform}/sh68f90a/usb.c | 0 src/{lib => platform}/sh68f90a/usb.h | 0 src/{lib => platform}/sh68f90a/usbregs.h | 0 src/{lib => platform}/sh68f90a/watchdog.h | 0 src/smk/host.c | 2 +- src/smk/matrix.c | 6 +++--- src/user/indicators.c | 2 +- src/user/layout.c | 2 +- 28 files changed, 26 insertions(+), 24 deletions(-) rename src/{lib => platform}/sh68f90a/clock.c (100%) rename src/{lib => platform}/sh68f90a/clock.h (100%) rename src/{lib => platform}/sh68f90a/delay.c (100%) rename src/{lib => platform}/sh68f90a/delay.h (100%) rename src/{lib => platform}/sh68f90a/gpio.c (100%) rename src/{lib => platform}/sh68f90a/gpio.h (100%) rename src/{lib => platform}/sh68f90a/isp.c (100%) rename src/{lib => platform}/sh68f90a/isp.h (100%) rename src/{lib => platform}/sh68f90a/keyboard.c (100%) rename src/{lib => platform}/sh68f90a/ldo.c (100%) rename src/{lib => platform}/sh68f90a/ldo.h (100%) rename src/{lib => platform}/sh68f90a/pwm.c (100%) rename src/{lib => platform}/sh68f90a/pwm.h (100%) rename src/{lib => platform}/sh68f90a/sh68f90a.h (100%) rename src/{lib => platform}/sh68f90a/uart.c (100%) rename src/{lib => platform}/sh68f90a/uart.h (100%) rename src/{lib => platform}/sh68f90a/usb.c (100%) rename src/{lib => platform}/sh68f90a/usb.h (100%) rename src/{lib => platform}/sh68f90a/usbregs.h (100%) rename src/{lib => platform}/sh68f90a/watchdog.h (100%) diff --git a/Makefile b/Makefile index 2f63509..c76830b 100644 --- a/Makefile +++ b/Makefile @@ -52,11 +52,13 @@ MAIN_SOURCES := $(SRCDIR)/main.c \ $(LAYOUT_SOURCES) MAIN_OBJECTS := $(MAIN_SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.rel) -LIBSINO8051_SOURCES := $(wildcard $(SRCDIR)/lib/sh68f90a/*.c) -LIBSINO8051_OBJECTS := $(LIBSINO8051_SOURCES:$(SRCDIR)/lib/sh68f90a/%.c=$(OBJDIR)/lib/sh68f90a/%.rel) +PLATFORM_SOURCES := $(wildcard $(SRCDIR)/platform/sh68f90a/*.c) +PLATFORM_OBJECTS := $(PLATFORM_SOURCES:$(SRCDIR)/platform/sh68f90a/%.c=$(OBJDIR)/platform/sh68f90a/%.rel) +PLATFORM_LIB := platform USER_SOURCES := $(wildcard $(SRCDIR)/user/*.c) USER_OBJECTS := $(USER_SOURCES:$(SRCDIR)/user/%.c=$(OBJDIR)/user/%.rel) +USER_LIB := user KEYBOARDS_LAYOUTS = nuphy-air60_default @@ -75,17 +77,17 @@ $(OBJDIR)/%.rel: $(SRCDIR)/%.c @mkdir -p $(@D) $(CC) -m$(FAMILY) -l$(PROC) $(CFLAGS) -c $< -o $@ -$(BINDIR)/overridable.lib: $(OVERRIDABLE_OBJECTS) +$(BINDIR)/user.lib: $(USER_OBJECTS) @mkdir -p $(@D) $(SDAR) $@ $^ -$(BINDIR)/sino8051.lib: $(LIBSINO8051_OBJECTS) +$(BINDIR)/platform.lib: $(PLATFORM_OBJECTS) @mkdir -p $(@D) $(SDAR) $@ $^ -$(BINDIR)/%.ihx: $(MAIN_OBJECTS) $(BINDIR)/sino8051.lib $(BINDIR)/overridable.lib +$(BINDIR)/%.ihx: $(MAIN_OBJECTS) $(BINDIR)/$(PLATFORM_LIB).lib $(BINDIR)/$(USER_LIB).lib @mkdir -p $(@D) - $(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -loverridable -lsino8051 + $(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -l$(USER_LIB) -l$(PLATFORM_LIB) $(BINDIR)/%.hex: $(BINDIR)/%.ihx ${PACKIHX} < $< > $@ diff --git a/src/keyboards/nuphy-air60/kbdef.h b/src/keyboards/nuphy-air60/kbdef.h index 8053f58..0042efe 100644 --- a/src/keyboards/nuphy-air60/kbdef.h +++ b/src/keyboards/nuphy-air60/kbdef.h @@ -1,7 +1,7 @@ #ifndef KBDEF_H #define KBDEF_H -#include "../../lib/sh68f90a/sh68f90a.h" +#include "../../platform/sh68f90a/sh68f90a.h" #define MATRIX_ROWS 5 #define MATRIX_COLS 16 diff --git a/src/keyboards/nuphy-air60/layouts/default/indicators.c b/src/keyboards/nuphy-air60/layouts/default/indicators.c index 4f97763..513000b 100644 --- a/src/keyboards/nuphy-air60/layouts/default/indicators.c +++ b/src/keyboards/nuphy-air60/layouts/default/indicators.c @@ -1,6 +1,6 @@ #include "../../../../user/indicators.h" -#include "../../../../lib/sh68f90a/sh68f90a.h" -#include "../../../../lib/sh68f90a/pwm.h" +#include "../../../../platform/sh68f90a/sh68f90a.h" +#include "../../../../platform/sh68f90a/pwm.h" #include void indicators_pre_update() diff --git a/src/main.c b/src/main.c index 91845a3..9ca7d01 100644 --- a/src/main.c +++ b/src/main.c @@ -1,12 +1,12 @@ -#include "lib/sh68f90a/clock.h" -#include "lib/sh68f90a/ldo.h" -#include "lib/sh68f90a/watchdog.h" -#include "lib/sh68f90a/delay.h" -#include "lib/sh68f90a/isp.h" -#include "lib/sh68f90a/uart.h" -#include "lib/sh68f90a/gpio.h" -#include "lib/sh68f90a/pwm.h" -#include "lib/sh68f90a/usb.h" +#include "platform/sh68f90a/clock.h" +#include "platform/sh68f90a/ldo.h" +#include "platform/sh68f90a/watchdog.h" +#include "platform/sh68f90a/delay.h" +#include "platform/sh68f90a/isp.h" +#include "platform/sh68f90a/uart.h" +#include "platform/sh68f90a/gpio.h" +#include "platform/sh68f90a/pwm.h" +#include "platform/sh68f90a/usb.h" #include "smk/debug.h" #include "smk/matrix.h" #include "smk/utils.h" diff --git a/src/lib/sh68f90a/clock.c b/src/platform/sh68f90a/clock.c similarity index 100% rename from src/lib/sh68f90a/clock.c rename to src/platform/sh68f90a/clock.c diff --git a/src/lib/sh68f90a/clock.h b/src/platform/sh68f90a/clock.h similarity index 100% rename from src/lib/sh68f90a/clock.h rename to src/platform/sh68f90a/clock.h diff --git a/src/lib/sh68f90a/delay.c b/src/platform/sh68f90a/delay.c similarity index 100% rename from src/lib/sh68f90a/delay.c rename to src/platform/sh68f90a/delay.c diff --git a/src/lib/sh68f90a/delay.h b/src/platform/sh68f90a/delay.h similarity index 100% rename from src/lib/sh68f90a/delay.h rename to src/platform/sh68f90a/delay.h diff --git a/src/lib/sh68f90a/gpio.c b/src/platform/sh68f90a/gpio.c similarity index 100% rename from src/lib/sh68f90a/gpio.c rename to src/platform/sh68f90a/gpio.c diff --git a/src/lib/sh68f90a/gpio.h b/src/platform/sh68f90a/gpio.h similarity index 100% rename from src/lib/sh68f90a/gpio.h rename to src/platform/sh68f90a/gpio.h diff --git a/src/lib/sh68f90a/isp.c b/src/platform/sh68f90a/isp.c similarity index 100% rename from src/lib/sh68f90a/isp.c rename to src/platform/sh68f90a/isp.c diff --git a/src/lib/sh68f90a/isp.h b/src/platform/sh68f90a/isp.h similarity index 100% rename from src/lib/sh68f90a/isp.h rename to src/platform/sh68f90a/isp.h diff --git a/src/lib/sh68f90a/keyboard.c b/src/platform/sh68f90a/keyboard.c similarity index 100% rename from src/lib/sh68f90a/keyboard.c rename to src/platform/sh68f90a/keyboard.c diff --git a/src/lib/sh68f90a/ldo.c b/src/platform/sh68f90a/ldo.c similarity index 100% rename from src/lib/sh68f90a/ldo.c rename to src/platform/sh68f90a/ldo.c diff --git a/src/lib/sh68f90a/ldo.h b/src/platform/sh68f90a/ldo.h similarity index 100% rename from src/lib/sh68f90a/ldo.h rename to src/platform/sh68f90a/ldo.h diff --git a/src/lib/sh68f90a/pwm.c b/src/platform/sh68f90a/pwm.c similarity index 100% rename from src/lib/sh68f90a/pwm.c rename to src/platform/sh68f90a/pwm.c diff --git a/src/lib/sh68f90a/pwm.h b/src/platform/sh68f90a/pwm.h similarity index 100% rename from src/lib/sh68f90a/pwm.h rename to src/platform/sh68f90a/pwm.h diff --git a/src/lib/sh68f90a/sh68f90a.h b/src/platform/sh68f90a/sh68f90a.h similarity index 100% rename from src/lib/sh68f90a/sh68f90a.h rename to src/platform/sh68f90a/sh68f90a.h diff --git a/src/lib/sh68f90a/uart.c b/src/platform/sh68f90a/uart.c similarity index 100% rename from src/lib/sh68f90a/uart.c rename to src/platform/sh68f90a/uart.c diff --git a/src/lib/sh68f90a/uart.h b/src/platform/sh68f90a/uart.h similarity index 100% rename from src/lib/sh68f90a/uart.h rename to src/platform/sh68f90a/uart.h diff --git a/src/lib/sh68f90a/usb.c b/src/platform/sh68f90a/usb.c similarity index 100% rename from src/lib/sh68f90a/usb.c rename to src/platform/sh68f90a/usb.c diff --git a/src/lib/sh68f90a/usb.h b/src/platform/sh68f90a/usb.h similarity index 100% rename from src/lib/sh68f90a/usb.h rename to src/platform/sh68f90a/usb.h diff --git a/src/lib/sh68f90a/usbregs.h b/src/platform/sh68f90a/usbregs.h similarity index 100% rename from src/lib/sh68f90a/usbregs.h rename to src/platform/sh68f90a/usbregs.h diff --git a/src/lib/sh68f90a/watchdog.h b/src/platform/sh68f90a/watchdog.h similarity index 100% rename from src/lib/sh68f90a/watchdog.h rename to src/platform/sh68f90a/watchdog.h diff --git a/src/smk/host.c b/src/smk/host.c index 7c62a1b..3b7ce6d 100644 --- a/src/smk/host.c +++ b/src/smk/host.c @@ -1,6 +1,6 @@ #include "host.h" #include "debug.h" -#include "../lib/sh68f90a/usb.h" +#include "../platform/sh68f90a/usb.h" /* send report */ void host_keyboard_send(report_keyboard_t *report) diff --git a/src/smk/matrix.c b/src/smk/matrix.c index 493c9ef..c580c63 100644 --- a/src/smk/matrix.c +++ b/src/smk/matrix.c @@ -1,9 +1,9 @@ #include "matrix.h" #include "report.h" #include "debug.h" -#include "../lib/sh68f90a/sh68f90a.h" -#include "../lib/sh68f90a/pwm.h" -#include "../lib/sh68f90a/delay.h" +#include "../platform/sh68f90a/sh68f90a.h" +#include "../platform/sh68f90a/pwm.h" +#include "../platform/sh68f90a/delay.h" #include "../user/layout.h" #include "../user/indicators.h" #include "../user/matrix.h" diff --git a/src/user/indicators.c b/src/user/indicators.c index 63f4d30..afd6b06 100644 --- a/src/user/indicators.c +++ b/src/user/indicators.c @@ -1,4 +1,4 @@ -#include "../indicators.h" +#include "indicators.h" bool indicators_update_step(keyboard_state_t *keyboard, uint8_t current_step) { diff --git a/src/user/layout.c b/src/user/layout.c index f385330..6978b16 100644 --- a/src/user/layout.c +++ b/src/user/layout.c @@ -1,4 +1,4 @@ -#include "../layout.h" +#include "layout.h" bool process_record_user(uint16_t keycode, bool key_pressed) {