first commit

This commit is contained in:
Kyle Cardoza 2024-03-21 20:26:37 -04:00
commit e9d478dc90
13 changed files with 183 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
# There is no need to edit this file. Make your changes in config/config.mk.
include config/config.mk
include config/sdk-config.mk
include config/sdk-targets.mk

0
README.md Normal file
View File

0
config/config.mk Normal file
View File

57
config/memory.scm Normal file
View File

@ -0,0 +1,57 @@
(define memories '(
(memory HighCode
(address (#xC00000 . #xC7FFFF))
(type rom)
)
(memory HighData
(address (#x010000 . #x07FFFF))
(section heap)
(type ram)
)
(memory LowCode
(address (#x008800 . #x00FFFF))
(section code)
(section cdata)
(section switch)
)
(memory IOSpace
(address (#x00DF00 . #x00DFFF))
(section (VERAIOPort #x00DF00))
)
(memory LowData
(address (#x001000 . #x007FFF))
(section near)
(section data)
(section znear)
(section zdata)
)
(memory stack
(address (#x000200 . #x000FFF))
(section (stack #x00200))
(section (cstack #x00400))
)
(memory DirectPage
(address (#x000000 . #x0000FF))
(section
(registers #x000004)
(ztiny)
)
)
(block cstack (size #x400)) ; C stack size
(block stack (size #x200)) ; machine stack size
(block heap (size #x2000))
(base-address _DirectPageStart DirectPage 0)
(base-address _NearBaseAddress LowData 0)
))

81
config/sdk-config.mk Normal file
View File

@ -0,0 +1,81 @@
SHELL := bash
CC := cc65816
AS := as65816
AR := nlib
LD := ln65816
.SUFFIXES:
.SUFFIXES: .c .s .o .a
MEMORY_MAP := config/memory.scm
CFLAGS := --include-system=include/libc \
-I include \
--code-model=large \
--data-model=huge \
--64bit-doubles \
--strong-inline \
--force-switch jump-table
ASFLAGS := --include-system=include/libc \
-I include \
--code-model=large \
--data-model=huge
ifeq ($(RELEASE), "true")
CFLAGS += -DNDEBUG \
-O2 \
--speed
else
CFLAGS += --debug \
-Wall \
-Wextra \
-Wpedantic \
-Werror \
-Wno-c11-extensions \
-Wno-gnu-binary-literal \
-Wno-gnu-conditional-omitted-operand \
-Wno-gnu-case-range \
-Wimplicit-fallthrough \
-Wno-gnu-folding-constant
ASFLAGS += --debug
endif
LDFLAGS := $(MEMORY_MAP) \
--hosted \
--no-data-init-table-section \
--rtattr cstartup=turaco \
--list-file build.lst \
--verbose \
--no-auto-libraries \
--output-format pgz
ifeq ($(ENABLE_RELEASE_BUILD), "true")
CFLAGS += -DRELEASE_BUILD
CFLAGS += -DNDEBUG
else
CFLAGS += -DDEBUG
endif
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) \
$(wildcard src/*/*.c) \
$(wildcard src/*/*/*.c) \
$(wildcard src/*/*/*/*.c) \
$(wildcard src/*/*/*/*/*.c)
KERNEL_SRC_S := $(wildcard src/*.s) \
$(wildcard src/*/*.s) \
$(wildcard src/*/*/*.s) \
$(wildcard src/*/*/*/*.s) \
$(wildcard src/*/*/*/*/*.s)
KERNEL_OBJ := $(KERNEL_SRC_C:.c=.o) \
$(KERNEL_SRC_S:.s=.o)

20
config/sdk-targets.mk Normal file
View File

@ -0,0 +1,20 @@
.PHONY: all
all: build/kernel.bin
.PHONY: clean
clean:
@find build -type f \( \
-name '*.pgz' -o \
-name '*.bin' -o \
-name '*.elf' -o \
-name '*.a' -o \
-name '*.lst' \
\) -delete
@find src -type f \( \
-name '*.o' -o \
-name '$(TARGET)' \
\) -delete
build/kernel.bin: $(KERNEL_OBJ)
@echo "Linking $@..."
@$(LD) -o $@ $(LDFLAGS) $^

BIN
include/.DS_Store vendored Normal file

Binary file not shown.

7
include/config.h Normal file
View File

@ -0,0 +1,7 @@
//*****************************************************************************
// Sentinel 65X Kernel
//
// include/config.h
//*****************************************************************************
#pragma once

BIN
include/drivers/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/drivers/.DS_Store vendored Normal file

Binary file not shown.

13
src/main.c Normal file
View File

@ -0,0 +1,13 @@
//*****************************************************************************
// Sentinel 65X Kernel
//
// src/main.c
//*****************************************************************************
#include "config.h"
void
main(void)
{
for (;;) {}
}