Add some basic code, build kernel stuff in tree

This commit is contained in:
Byron Lathi
2023-12-04 23:06:00 -08:00
parent 902b1b5bb9
commit 2859055f98
6 changed files with 77 additions and 65 deletions

View File

@@ -1,7 +1,7 @@
CC=../../cc65/bin/cl65
LD=../../cc65/bin/cl65
SIM=../../cc65/bin/sim65
CFLAGS=-T -t sim65c02 -I.
CFLAGS=-T -t sim65c02 -I. -I $(REPO_TOP)/sw/kernel
LDFLAGS=-m $(NAME).map
NAME=fs_test
@@ -14,17 +14,18 @@ FS=$(REPO_TOP)/sw/script/fs.fat
LISTS=lists
EXT_SRCS=$(REPO_TOP)/sw/kernel/filesystems/fat32.s
EXT_SRCS=$(REPO_TOP)/sw/kernel/filesystems/fat32.s $(REPO_TOP)/sw/kernel/filesystems/fat32_c.c
SRCS=$(wildcard *.s) $(wildcard *.c)
SRCS+=$(wildcard **/*.s) $(wildcard **/*.c)
SRCS+=$(EXT_SRCS)
OBJS+=$(patsubst %.s,%.o,$(filter %s,$(SRCS)))
OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS)))
run: all
$(SIM) $(SIMARGS) $(BIN)
all: fs.fat fat32.s $(BIN)
all: fs.fat $(BIN)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
@@ -35,16 +36,14 @@ $(BIN): $(OBJS)
%.o: %.s $(LISTS)
$(CC) $(CFLAGS) -l $(LISTS)/$<.list -c $< -o $@
fat32.s: $(EXT_SRCS)
cp $^ .
fs.fat: $(FS)
cp $^ .
$(LISTS):
mkdir -p $(addprefix $(LISTS)/,$(sort $(dir $(SRCS))))
.PHONY: clean
clean:
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS) $(NAME).map fat32.s
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS) $(NAME).map

View File

@@ -1,8 +1,11 @@
#include <stdio.h>
#include <filesystems/fat32.h>
void fat32_init(void);
int main(void) {
struct fat32_directory_entry dentry;
fat32_init();
fat32_get_cluster_by_name("KERNEL O65", &dentry);
return 0;
}