From d48e09cb384ccb76faefc53d0be995a03db38419 Mon Sep 17 00:00:00 2001 From: Yann MAGNIN Date: Sat, 25 Jun 2022 11:26:15 +0200 Subject: [PATCH] VxKernel 0.6.0-14 : Update whole project architecture @update <> configure | use TOML file format instead of INI for board description | block configuration script if it's not involved by the vxSDK | comment code and write documentation (WIP) | allow kernel module selection <> Makefile | block compilation step if it's not involved by the vxSDK | remove the "build/" directory creation | moved to the root directory of the project <> src/modules -> src | moved all "kernel modules" in the root directory | remove "kernel/" part of the project : now linked to the interrupt controller <> vxsdk.toml | change compilation steps @fix <> driver/mpu/sh/sh7305/intc | fix TLB interrupt handler freeze | link kernel panic (exception/TLB) <> include/vhex/display | add image API by default --- board/fxcg50/board.ini | 11 - board/fxcg50/board.toml | 30 ++ include/vhex/display.h | 2 +- make/Makefile | 364 ------------------ src/{modules => }/display/dclear.c | 0 src/{modules => }/display/display.c | 0 src/{modules => }/display/draw/dcircle.c | 0 src/{modules => }/display/draw/dline.c | 0 src/{modules => }/display/draw/dpixel.c | 0 src/{modules => }/display/draw/drect.c | 0 src/{modules => }/display/dstack.c | 0 src/{modules => }/display/dupdate.c | 0 src/{modules => }/display/font/information.c | 0 .../font/render/dfont_char.c} | 0 src/{modules => }/display/image/information.c | 0 src/{modules => }/display/image/object.c | 0 .../display/image/render/dimage.c | 0 .../display/image/render/dsubimage.c | 0 .../display/image/shader/shadow.c | 0 src/{modules => }/display/text/information.c | 0 src/display/text/render/dprint.c | 39 ++ .../render.c => display/text/render/dtext.c} | 31 +- .../mpu/sh/sh7305/cpg/cpg.c | 0 .../mpu/sh/sh7305/cpu/atomic.c | 0 .../mpu/sh/sh7305/cpu/cpu.c | 0 .../mpu/sh/sh7305/cpu/registers.s | 0 .../mpu/sh/sh7305/cpu/sleep.c | 0 .../mpu/sh/sh7305/intc/exch.S | 6 +- .../mpu/sh/sh7305/intc/exch_panic.c} | 3 +- .../mpu/sh/sh7305/intc/install.c | 0 .../mpu/sh/sh7305/intc/intc.c | 0 .../mpu/sh/sh7305/intc/inth.S | 0 .../mpu/sh/sh7305/intc/inth_callback.S | 0 .../mpu/sh/sh7305/intc/tlbh.S | 9 +- src/driver/mpu/sh/sh7305/intc/tlbh_panic.c | 8 + .../mpu/sh/sh7305/keysc/handler.c | 0 .../mpu/sh/sh7305/keysc/inth.S | 0 .../mpu/sh/sh7305/keysc/keycache.c | 0 .../mpu/sh/sh7305/keysc/keysc.c | 0 .../mpu/sh/sh7305/mmu/utlb.c | 0 .../mpu/sh/sh7305/tmu/inth-etmu.s | 0 .../mpu/sh/sh7305/tmu/inth-tmu.s | 0 .../mpu/sh/sh7305/tmu/tmu.c | 0 src/{drivers => driver}/screen/R61524/frame.S | 0 .../screen/R61524/r61524.c | 0 src/{modules => }/fs/fs.c | 0 src/{modules => }/hypervisor/hypervisor.c | 0 src/{modules => }/hypervisor/switch.c | 0 src/{modules => }/hypervisor/table.c | 0 src/{kernel => }/kernel.c | 0 src/kernel/tlb.c | 8 - src/{modules => }/keyboard/getkey.c | 0 src/{modules => }/keyboard/keyboard.c | 0 src/{modules => }/keyboard/keycache.c | 0 src/{modules => }/keyboard/keydown.c | 0 src/{modules => }/keyboard/keyvent.c | 0 src/{modules => }/kmalloc/area_vhex.c | 0 src/{modules => }/kmalloc/kmalloc.c | 0 src/{modules => }/timer/timer.c | 0 vxsdk.toml | 8 +- 60 files changed, 90 insertions(+), 429 deletions(-) delete mode 100644 board/fxcg50/board.ini create mode 100644 board/fxcg50/board.toml delete mode 100644 make/Makefile rename src/{modules => }/display/dclear.c (100%) rename src/{modules => }/display/display.c (100%) rename src/{modules => }/display/draw/dcircle.c (100%) rename src/{modules => }/display/draw/dline.c (100%) rename src/{modules => }/display/draw/dpixel.c (100%) rename src/{modules => }/display/draw/drect.c (100%) rename src/{modules => }/display/dstack.c (100%) rename src/{modules => }/display/dupdate.c (100%) rename src/{modules => }/display/font/information.c (100%) rename src/{modules/display/font/render.c => display/font/render/dfont_char.c} (100%) rename src/{modules => }/display/image/information.c (100%) rename src/{modules => }/display/image/object.c (100%) rename src/{modules => }/display/image/render/dimage.c (100%) rename src/{modules => }/display/image/render/dsubimage.c (100%) rename src/{modules => }/display/image/shader/shadow.c (100%) rename src/{modules => }/display/text/information.c (100%) create mode 100644 src/display/text/render/dprint.c rename src/{modules/display/text/render.c => display/text/render/dtext.c} (87%) rename src/{drivers => driver}/mpu/sh/sh7305/cpg/cpg.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/cpu/atomic.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/cpu/cpu.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/cpu/registers.s (100%) rename src/{drivers => driver}/mpu/sh/sh7305/cpu/sleep.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/exch.S (93%) rename src/{kernel/exch.c => driver/mpu/sh/sh7305/intc/exch_panic.c} (96%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/install.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/intc.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/inth.S (100%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/inth_callback.S (100%) rename src/{drivers => driver}/mpu/sh/sh7305/intc/tlbh.S (89%) create mode 100644 src/driver/mpu/sh/sh7305/intc/tlbh_panic.c rename src/{drivers => driver}/mpu/sh/sh7305/keysc/handler.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/keysc/inth.S (100%) rename src/{drivers => driver}/mpu/sh/sh7305/keysc/keycache.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/keysc/keysc.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/mmu/utlb.c (100%) rename src/{drivers => driver}/mpu/sh/sh7305/tmu/inth-etmu.s (100%) rename src/{drivers => driver}/mpu/sh/sh7305/tmu/inth-tmu.s (100%) rename src/{drivers => driver}/mpu/sh/sh7305/tmu/tmu.c (100%) rename src/{drivers => driver}/screen/R61524/frame.S (100%) rename src/{drivers => driver}/screen/R61524/r61524.c (100%) rename src/{modules => }/fs/fs.c (100%) rename src/{modules => }/hypervisor/hypervisor.c (100%) rename src/{modules => }/hypervisor/switch.c (100%) rename src/{modules => }/hypervisor/table.c (100%) rename src/{kernel => }/kernel.c (100%) delete mode 100644 src/kernel/tlb.c rename src/{modules => }/keyboard/getkey.c (100%) rename src/{modules => }/keyboard/keyboard.c (100%) rename src/{modules => }/keyboard/keycache.c (100%) rename src/{modules => }/keyboard/keydown.c (100%) rename src/{modules => }/keyboard/keyvent.c (100%) rename src/{modules => }/kmalloc/area_vhex.c (100%) rename src/{modules => }/kmalloc/kmalloc.c (100%) rename src/{modules => }/timer/timer.c (100%) diff --git a/board/fxcg50/board.ini b/board/fxcg50/board.ini deleted file mode 100644 index b04f743..0000000 --- a/board/fxcg50/board.ini +++ /dev/null @@ -1,11 +0,0 @@ -[meta] -description=Casio's Fxcg50 calculator board description - -[drivers] -screen=R61524 -mpu=sh7305 - -[toolchain] -prefix=sh-elf-vhex- -cflags=-DFXCG50,-m4-nofpu,-mb -libs=-lgcc diff --git a/board/fxcg50/board.toml b/board/fxcg50/board.toml new file mode 100644 index 0000000..cac7ed8 --- /dev/null +++ b/board/fxcg50/board.toml @@ -0,0 +1,30 @@ +[meta] +description = "Casio's Fxcg50 calculator board description" +author = 'Yann MAGNIN' + +[config] +modules = [ + 'display', + 'fs', + 'hypervisor', + 'keyboard', + 'kmalloc', + 'timer' +] + +[drivers] +screen = 'R61524' +mpu = 'sh7305' + + +[toolchain] +prefix = 'sh-elf-vhex-' +cflags = [ + '-DFXCG50', + '-m4-nofpu', + '-mb' +] +libs = [ + '-lc', + '-lgcc' +] diff --git a/include/vhex/display.h b/include/vhex/display.h index c6d8352..ae06471 100644 --- a/include/vhex/display.h +++ b/include/vhex/display.h @@ -6,7 +6,7 @@ #include #include #include -//#include +#include #include //TODO: doc diff --git a/make/Makefile b/make/Makefile deleted file mode 100644 index edd4472..0000000 --- a/make/Makefile +++ /dev/null @@ -1,364 +0,0 @@ -#!/usr/bin/make -f -# --- -# Project: vxKernek - Vhex project kernel -# Author: yann.magnin@protonmail.com -# -# TODO: -# <> proper clean rule -# <> support asset generation -# --- - - -#--- -# Build rules -#--- - -# Make selects the first rule set when you type "make" but, in our case, we are -# going to generate most of the rules. So, we set a placeholder to force the -# "all" rule to be the "first" rule -first: all - -# display the library version -version: - @echo "$(VXSDK_PKG_VERSION)" - -# Display helper -help: - @ echo 'Rules listing:' - @ echo '... all the default, if no target is provided' - @ echo '... clean remove build object' - @ echo '... fclean remove all generated object' - @ echo '... re same as `make fclean all`' - @ echo '... version display version' - @ echo '... install install the library' - @ echo '... uninstall uninstall the library' - -.PHONY: help version first - - - - -#--- -# Check config step validity -#--- - -# Require configuration file -CONFIG := kernel.cfg -ifeq "$(wildcard $(CONFIG))" "" -$(error "config file $(CONFIG) does not exist (you should use `../configure`") -endif -include $(CONFIG) - - - - -#--- -# Variables definition -#--- - -# Many variables will be provided by the "kernel.cfg" file (generated during -# the configuration path). It will defines: -# <> BOARD - indicate the target board list -# <> {BOARD}-SRC-MODULE-PATH - list of all sources path for a specific board -# <> {BOARD}-TOOLCHAIN-PREFIX - toolchain prefix for a board (sh-elf, ...) -# <> FORMAT - format for the kernel (static, dynamic) - -# color definition, for swagg :D -red := \033[1;31m -green := \033[1;32m -blue := \033[1;34m -white := \033[1;37m -nocolor := \033[1;0m - - - -#--- -# Rules definition -#--- - -# The objectif is to generate a building this build tree: -# -# build/: -# |-- kernel.cfg -# |-- /: -# | |-- /: -# | | |-- obj/: -# | | | |-- main.o -# ... -# | | | `-- initialize.o -# | | `-- map -# | |-- .ld -# | `-- libvxkernel-.[so/a] -# `-- Makefile - -# Function that will generate a rule for one object file -# @param -# *1 - GCC name (with specific prefix if needed) -# *2 - CFLAGS list -# *3 - source file path -# *4 - build root directory path -# *5 - object file compilation rule list -# *6 - dependencies file compilation rule list -# *7 - unique id (used to generate unique variable name (workaround)) -define generate-compile-file-rule - -# generate the object file path -# @note -# <> This is alse the generated rule name -# <> step: -# 1) ../board/path/file.c -> ../board/path/file -# 2) .._board_path_file -> board_path_file -# 3) board_path_file.o -> {build path}/board_path_file.o -tname := $(strip $7) -obj-$(tname)-name := $$(basename $3) -obj-$(tname)-name := $$(subst /,_,$$(obj-$(tname)-name)) -obj-$(tname)-name := $$(patsubst .._%,$4/%.o,$$(obj-$(tname)-name)) - -# generate the building rule - -$$(obj-$(tname)-name): $3 - @ mkdir -p $$(dir $$@) -ifeq ($(CONFIG.VERBOSE),false) - @ printf "$(green)>$(nocolor) $(white)$$@$(nocolor)\n" - @ $1 $2 -o $$@ -c $$< -MMD -MT $$@ -MF $$@.d -MP -else - $1 $2 -o $$@ -c $$< -MMD -MT $$@ -MF $$@.d -MP -endif - -# register the build rules and dependencies file name - -$5 += $$(obj-$(tname)-name) -$6 += $$(obj-$(tname)-name).d - -endef - - - -# Function that will generate all rules for a specific board and format -# @params -# *1 - board name -# *2 - format name (static or dynamic) -# *3 - rules list variable name -define generate-target-lib - -# generate common information -# @note: -# Because we generate rule "on-the-fly" we need to create unique variable -# definition because make is not a "scoped" language. (therefore, when a -# variable is created, it will never be destroyed until the end of the script) -t-$1-$2-build := $(VXSDK_PREFIX_BUILD)/$1/$2 - -# generate compilation flags - -t-$1-$2-ar := $$(CONFIG.$1.TOOLCHAIN.PREFIX)ar -t-$1-$2-ld := $$(CONFIG.$1.TOOLCHAIN.PREFIX)ld -t-$1-$2-gcc := $$(CONFIG.$1.TOOLCHAIN.PREFIX)gcc -t-$1-$2-ldflags := $$(CONFIG.$1.TOOLCHAIN.LDFLAGS) -t-$1-$2-cflags := $$(CONFIG.$1.TOOLCHAIN.CFLAGS) -t-$1-$2-cflags += -fpic -ffreestanding -nostdlib -fstrict-volatile-bitfields -O1 -t-$1-$2-cflags += -Wa,--dsp - -# generate compiler information (used to find some library like libgcc.a) -t-$1-$2-gcc-base := $$(shell $$(CONFIG.$1.TOOLCHAIN.PREFIX)gcc --print-search-dirs | grep install | sed 's/install: //') -t-$1-$2-gcc-header := -I$$(t-$1-$2-gcc-base)/include -I$$(t-$1-$2-gcc-base)/include/openlibm -t-$1-$2-cflags += -I../include -I.. $$(t-$1-$2-gcc-header) -t-$1-$2-cflags += -L../lib -L.. -L$$(t-$1-$2-gcc-base) - -# generate file's sources list, based on the configuration step - -t-$1-$2-dir := $$(foreach module,$$(CONFIG.$1.SRC-MODULE-PATH),\ - $$(shell find $$(module) -type d)) -t-$1-$2-src := $$(foreach path,$$(t-$1-$2-dir),\ - $$(wildcard $$(path)/*.c) \ - $$(wildcard $$(path)/*.S) \ - $$(wildcard $$(path)/*.s)) - -# generate format-specific flags - -t-$1-$2-exec := -ifeq ($2,static) -t-$1-$2-exec := $1/libvhex-$1.a -endif -ifeq ($2,dynamic) -t-$1-$2-ldflags += -shared -t-$1-$2-ldflags += -soname=libvhex-$1-$(VXSDK_PKG_VERSION).so -t-$1-$2-ldflags += -Map=$$(t-$1-$2-build)/map -t-$1-$2-exec := $1/libvhex-$1.so -t-$1-$2-src := $(wildcard ../fake/*.c) -endif - -# generate file's compilation rules and all object filename into an object -# list variable, this will be used by the `main` rule - -t-$1-$2-obj := -t-$1-$2-dep := -$$(foreach source,$$(t-$1-$2-src),$$(eval \ - $$(call generate-compile-file-rule,\ - $$(t-$1-$2-gcc),\ - $$(t-$1-$2-cflags),\ - $$(source),\ - $$(t-$1-$2-build),\ - t-$1-$2-obj,\ - t-$1-$2-dep,\ - $1-$2\ - ))\ -) - -# asset generation -t-$1-$2-asset := $(patsubst \ - $(VXSDK_ASSETS_SRC)/%,\ - $(VXSDK_ASSETS_BUILD)/$1/$2/%.o,\ - $(wildcard $(VXSDK_ASSETS_SRC)/*.c) \ -) - -$(VXSDK_ASSETS_BUILD)/$1/$2/%.o: $(VXSDK_ASSETS_SRC)/% -ifeq ($(CONFIG.VERBOSE),true) - @ mkdir -p $$(dir $$@) - sh-elf-vhex-gcc $$(t-$1-$2-cflags) -o $$@ -c $$< -else - @ mkdir -p $$(dir $$@) - @ printf "$(green)>$(nocolor) $(white)$@$(nocolor)\n" - @ sh-elf-vhex-gcc $$(t-$1-$2-cflags) -o $$@ -c $$< -endif - -# generate the "main" rule for this lib - -$$(t-$1-$2-exec): $$(t-$1-$2-obj) $$(t-$1-$2-asset) - @ mkdir -p $$(dir $$@) - @ echo "dep : $$(t-$1-$2-dep)" - @ printf "$(blue)Create the library $(red)$$@$(nocolor)\n" -ifeq ($2,dynamic) - $$(t-$1-$2-gcc) -shared $$(t-$1-$2-cflags) $$(t-$1-$2-gcc-libs) -o $$@ $$^ -else - $$(t-$1-$2-ar) crs $$@ $$^ -endif - -# register the "main" building rule for the lib - -$3 += $$(t-$1-$2-exec) - - -# import dependencies rules --include $$(t-$1-$2-dep) -$$(t-$1-$2-dep): ; -.PRECIOUS: $$(t-$1-$2-dep) - -endef - - -# Generate the "main" rules list -target-lib-list := -$(foreach board,$(CONFIG.BOARD-LIST),\ - $(foreach format,$(CONFIG.FORMAT-LIST),$(eval\ - $(call generate-target-lib,$(board),$(format),target-lib-list)\ - ))\ -) - - - -#--- -# Build rules -#--- -all: $(target-lib-list) - -.PHONY: all - - - -#--- -# Generate installation rules -#--- -# Common rules generated for the installation of each libraries. -# Basically, it will generate -install and -uninstall rules -# @note: -# *1 - library pathname -# *2 - variable name (installation rules list) -# *3 - variable name (uninstallation rules list) -define generate-install-rule - -# Generate the installation rule -$(basename $(notdir $1))-install: - install -d $(VXSDK_PREFIX_LIB) - install $1 -m 644 $(VXSDK_PREFIX_LIB) - -# Generate the uninstallation rule -$(basename $(notdir $1))-uninstall: - rm -f $(VXSDK_PREFIX_LIB)/$(notdir $1) - -# Register generated rules into their appropriate list -$2 += $(basename $(notdir $1))-install -$3 += $(basename $(notdir $1))-uninstall -endef - -# Common rules generated for the installation of board-specific linker script -# @note: -# $1 - board name -# $2 - variable name (installation rules list) -# $3 - variable name (uninstallation rules list) -define generate-board-install-rule - -$1-install: - install -d $(VXSDK_PREFIX_LIB) - install ../board/$(strip $1)/*.ld -m 644 $(VXSDK_PREFIX_LIB) - -$1-uninstall: - rm -f $(VXSDK_PREFIX_LIB)/$(strip $1).ld - rm -f $(VXSDK_PREFIX_LIB)/$(strip $1)-dynamic.ld - -$2 += $1-install -$3 += $1-uninstall - -endef - -# Generate all installation/uninstallation rules - -target-install-rules := -target-uninstall-rules := -$(foreach target,$(target-lib-list),$(eval \ - $(call generate-install-rule, \ - $(target), \ - target-install-rules, \ - target-uninstall-rules \ - ) \ -)) -$(foreach board,$(CONFIG.BOARD-LIST),$(eval \ - $(call generate-board-install-rule, \ - $(board), \ - target-install-rules, \ - target-uninstall-rules \ - ) \ -)) - -# Generate the path where include directory will be installed. -target-install-hdr-dir := $(VXSDK_PREFIX_LIB)/include/ -ifeq ($(wildcard $(target-install-header-dir)vhex/.*),) - target-install-hdr-dir := $(target-install-hdr-dir)vhex -endif - - - -#--- -# Installation rules -#--- -install: $(target-install-rules) - mkdir -p $(dir $(target-install-hdr-dir)) - cp -r ../include/vhex $(target-install-hdr-dir) - -unsintall: $(target-uninstall_rules) - rm -rf $(VXSDK_PREFIX_LIB)/include/vhex - -.PHONY: install uninstall - - - -#--- -# cleaning rules -#--- -#clean: TODO: generate clean rule list - - -fclean: clean - rm -rf $(target-lib-list) -re: fclean all - -.PHONY: clean fclean re all diff --git a/src/modules/display/dclear.c b/src/display/dclear.c similarity index 100% rename from src/modules/display/dclear.c rename to src/display/dclear.c diff --git a/src/modules/display/display.c b/src/display/display.c similarity index 100% rename from src/modules/display/display.c rename to src/display/display.c diff --git a/src/modules/display/draw/dcircle.c b/src/display/draw/dcircle.c similarity index 100% rename from src/modules/display/draw/dcircle.c rename to src/display/draw/dcircle.c diff --git a/src/modules/display/draw/dline.c b/src/display/draw/dline.c similarity index 100% rename from src/modules/display/draw/dline.c rename to src/display/draw/dline.c diff --git a/src/modules/display/draw/dpixel.c b/src/display/draw/dpixel.c similarity index 100% rename from src/modules/display/draw/dpixel.c rename to src/display/draw/dpixel.c diff --git a/src/modules/display/draw/drect.c b/src/display/draw/drect.c similarity index 100% rename from src/modules/display/draw/drect.c rename to src/display/draw/drect.c diff --git a/src/modules/display/dstack.c b/src/display/dstack.c similarity index 100% rename from src/modules/display/dstack.c rename to src/display/dstack.c diff --git a/src/modules/display/dupdate.c b/src/display/dupdate.c similarity index 100% rename from src/modules/display/dupdate.c rename to src/display/dupdate.c diff --git a/src/modules/display/font/information.c b/src/display/font/information.c similarity index 100% rename from src/modules/display/font/information.c rename to src/display/font/information.c diff --git a/src/modules/display/font/render.c b/src/display/font/render/dfont_char.c similarity index 100% rename from src/modules/display/font/render.c rename to src/display/font/render/dfont_char.c diff --git a/src/modules/display/image/information.c b/src/display/image/information.c similarity index 100% rename from src/modules/display/image/information.c rename to src/display/image/information.c diff --git a/src/modules/display/image/object.c b/src/display/image/object.c similarity index 100% rename from src/modules/display/image/object.c rename to src/display/image/object.c diff --git a/src/modules/display/image/render/dimage.c b/src/display/image/render/dimage.c similarity index 100% rename from src/modules/display/image/render/dimage.c rename to src/display/image/render/dimage.c diff --git a/src/modules/display/image/render/dsubimage.c b/src/display/image/render/dsubimage.c similarity index 100% rename from src/modules/display/image/render/dsubimage.c rename to src/display/image/render/dsubimage.c diff --git a/src/modules/display/image/shader/shadow.c b/src/display/image/shader/shadow.c similarity index 100% rename from src/modules/display/image/shader/shadow.c rename to src/display/image/shader/shadow.c diff --git a/src/modules/display/text/information.c b/src/display/text/information.c similarity index 100% rename from src/modules/display/text/information.c rename to src/display/text/information.c diff --git a/src/display/text/render/dprint.c b/src/display/text/render/dprint.c new file mode 100644 index 0000000..230041e --- /dev/null +++ b/src/display/text/render/dprint.c @@ -0,0 +1,39 @@ +#include +#include + +#include +#include + +//--- +// User-level API +//--- + +/* dprint() : display formated string */ +did_t dprint(int x, int y, int fg, char const * const text, ...) +{ + va_list ap; + char buff[1024]; + + va_start(ap, text); + vsnprintf(buff, 1024, text, ap); + va_end(ap); + + return (dtext_opt(x, y, fg, C_NONE, DTEXT_LEFT, DTEXT_TOP, buff, -1)); +} + +/* dprint_opt(): Display a string of text */ +did_t dprint_opt( + int x, int y, + int fg, int bg, + int halign, int valign, + char const *text, ... +) { + va_list ap; + char buff[1024]; + + va_start(ap, text); + vsnprintf(buff, 1024, text, ap); + va_end(ap); + + return (dtext_opt(x, y, fg, bg, halign, valign, buff, -1)); +} diff --git a/src/modules/display/text/render.c b/src/display/text/render/dtext.c similarity index 87% rename from src/modules/display/text/render.c rename to src/display/text/render/dtext.c index 0ce4c0e..11fd8d0 100644 --- a/src/modules/display/text/render.c +++ b/src/display/text/render/dtext.c @@ -10,6 +10,7 @@ #include +/* internal text information/cache */ struct { struct { struct { @@ -197,33 +198,3 @@ did_t dtext(int x, int y, int fg, char const * const text) { return (dtext_opt(x, y, fg, C_NONE, DTEXT_LEFT, DTEXT_TOP, text, -1)); } - -/* dprint() : display formated string */ -did_t dprint(int x, int y, int fg, char const * const text, ...) -{ - va_list ap; - char buff[1024]; - - va_start(ap, text); - vsnprintf(buff, 1024, text, ap); - va_end(ap); - - return (dtext_opt(x, y, fg, C_NONE, DTEXT_LEFT, DTEXT_TOP, buff, -1)); -} - -/* dprint_opt(): Display a string of text */ -did_t dprint_opt( - int x, int y, - int fg, int bg, - int halign, int valign, - char const *text, ... -) { - va_list ap; - char buff[1024]; - - va_start(ap, text); - vsnprintf(buff, 1024, text, ap); - va_end(ap); - - return (dtext_opt(x, y, fg, bg, halign, valign, buff, -1)); -} diff --git a/src/drivers/mpu/sh/sh7305/cpg/cpg.c b/src/driver/mpu/sh/sh7305/cpg/cpg.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/cpg/cpg.c rename to src/driver/mpu/sh/sh7305/cpg/cpg.c diff --git a/src/drivers/mpu/sh/sh7305/cpu/atomic.c b/src/driver/mpu/sh/sh7305/cpu/atomic.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/cpu/atomic.c rename to src/driver/mpu/sh/sh7305/cpu/atomic.c diff --git a/src/drivers/mpu/sh/sh7305/cpu/cpu.c b/src/driver/mpu/sh/sh7305/cpu/cpu.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/cpu/cpu.c rename to src/driver/mpu/sh/sh7305/cpu/cpu.c diff --git a/src/drivers/mpu/sh/sh7305/cpu/registers.s b/src/driver/mpu/sh/sh7305/cpu/registers.s similarity index 100% rename from src/drivers/mpu/sh/sh7305/cpu/registers.s rename to src/driver/mpu/sh/sh7305/cpu/registers.s diff --git a/src/drivers/mpu/sh/sh7305/cpu/sleep.c b/src/driver/mpu/sh/sh7305/cpu/sleep.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/cpu/sleep.c rename to src/driver/mpu/sh/sh7305/cpu/sleep.c diff --git a/src/drivers/mpu/sh/sh7305/intc/exch.S b/src/driver/mpu/sh/sh7305/intc/exch.S similarity index 93% rename from src/drivers/mpu/sh/sh7305/intc/exch.S rename to src/driver/mpu/sh/sh7305/intc/exch.S index dc56c23..4512f05 100644 --- a/src/drivers/mpu/sh/sh7305/intc/exch.S +++ b/src/driver/mpu/sh/sh7305/intc/exch.S @@ -1,5 +1,5 @@ .section .vhex.exch.pretext, "ax" -.global _vhex_exch_sh7305 +.global _vhex_exch_sh7305 _vhex_exch_sh7305: ! Generate "CPU" context @@ -43,12 +43,12 @@ _vhex_exch_sh7305: mov.l @r8, r4 -.align 4 +.balign 4 expevt_sh4: .long 0xff000024 kernel_exch_panic: - .long _vhex_kernel_exch_panic + .long _sh7305_intc_exch_panic SR_set_IMASK: .long (0xf << 4) SR_clear_BL: diff --git a/src/kernel/exch.c b/src/driver/mpu/sh/sh7305/intc/exch_panic.c similarity index 96% rename from src/kernel/exch.c rename to src/driver/mpu/sh/sh7305/intc/exch_panic.c index 7818626..5d80f84 100644 --- a/src/kernel/exch.c +++ b/src/driver/mpu/sh/sh7305/intc/exch_panic.c @@ -1,8 +1,7 @@ #include #include -//TODO: add relocation information -void vhex_kernel_exch_panic(void) +void sh7305_intc_exch_panic(void) { extern uint32_t __kernel_reloc_start; uint32_t PC; diff --git a/src/drivers/mpu/sh/sh7305/intc/install.c b/src/driver/mpu/sh/sh7305/intc/install.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/intc/install.c rename to src/driver/mpu/sh/sh7305/intc/install.c diff --git a/src/drivers/mpu/sh/sh7305/intc/intc.c b/src/driver/mpu/sh/sh7305/intc/intc.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/intc/intc.c rename to src/driver/mpu/sh/sh7305/intc/intc.c diff --git a/src/drivers/mpu/sh/sh7305/intc/inth.S b/src/driver/mpu/sh/sh7305/intc/inth.S similarity index 100% rename from src/drivers/mpu/sh/sh7305/intc/inth.S rename to src/driver/mpu/sh/sh7305/intc/inth.S diff --git a/src/drivers/mpu/sh/sh7305/intc/inth_callback.S b/src/driver/mpu/sh/sh7305/intc/inth_callback.S similarity index 100% rename from src/drivers/mpu/sh/sh7305/intc/inth_callback.S rename to src/driver/mpu/sh/sh7305/intc/inth_callback.S diff --git a/src/drivers/mpu/sh/sh7305/intc/tlbh.S b/src/driver/mpu/sh/sh7305/intc/tlbh.S similarity index 89% rename from src/drivers/mpu/sh/sh7305/intc/tlbh.S rename to src/driver/mpu/sh/sh7305/intc/tlbh.S index 008a378..f38ce5d 100644 --- a/src/drivers/mpu/sh/sh7305/intc/tlbh.S +++ b/src/driver/mpu/sh/sh7305/intc/tlbh.S @@ -1,10 +1,7 @@ .section .vhex.tlbh.pretext, "ax" -.global _vhex_tlbh_sh7305 +.global _vhex_tlbh_sh7305 _vhex_tlbh_sh7305: - bra _vhex_tlbh_sh7305 - nop - ! Generate "CPU" context sts.l pr, @-r15 stc.l spc, @-r15 @@ -43,10 +40,10 @@ _vhex_tlbh_sh7305: mov r15, r5 -.align 4 +.balign 4 kernel_tlbh_panic: - .long _vhex_kernel_tlbh_panic + .long _sh7305_intc_tlbh_panic SR_set_IMASK: .long (0xf << 4) SR_clear_BL: diff --git a/src/driver/mpu/sh/sh7305/intc/tlbh_panic.c b/src/driver/mpu/sh/sh7305/intc/tlbh_panic.c new file mode 100644 index 0000000..5231f4c --- /dev/null +++ b/src/driver/mpu/sh/sh7305/intc/tlbh_panic.c @@ -0,0 +1,8 @@ + +extern void sh7305_intc_exch_panic(void); + +void sh7305_intc_tlbh_panic(void) +{ + sh7305_intc_exch_panic(); + while (1) { __asm__ volatile ("sleep"); } +} diff --git a/src/drivers/mpu/sh/sh7305/keysc/handler.c b/src/driver/mpu/sh/sh7305/keysc/handler.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/keysc/handler.c rename to src/driver/mpu/sh/sh7305/keysc/handler.c diff --git a/src/drivers/mpu/sh/sh7305/keysc/inth.S b/src/driver/mpu/sh/sh7305/keysc/inth.S similarity index 100% rename from src/drivers/mpu/sh/sh7305/keysc/inth.S rename to src/driver/mpu/sh/sh7305/keysc/inth.S diff --git a/src/drivers/mpu/sh/sh7305/keysc/keycache.c b/src/driver/mpu/sh/sh7305/keysc/keycache.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/keysc/keycache.c rename to src/driver/mpu/sh/sh7305/keysc/keycache.c diff --git a/src/drivers/mpu/sh/sh7305/keysc/keysc.c b/src/driver/mpu/sh/sh7305/keysc/keysc.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/keysc/keysc.c rename to src/driver/mpu/sh/sh7305/keysc/keysc.c diff --git a/src/drivers/mpu/sh/sh7305/mmu/utlb.c b/src/driver/mpu/sh/sh7305/mmu/utlb.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/mmu/utlb.c rename to src/driver/mpu/sh/sh7305/mmu/utlb.c diff --git a/src/drivers/mpu/sh/sh7305/tmu/inth-etmu.s b/src/driver/mpu/sh/sh7305/tmu/inth-etmu.s similarity index 100% rename from src/drivers/mpu/sh/sh7305/tmu/inth-etmu.s rename to src/driver/mpu/sh/sh7305/tmu/inth-etmu.s diff --git a/src/drivers/mpu/sh/sh7305/tmu/inth-tmu.s b/src/driver/mpu/sh/sh7305/tmu/inth-tmu.s similarity index 100% rename from src/drivers/mpu/sh/sh7305/tmu/inth-tmu.s rename to src/driver/mpu/sh/sh7305/tmu/inth-tmu.s diff --git a/src/drivers/mpu/sh/sh7305/tmu/tmu.c b/src/driver/mpu/sh/sh7305/tmu/tmu.c similarity index 100% rename from src/drivers/mpu/sh/sh7305/tmu/tmu.c rename to src/driver/mpu/sh/sh7305/tmu/tmu.c diff --git a/src/drivers/screen/R61524/frame.S b/src/driver/screen/R61524/frame.S similarity index 100% rename from src/drivers/screen/R61524/frame.S rename to src/driver/screen/R61524/frame.S diff --git a/src/drivers/screen/R61524/r61524.c b/src/driver/screen/R61524/r61524.c similarity index 100% rename from src/drivers/screen/R61524/r61524.c rename to src/driver/screen/R61524/r61524.c diff --git a/src/modules/fs/fs.c b/src/fs/fs.c similarity index 100% rename from src/modules/fs/fs.c rename to src/fs/fs.c diff --git a/src/modules/hypervisor/hypervisor.c b/src/hypervisor/hypervisor.c similarity index 100% rename from src/modules/hypervisor/hypervisor.c rename to src/hypervisor/hypervisor.c diff --git a/src/modules/hypervisor/switch.c b/src/hypervisor/switch.c similarity index 100% rename from src/modules/hypervisor/switch.c rename to src/hypervisor/switch.c diff --git a/src/modules/hypervisor/table.c b/src/hypervisor/table.c similarity index 100% rename from src/modules/hypervisor/table.c rename to src/hypervisor/table.c diff --git a/src/kernel/kernel.c b/src/kernel.c similarity index 100% rename from src/kernel/kernel.c rename to src/kernel.c diff --git a/src/kernel/tlb.c b/src/kernel/tlb.c deleted file mode 100644 index 108a5e8..0000000 --- a/src/kernel/tlb.c +++ /dev/null @@ -1,8 +0,0 @@ - -extern void vhex_kernel_exch_panic(void); - -void vhex_kernel_tlbh_panic(void) -{ - vhex_kernel_exch_panic(); - while (1) { __asm__ volatile ("sleep"); } -} diff --git a/src/modules/keyboard/getkey.c b/src/keyboard/getkey.c similarity index 100% rename from src/modules/keyboard/getkey.c rename to src/keyboard/getkey.c diff --git a/src/modules/keyboard/keyboard.c b/src/keyboard/keyboard.c similarity index 100% rename from src/modules/keyboard/keyboard.c rename to src/keyboard/keyboard.c diff --git a/src/modules/keyboard/keycache.c b/src/keyboard/keycache.c similarity index 100% rename from src/modules/keyboard/keycache.c rename to src/keyboard/keycache.c diff --git a/src/modules/keyboard/keydown.c b/src/keyboard/keydown.c similarity index 100% rename from src/modules/keyboard/keydown.c rename to src/keyboard/keydown.c diff --git a/src/modules/keyboard/keyvent.c b/src/keyboard/keyvent.c similarity index 100% rename from src/modules/keyboard/keyvent.c rename to src/keyboard/keyvent.c diff --git a/src/modules/kmalloc/area_vhex.c b/src/kmalloc/area_vhex.c similarity index 100% rename from src/modules/kmalloc/area_vhex.c rename to src/kmalloc/area_vhex.c diff --git a/src/modules/kmalloc/kmalloc.c b/src/kmalloc/kmalloc.c similarity index 100% rename from src/modules/kmalloc/kmalloc.c rename to src/kmalloc/kmalloc.c diff --git a/src/modules/timer/timer.c b/src/timer/timer.c similarity index 100% rename from src/modules/timer/timer.c rename to src/timer/timer.c diff --git a/vxsdk.toml b/vxsdk.toml index 049dd3c..b30f2ea 100644 --- a/vxsdk.toml +++ b/vxsdk.toml @@ -3,10 +3,10 @@ name = 'vxkernel' version = '0.5.0' [build] -configure = 'mkdir -p build && cd build && ../configure --board=fxcg50' -build = 'cd build && make' -install = 'cd build && make install' -uninstall = 'cd build && make uninstall' +configure = 'python3 ./configure --board=fxcg50' +build = 'make' +install = 'make install' +uninstall = 'make uninstall' [dependencies] sh-elf-vhex = 'master'