Added dependency generation in Makefiles.
This commit is contained in:
parent
3994a78ce5
commit
01759c3d99
|
@ -57,14 +57,6 @@ endif
|
||||||
|
|
||||||
LIBS := build/libc.a
|
LIBS := build/libc.a
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
@echo "Compiling $@..."
|
|
||||||
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
%.o: %.s
|
|
||||||
@echo "Assembling $@)..."
|
|
||||||
@$(AS) $(ASFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
KERNEL_SRC_C := $(wildcard src/*.c) \
|
KERNEL_SRC_C := $(wildcard src/*.c) \
|
||||||
$(wildcard src/*/*.c) \
|
$(wildcard src/*/*.c) \
|
||||||
$(wildcard src/*/*/*.c) \
|
$(wildcard src/*/*/*.c) \
|
||||||
|
@ -77,3 +69,4 @@ KERNEL_SRC_S := $(wildcard src/*.s) \
|
||||||
$(wildcard src/*/*/*/*/*.s)
|
$(wildcard src/*/*/*/*/*.s)
|
||||||
KERNEL_OBJ := $(KERNEL_SRC_C:.c=.o) \
|
KERNEL_OBJ := $(KERNEL_SRC_C:.c=.o) \
|
||||||
$(KERNEL_SRC_S:.s=.o)
|
$(KERNEL_SRC_S:.s=.o)
|
||||||
|
KERNEL_DEP := $(KERNEL_SRC_C:.c=.d)
|
||||||
|
|
|
@ -12,9 +12,25 @@ clean:
|
||||||
\) -delete
|
\) -delete
|
||||||
@find src -type f \( \
|
@find src -type f \( \
|
||||||
-name '*.o' -o \
|
-name '*.o' -o \
|
||||||
|
-name '*.d' -o \
|
||||||
-name '$(TARGET)' \
|
-name '$(TARGET)' \
|
||||||
\) -delete
|
\) -delete
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo "Compiling $@..."
|
||||||
|
@$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.s
|
||||||
|
@echo "Assembling $@)..."
|
||||||
|
@$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
%.d: %.c
|
||||||
|
@echo "Generating dependencies for $<"
|
||||||
|
@printf '%s' "$(dir $@)" > $@
|
||||||
|
@$(CC) $(CFLAGS) --dependencies $< >> $@
|
||||||
|
|
||||||
build/kernel.bin: $(KERNEL_OBJ)
|
build/kernel.bin: $(KERNEL_OBJ)
|
||||||
@echo "Linking $@..."
|
@echo "Linking $@..."
|
||||||
@$(LD) -o $@ $(LDFLAGS) $^
|
@$(LD) -o $@ $(LDFLAGS) $^
|
||||||
|
|
||||||
|
-include $(KERNEL_DEP)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
//*****************************************************************************
|
||||||
|
// Sentinel 65X Kernel
|
||||||
|
//
|
||||||
|
// include/drivers/vera.h
|
||||||
|
//*****************************************************************************
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
far void vera_init(void);
|
||||||
|
|
||||||
|
far uint8_t vera_peek(uint32_t addr);
|
||||||
|
|
||||||
|
far void vera_poke(uint32_t addr, uint8_t value);
|
||||||
|
|
||||||
|
far void vera_poke16(uint32_t addr, uint16_t value);
|
||||||
|
|
||||||
|
far void _vera_set_bgcolor(uint8_t color);
|
||||||
|
#define vera_set_bgcolor(X) _vera_set_bgcolor((X))
|
||||||
|
#define vera_set_bgcolour(X) _vera_set_bgcolor((X))
|
|
@ -0,0 +1,85 @@
|
||||||
|
//*****************************************************************************
|
||||||
|
// Sentinel 65X Kernel
|
||||||
|
//
|
||||||
|
// src/drivers/vera.c
|
||||||
|
//*****************************************************************************
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "drivers/vera.h"
|
||||||
|
|
||||||
|
typedef struct vera_s *VERA;
|
||||||
|
|
||||||
|
struct vera_s {
|
||||||
|
uint8_t addr_x_l;
|
||||||
|
uint8_t addr_x_m;
|
||||||
|
uint8_t addr_x_h;
|
||||||
|
union {
|
||||||
|
uint8_t data[2];
|
||||||
|
uint16_t data16;
|
||||||
|
};
|
||||||
|
uint8_t ctrl;
|
||||||
|
uint8_t ien;
|
||||||
|
uint8_t isr;
|
||||||
|
union {
|
||||||
|
uint8_t irq_line_l;
|
||||||
|
uint8_t const scanline_l;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
VERA vera = (VERA)(0x00df00);
|
||||||
|
|
||||||
|
far void
|
||||||
|
vera_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
far uint8_t
|
||||||
|
vera_peek(uint32_t addr)
|
||||||
|
{
|
||||||
|
(void) addr;
|
||||||
|
|
||||||
|
// Set addrsel to 0
|
||||||
|
uint8_t asel = vera->ctrl;
|
||||||
|
vera->ctrl = asel & 0b11111110;
|
||||||
|
|
||||||
|
// Set address
|
||||||
|
vera->addr_x_l = addr & 0x000000FF;
|
||||||
|
vera->addr_x_m = (addr & 0x0000FF00) >> 8;
|
||||||
|
|
||||||
|
vera->addr_x_h = vera->addr_x_h & 0b11111110;
|
||||||
|
|
||||||
|
vera->addr_x_h = vera->addr_x_h | (addr & ((uint32_t)(1) << 16));
|
||||||
|
|
||||||
|
return vera->data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
far void
|
||||||
|
vera_poke(uint32_t addr, uint8_t value)
|
||||||
|
{
|
||||||
|
(void) addr;
|
||||||
|
|
||||||
|
// Set addrsel to 0
|
||||||
|
uint8_t asel = vera->ctrl;
|
||||||
|
vera->ctrl = asel & 0b11111110;
|
||||||
|
|
||||||
|
// Set address
|
||||||
|
vera->addr_x_l = addr & 0x000000FF;
|
||||||
|
vera->addr_x_m = (addr & 0x0000FF00) >> 8;
|
||||||
|
|
||||||
|
vera->addr_x_h = vera->addr_x_h & 0b11111110;
|
||||||
|
|
||||||
|
vera->addr_x_h = vera->addr_x_h | (addr & ((uint32_t)(1) << 16));
|
||||||
|
|
||||||
|
vera->data[0] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
far void
|
||||||
|
_vera_set_bgcolor(uint8_t color)
|
||||||
|
{
|
||||||
|
(void) color;
|
||||||
|
return;
|
||||||
|
}
|
|
@ -6,8 +6,12 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "drivers/vera.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
|
vera_init();
|
||||||
|
|
||||||
for (;;) {}
|
for (;;) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue