First push after merge, split and enhance both zOS and zputa
This commit is contained in:
58
.gitignore
vendored
Normal file
58
.gitignore
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
.metadata
|
||||
.dm
|
||||
.gradle
|
||||
/Releases
|
||||
/.nb-gradle/
|
||||
*.bin
|
||||
*.dmp
|
||||
*.elf
|
||||
*.lss
|
||||
*.map
|
||||
*.rpt
|
||||
*.srec
|
||||
*.swp
|
||||
*.log
|
||||
*.done
|
||||
*.smsg
|
||||
*.summary
|
||||
*.jdi
|
||||
*.pin
|
||||
*.out.sdc
|
||||
*.sof
|
||||
*.sld
|
||||
*.rbf
|
||||
*.qws
|
||||
*.sav
|
||||
*.pof
|
||||
*.qdf
|
||||
*.srf
|
||||
*.o
|
||||
*.tmp
|
||||
*.swo
|
||||
*.swp
|
||||
.*.swo
|
||||
.*.swp
|
||||
*.out
|
||||
*.d
|
||||
*.old
|
||||
*.dmp*
|
||||
*.lss*
|
||||
c5_pin_model_dump.txt
|
||||
build/db/
|
||||
build/incremental_db/
|
||||
build/output_files/
|
||||
build/simulation/
|
||||
apps/*/build/
|
||||
apps/*/*_obj/
|
||||
zputa/build/
|
||||
zOS/build/
|
||||
iocp/iocp_obj/
|
||||
build/*
|
||||
old/*
|
||||
*/old/*
|
||||
*/*/old/*
|
||||
*/*/*/old/*
|
||||
iocp/test
|
||||
startup/*0x*.ld
|
||||
apps/*/*.zpu
|
||||
apps/*/*.k64
|
||||
75
apps/Makefile
Executable file
75
apps/Makefile
Executable file
@@ -0,0 +1,75 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
TOOLSPATH = $(CURDIR)/../../tools
|
||||
COMPILERPATH = $(TOOLSPATH)/arm/bin
|
||||
BASE = $(abspath $(COMPILERPATH))/arm-none-eabi
|
||||
else
|
||||
TOOLSPATH = /opt/zpu
|
||||
COMPILERPATH = $(TOOLSPATH)/bin
|
||||
BASE = zpu-elf
|
||||
endif
|
||||
CC = $(BASE)-gcc
|
||||
CXX = $(BASE)-g++
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
OBJCOPY = $(BASE)-objcopy
|
||||
SIZE = $(BASE)-size
|
||||
|
||||
FS_SUBDIRS := falloc fattr fcat fcd fclose fconcat fcp fdel fdir fdrive fdump finspect flabel fmkdir
|
||||
FS_SUBDIRS += fmkfs fopen fread frename fsave fseek fshowdir fstat ftime ftrunc fwrite fxtract
|
||||
DISK_SUBDIRS := ddump dstat
|
||||
BUFFER_SUBDIRS:= bdump bedit bread bwrite bfill blen
|
||||
MEM_SUBDIRS := mclear mcopy mdiff mdump meb meh mew mperf msrch mtest
|
||||
HW_SUBDIRS := hr ht tcpu
|
||||
TST_SUBDIRS := dhry coremark
|
||||
MISC_SUBDIRS := help time test tbasic mbasic kilo ed
|
||||
SUBDIRS := $(FS_SUBDIRS) $(DISK_SUBDIRS) $(BUFFER_SUBDIRS) $(MEM_SUBDIRS) $(HW_SUBDIRS) $(TST_SUBDIRS) $(MISC_SUBDIRS)
|
||||
BASEDIR = ../..
|
||||
TARGETS := all clean install
|
||||
|
||||
# Our target.
|
||||
$(TARGETS): $(SUBDIRS)
|
||||
#
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS) $(MAKEFLAGS)
|
||||
|
||||
install:
|
||||
.PHONY: $(TARGETS) $(SUBDIRS)
|
||||
353
apps/Makefile.k64f
Executable file
353
apps/Makefile.k64f
Executable file
@@ -0,0 +1,353 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile.k64f
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
BASEDIR = $(CURDIR)/../..
|
||||
TOOLSPATH = $(BASEDIR)/tools
|
||||
COMPILERPATH = $(TOOLSPATH)/arm/bin
|
||||
BASE = $(abspath $(COMPILERPATH))/arm-none-eabi
|
||||
# path location for Teensy 3 core
|
||||
COREPATH = $(BASEDIR)/teensy3
|
||||
else
|
||||
BASEDIR = $(CURDIR)/../..
|
||||
TOOLSPATH = /opt/zpu
|
||||
COMPILERPATH = $(TOOLSPATH)/bin
|
||||
BASE = zpu-elf
|
||||
endif
|
||||
CC = $(BASE)-gcc
|
||||
CXX = $(BASE)-g++
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
OBJCOPY = $(BASE)-objcopy
|
||||
SIZE = $(BASE)-size
|
||||
|
||||
# The teensy version to use, 30, 31, 35, 36, or LC
|
||||
TEENSY = 35
|
||||
|
||||
# Set to 24000000, 48000000, or 96000000 to set CPU core speed
|
||||
TEENSY_CORE_SPEED = 48000000
|
||||
|
||||
# Some libraries will require this to be defined
|
||||
# If you define this, you will break the default main.cpp
|
||||
#ARDUINO = 10600
|
||||
|
||||
# configurable options
|
||||
OPTIONS = -DUSB_SERIAL -DLAYOUT_US_ENGLISH
|
||||
|
||||
# APP_NAME, APP_DIR and BASEDIR defined in calling Makefile
|
||||
|
||||
# Addresses where the ZPUTA base program loads and where apps load and execute.
|
||||
# With IOCP
|
||||
#OS_BASEADDR = 0x02000
|
||||
#OS_APPADDR = 0x50000
|
||||
# Standalone
|
||||
ifeq ($(OS_BASEADDR),)
|
||||
OS_BASEADDR = 0x00000000
|
||||
endif
|
||||
ifeq ($(OS_APPADDR),)
|
||||
OS_APPADDR = 0x1FFF0000
|
||||
endif
|
||||
|
||||
IOCPDIR = $(CURDIR)/../../iocp
|
||||
ifeq ($(__ZPUTA__), 1)
|
||||
OSDIR = $(CURDIR)/../../zputa/src
|
||||
else
|
||||
OSDIR = $(CURDIR)/../../zOS/src
|
||||
endif
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(CURDIR)/../../startup
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(CURDIR)/../../common
|
||||
FATFS_DIR = $(CURDIR)/../../common/FatFS
|
||||
#PFS_DIR = $(CURDIR)/../../common/PetitFS
|
||||
DHRY_DIR = $(CURDIR)/../../common/Dhrystone
|
||||
COREMARK_DIR = $(CURDIR)/../../common/CoreMark
|
||||
UMM_DIR = $(CURDIR)/../../common/umm
|
||||
INCLUDE_DIR = $(CURDIR)/../../include
|
||||
APP_INCLUDE_DIR= $(CURDIR)/../include
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(abspath $(CURDIR)/build)
|
||||
|
||||
# Startup code.
|
||||
CRT0_ASM_SRC = $(STARTUP_DIR)/app_k64f_crt0.s
|
||||
|
||||
# Memory management code. Bring in the UMM library if stdlib isnt being used.
|
||||
ifeq (-nostdlib,$(findstring -nostdlib,$(LDFLAGS)))
|
||||
UMM_C_SRC = $(UMM_DIR)/umm_malloc.c
|
||||
else
|
||||
UMM_C_SRC =
|
||||
endif
|
||||
|
||||
# Teensy3 modules which may be needed.
|
||||
TEENSY3_C_SRC = #$(wildcard $(COREPATH)/*.c)
|
||||
TEENSY3_CPP_SRC= #$(wildcard $(COREPATH)/*.cpp)
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC =
|
||||
|
||||
# Application being built.
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
|
||||
# Define the sources and what they compile from->to.
|
||||
SOURCES := $(CRT0_ASM_SRC:.s=.o) $(COMMON_SRC:.c=.o) $(UMM_C_SRC:.c=.o) $(CORE_SRC:.c=.o) $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o) $(TEENSY3_C_SRC:.c=.o) $(TEENSY3_CPP_SRC:.cpp=.o) $(DHRY_SRC:.c=.o) $(COREMARK_SRC:.c=.o) $(APP_C_SRC:.c=.o) $(APP_CPP_SRC:.cpp=.o) $(MAIN_SRC:.c=.o)
|
||||
OBJS := $(foreach src,$(SOURCES), $(BUILD_DIR)/$(src))
|
||||
|
||||
# CPPFLAGS = compiler options for C and C++
|
||||
#CPPFLAGS = -Wall -g -Os -mthumb -ffunction-sections -fdata-sections -nostdlib -MMD $(OPTIONS) -DTEENSYDUINO=144 -DF_CPU=$(TEENSY_CORE_SPEED)
|
||||
CPPFLAGS += -Wall -g -mthumb -nostdlib -MMD $(OPTIONS) -DTEENSYDUINO=144 -DF_CPU=$(TEENSY_CORE_SPEED)
|
||||
CPPFLAGS += -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(OSDIR) -I$(INCLUDE_DIR) -I$(APP_INCLUDE_DIR) -I$(COREPATH) -I$(COREMARK_DIR) -I$(DHRY_DIR) -I$(UMM_DIR)
|
||||
CPPFLAGS += -D__K64F__ -D__APP__ -DDEBUG -D__SD_CARD__ -DOS_BASEADDR=$(OS_BASEADDR) -DOS_APPADDR=$(OS_APPADDR)
|
||||
CPPFLAGS += -mlong-calls # WARNING! This is needed as a bug in the compiler creates veneer wrappers which switch to ARM mode and not Thumb.
|
||||
ifeq (-nostdlib,$(findstring -nostdlib,$(LDFLAGS)))
|
||||
CPPFLAGS += -DUMM_BEST_FIT -DUMM_INFO -DUMM_DBG_LOG_LEVEL=0
|
||||
endif
|
||||
|
||||
ifeq ($(__ZPUTA__),1)
|
||||
CPPFLAGS += -D__ZPUTA__
|
||||
else ifeq ($(__ZOS__),1)
|
||||
CPPFLAGS += -D__ZOS__
|
||||
endif
|
||||
|
||||
# Allow local overrides to the HEAPADDR for certain applications.
|
||||
ifeq (,$(findstring __HEAPADDR__,$(CPPFLAGS)))
|
||||
ifeq ($(HEAPADDR),)
|
||||
CPPFLAGS += -D__HEAPADDR__=0x1fffc000
|
||||
else
|
||||
CPPFLAGS += -D__HEAPADDR__=$(HEAPADDR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Allow local overrides to the HEAPSIZE for certain applications.
|
||||
ifeq (,$(findstring __HEAPSIZE__,$(CPPFLAGS)))
|
||||
ifeq ($(HEAPSIZE),)
|
||||
CPPFLAGS += -D__HEAPSIZE__=0x400
|
||||
else
|
||||
CPPFLAGS += -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
endif
|
||||
endif
|
||||
|
||||
# compiler options for C++ only
|
||||
#CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
|
||||
CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fno-rtti
|
||||
|
||||
# compiler options for C only
|
||||
CFLAGS += -Os
|
||||
|
||||
# linker options
|
||||
#LDFLAGS = -Os -Wl,--gc-sections -mthumb -ffreestanding -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
#LDFLAGS = -nostdlib -nostartfiles -ffreestanding -Wl,--gc-sections -mthumb -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
#LDFLAGS = -nostdlib -nostartfiles -ffreestanding -mthumb -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
LDFLAGS += -nostartfiles -ffreestanding -mthumb -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
#LDFLAGS = -ffreestanding -Wl,--gc-sections -mthumb -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
|
||||
# additional libraries to link
|
||||
LIBS = -lm
|
||||
|
||||
# compiler options specific to teensy version
|
||||
ifeq ($(TEENSY), 30)
|
||||
CPPFLAGS += -D__MK20DX128__ -mcpu=cortex-m4
|
||||
LDSCRIPT = $(COREPATH)/mk20dx128.ld
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_mk20dx128_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
LDFLAGS += -mcpu=cortex-m4
|
||||
else ifeq ($(TEENSY), 31)
|
||||
CPPFLAGS += -D__MK20DX256__ -mcpu=cortex-m4
|
||||
LDSCRIPT = $(COREPATH)/mk20dx256.ld
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_mk20dx256_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
LDFLAGS += -mcpu=cortex-m4
|
||||
else ifeq ($(TEENSY), LC)
|
||||
CPPFLAGS += -D__MKL26Z64__ -mcpu=cortex-m0plus
|
||||
LDSCRIPT = $(COREPATH)/mkl26z64.ld
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_mkl26z64_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
LDFLAGS += -mcpu=cortex-m0plus
|
||||
LIBS += -larm_cortexM0l_math
|
||||
else ifeq ($(TEENSY), 35)
|
||||
CPPFLAGS += -D__MK64FX512__ -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
LDSCRIPT = $(COREPATH)/mk64fx512.ld
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_k64f_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
LDFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
LIBS += -larm_cortexM4lf_math
|
||||
else ifeq ($(TEENSY), 36)
|
||||
CPPFLAGS += -D__MK66FX1M0__ -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
LDSCRIPT = $(COREPATH)/mk66fx1m0.ld
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_mk66fx1m0_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
LDFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
LIBS += -larm_cortexM4lf_math
|
||||
else
|
||||
$(error Invalid setting for TEENSY)
|
||||
endif
|
||||
|
||||
# set arduino define if given
|
||||
ifdef ARDUINO
|
||||
CPPFLAGS += -DARDUINO=$(ARDUINO)
|
||||
else
|
||||
CPPFLAGS += -DUSING_MAKEFILE
|
||||
endif
|
||||
|
||||
|
||||
FLAGS_STR = -DFLAGS_STR="$(CPPFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym OS_BASEADDR=$(OS_BASEADDR) --defsym OS_APPADDR=$(OS_APPADDR)
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).k64 $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).dmp $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).rpt
|
||||
|
||||
clean:
|
||||
rm -fr $(BUILD_DIR)/* *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).k64 *~ */*.o *.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).k64 $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.k64: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "RAM Usage (code): 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .text | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .text | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " (data): 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .data | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .bss | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ "Segments:"
|
||||
@echo >>$@ -n " data = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .data | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .data | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " bss = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .bss | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .bss | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " heap = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .heap | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .heap | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " stack = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .stack | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .stack | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
@cat $@
|
||||
#@rm $@.tmp
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(OBJS)
|
||||
@cat $(TMPLFILE) | sed -e "s/BOOTADDR/$(BASEADDR)/g" \
|
||||
-e "s/BOOTLEN/$(BASELEN)/g" \
|
||||
-e "s/APPSTART/$(APPSTART)/g" \
|
||||
-e "s/APPLEN/$(APPSIZE)/g" \
|
||||
-e "s/APP_HEAP_STARTADDR/$(HEAPADDR)/g" \
|
||||
-e "s/APP_HEAP_SIZE/$(HEAPSIZE)/g" \
|
||||
-e "s/APP_STACK_SIZE/$(STACKSIZE)/g" \
|
||||
-e "s/APP_STACK_STARTADDR/$(STACKADDR)/g" \
|
||||
-e "s/APP_STACK_ENDADDR/$(STACKENDADDR)/g" > $(LINKMAPAPP)
|
||||
$(LD) $(LDFLAGS) -T $(LINKMAPAPP) -o "$@" $(OBJS) $(LIBS)
|
||||
# $(LD) $(LDFLAGS) -T $(LINKMAPAPP) -o "$@" $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(DHRY_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(CORE_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) $(FLAGS_STR) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
# compiler generated dependency info
|
||||
-include $(OBJS:.o=.d)
|
||||
325
apps/Makefile.zpu
Executable file
325
apps/Makefile.zpu
Executable file
@@ -0,0 +1,325 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile.zpu
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
BASEDIR = $(CURDIR)/../..
|
||||
TOOLSPATH = $(BASEDIR)/tools
|
||||
COMPILERPATH = $(TOOLSPATH)/arm/bin
|
||||
BASE = $(abspath $(COMPILERPATH))/arm-none-eabi
|
||||
# path location for Teensy 3 core
|
||||
COREPATH = $(BASEDIR)/teensy3
|
||||
else
|
||||
BASEDIR = $(CURDIR)/../..
|
||||
TOOLSPATH = /opt/zpu
|
||||
COMPILERPATH = $(TOOLSPATH)/bin
|
||||
BASE = zpu-elf
|
||||
endif
|
||||
CC = $(BASE)-gcc
|
||||
CXX = $(BASE)-g++
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
OBJCOPY = $(BASE)-objcopy
|
||||
SIZE = $(BASE)-size
|
||||
|
||||
# APP_NAME, APP_DIR and BASEDIR defined in calling Makefile
|
||||
|
||||
# Addresses where the ZPUTA base program loads and where apps load and execute.
|
||||
# With IOCP
|
||||
#OS_BASEADDR = 0x02000
|
||||
#OS_APPADDR = 0x50000
|
||||
# Standalone
|
||||
ifeq ($(OS_BASEADDR),)
|
||||
OS_BASEADDR = 0x001000
|
||||
endif
|
||||
ifeq ($(OS_APPADDR),)
|
||||
OS_APPADDR = 0x00C000
|
||||
endif
|
||||
|
||||
IOCPDIR = $(CURDIR)/../../iocp
|
||||
ifeq ($(__ZPUTA__), 1)
|
||||
OSDIR = $(CURDIR)/../../zputa/src
|
||||
else
|
||||
OSDIR = $(CURDIR)/../../zOS/src
|
||||
endif
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(CURDIR)/../../startup
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(CURDIR)/../../common
|
||||
FATFS_DIR = $(CURDIR)/../../common/FatFS
|
||||
#PFS_DIR = $(CURDIR)/../../common/PetitFS
|
||||
DHRY_DIR = $(CURDIR)/../../common/Dhrystone
|
||||
COREMARK_DIR = $(CURDIR)/../../common/CoreMark
|
||||
UMM_DIR = $(CURDIR)/../../common/umm
|
||||
INCLUDE_DIR = $(CURDIR)/../../include
|
||||
APP_INCLUDE_DIR= $(CURDIR)/../include
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(abspath $(CURDIR)/build)
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_zpu_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
|
||||
# Startup code.
|
||||
CRT0_ASM_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
|
||||
# Memory management code. Bring in the UMM library if stdlib isnt being used.
|
||||
ifeq (-nostdlib,$(findstring -nostdlib,$(LDFLAGS)))
|
||||
UMM_C_SRC = $(UMM_DIR)/umm_malloc.c
|
||||
else
|
||||
UMM_C_SRC =
|
||||
endif
|
||||
|
||||
# Common modules needed for this app.
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c # $(COMMON_DIR)/malloc.c
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
|
||||
# Define the sources and what they compile from->to.
|
||||
SOURCES := $(CRT0_ASM_SRC:.s=.o) $(COMMON_SRC:.c=.o) $(UMM_C_SRC:.c=.o) $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o) $(DHRY_SRC:.c=.o) $(COREMARK_SRC:.c=.o) $(APP_C_SRC:.c=.o) $(APP_CPP_SRC:.cpp=.o) $(MAIN_SRC:.c=.o)
|
||||
OBJS := $(foreach src,$(SOURCES), $(BUILD_DIR)/$(src))
|
||||
|
||||
# Commandline options for each tool.
|
||||
# To disable use of a given instruction, prefix it with no-
|
||||
ZPUOPTS = -mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
ifeq ($(CPU), $(filter $(CPU),SMALL MEDIUM FLEX))
|
||||
ZPUOPTS += -mno-mult \
|
||||
-mno-div \
|
||||
-mno-mod \
|
||||
-mno-neg
|
||||
endif
|
||||
ifeq ($(CPU), $(filter $(CPU),EVO))
|
||||
ZPUOPTS += -mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg
|
||||
endif
|
||||
|
||||
#CFLAGS += -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS += -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(OSDIR) -I$(INCLUDE_DIR) -I$(APP_INCLUDE_DIR) -I${UMM_DIR} -c -O3 -ffunction-sections -fdata-sections $(ZPUOPTS)
|
||||
CFLAGS += -D__ZPU__ -D__APP__ -DOS_BASEADDR=$(OS_BASEADDR) -DOS_APPADDR=$(OS_APPADDR)
|
||||
ifeq (-nostdlib,$(findstring -nostdlib,$(LDFLAGS)))
|
||||
CFLAGS += -DUMM_BEST_FIT -DUMM_INFO -DUMM_DBG_LOG_LEVEL=0
|
||||
endif
|
||||
|
||||
#CFLAGS += -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
ifeq ($(__ZPUTA__),1)
|
||||
CFLAGS += -D__ZPUTA__
|
||||
else ifeq ($(__ZOS__),1)
|
||||
CFLAGS += -D__ZOS__
|
||||
endif
|
||||
#
|
||||
# Allow local overrides to the HEAPADDR for certain applications.
|
||||
ifeq (,$(findstring __HEAPADDR__,$(CFLAGS)))
|
||||
ifeq ($(HEAPADDR),)
|
||||
CFLAGS += -D__HEAPADDR__=0x1fffc000
|
||||
else
|
||||
CFLAGS += -D__HEAPADDR__=$(HEAPADDR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Allow local overrides to the HEAPSIZE for certain applications.
|
||||
ifeq (,$(findstring __HEAPSIZE__,$(CFLAGS)))
|
||||
ifeq ($(HEAPSIZE),)
|
||||
CFLAGS += -D__HEAPSIZE__=0x400
|
||||
else
|
||||
CFLAGS += -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
endif
|
||||
endif
|
||||
#
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -D__SD_CARD__
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
|
||||
#
|
||||
# Assembler flags.
|
||||
ifeq ($(OS_BASEADDR),0x000000)
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym OS_BASEADDR=0x400 --defsym OS_APPADDR=$(OS_APPADDR)
|
||||
else
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym OS_BASEADDR=$(OS_BASEADDR) --defsym OS_APPADDR=$(OS_APPADDR)
|
||||
endif
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp
|
||||
|
||||
clean:
|
||||
rm -fr $(BUILD_DIR)/*
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "RAM Usage (code): 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .text | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .text | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " (data): 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep "\.data" | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .bss | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ "Segments:"
|
||||
@echo >>$@ -n " data = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep "\.data" | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep "\.data" | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
@echo >>$@ -n " bss = 0x"
|
||||
@$(DUMP) -x $< | grep " d " | grep .bss | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
@$(DUMP) -x $< | grep " 2\*\*" | grep .bss | tr -s ' ' > $@.tmp
|
||||
@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
#@echo >>$@ -n " heap = 0x"
|
||||
#@$(DUMP) -x $< | grep " d " | grep .heap | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
#@$(DUMP) -x $< | grep " 2\*\*" | grep .heap | tr -s ' ' > $@.tmp
|
||||
#@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
|
||||
#@echo >>$@ -n " stack = 0x"
|
||||
#@$(DUMP) -x $< | grep " d " | grep .stack | cut -d' ' -f1 | tr -d '\n' >>$@
|
||||
#@$(DUMP) -x $< | grep " 2\*\*" | grep .stack | tr -s ' ' > $@.tmp
|
||||
#@bash -c "printf ':0x%X\n' $$((0x`cat $@.tmp | cut -d' ' -f5` + 0x`cat $@.tmp | cut -d' ' -f4`))" >>$@
|
||||
@cat $@
|
||||
#@rm $@.tmp
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(OBJS)
|
||||
@cat $(TMPLFILE) | sed -e "s/BOOTADDR/$(BASEADDR)/g" \
|
||||
-e "s/BOOTLEN/$(BASELEN)/g" \
|
||||
-e "s/APPSTART/$(APPSTART)/g" \
|
||||
-e "s/APPLEN/$(APPSIZE)/g" \
|
||||
-e "s/APP_HEAP_STARTADDR/$(HEAPADDR)/g" \
|
||||
-e "s/APP_HEAP_SIZE/$(HEAPSIZE)/g" \
|
||||
-e "s/APP_STACK_SIZE/$(STACKSIZE)/g" \
|
||||
-e "s/APP_STACK_STARTADDR/$(STACKADDR)/g" \
|
||||
-e "s/APP_STACK_ENDADDR/$(STACKENDADDR)/g" > $(LINKMAPAPP)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(DHRY_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COREMARK_DIR)/%.c Makefile
|
||||
@mkdir -p "$(dir $@)"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $(FLAGS_STR) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
# compiler generated dependency info
|
||||
-include $(OBJS:.o=.d)
|
||||
45
apps/bdump/Makefile
Executable file
45
apps/bdump/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bdump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
114
apps/bdump/bdump.c
Executable file
114
apps/bdump/bdump.c
Executable file
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bdump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "bdump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BDUMP"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long offset;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &offset))
|
||||
{
|
||||
xprintf("Illegal <offset> value.\n");
|
||||
} else
|
||||
{
|
||||
memoryDump((uint32_t)&G->Buff[offset], 0x200, 16, offset, 32);
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/bdump/bdump.h
Executable file
123
apps/bdump/bdump.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bdump.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BDUMP_H
|
||||
#define BDUMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 1
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BDUMP_H
|
||||
45
apps/bedit/Makefile
Executable file
45
apps/bedit/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bedit
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
136
apps/bedit/bedit.c
Executable file
136
apps/bedit/bedit.c
Executable file
@@ -0,0 +1,136 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bedit.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "bedit.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BEDIT"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char line[120];
|
||||
long addr;
|
||||
long data;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &addr))
|
||||
{
|
||||
xprintf("Illegal <addr> value.\n");
|
||||
} else
|
||||
{
|
||||
if (xatoi(&ptr, &data))
|
||||
{
|
||||
do {
|
||||
G->Buff[addr++] = (BYTE)data;
|
||||
} while (xatoi(&ptr, &data));
|
||||
} else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
xprintf("%04X %02X-", (WORD)addr, G->Buff[addr]);
|
||||
xgets(line, sizeof line);
|
||||
ptr = line;
|
||||
if (*ptr == '.') break;
|
||||
if (*ptr < ' ') { addr++; continue; }
|
||||
if (xatoi(&ptr, &data)) {
|
||||
G->Buff[addr++] = (BYTE)data;
|
||||
} else {
|
||||
xputs("???\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/bedit/bedit.h
Executable file
123
apps/bedit/bedit.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bedit.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BEDIT_H
|
||||
#define BEDIT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 1
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BEDIT_H
|
||||
45
apps/bfill/Makefile
Executable file
45
apps/bfill/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bfill
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
114
apps/bfill/bfill.c
Executable file
114
apps/bfill/bfill.c
Executable file
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bfill.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "bfill.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BFILL"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long value;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &value))
|
||||
{
|
||||
xprintf("Illegal <n> value.\n");
|
||||
} else
|
||||
{
|
||||
memset(G->Buff, (BYTE)value, sizeof G->Buff);
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/bfill/bfill.h
Executable file
123
apps/bfill/bfill.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bfill.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BFILL_H
|
||||
#define BFILL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 1
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BFILL_H
|
||||
45
apps/blen/Makefile
Executable file
45
apps/blen/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = blen
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
115
apps/blen/blen.c
Executable file
115
apps/blen/blen.c
Executable file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: blen.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "blen.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BLEN"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileSetBlockLen(len);
|
||||
if(fr) { printFSCode(fr); } else { xprintf("R/W length = %u\n", len); retCode = 0; }
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
124
apps/blen/blen.h
Executable file
124
apps/blen/blen.h
Executable file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: blen.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BLEN_H
|
||||
#define BLEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 1
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BLEN_H
|
||||
45
apps/bread/Makefile
Executable file
45
apps/bread/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bread
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
120
apps/bread/bread.c
Executable file
120
apps/bread/bread.c
Executable file
@@ -0,0 +1,120 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bread.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "bread.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BREAD"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
long count;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_read((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
124
apps/bread/bread.h
Executable file
124
apps/bread/bread.h
Executable file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bread.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BREAD_H
|
||||
#define BREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 1
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BREAD_H
|
||||
45
apps/bwrite/Makefile
Executable file
45
apps/bwrite/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bwrite
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
120
apps/bwrite/bwrite.c
Executable file
120
apps/bwrite/bwrite.c
Executable file
@@ -0,0 +1,120 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bwrite.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "bwrite.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "BWRITE"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
long count;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_write((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
124
apps/bwrite/bwrite.h
Executable file
124
apps/bwrite/bwrite.h
Executable file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bwrite.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BWRITE_H
|
||||
#define BWRITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 1
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // BWRITE_H
|
||||
100
apps/common/ctypelocal.c
Normal file
100
apps/common/ctypelocal.c
Normal file
@@ -0,0 +1,100 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ctypelocal.c
|
||||
// Created: January 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Utilities for C compilation when stdlib is not included in the linker list.
|
||||
// This is the ctype for string testing normally included in the libc.
|
||||
// Eventually this module should be replaced by a micro libc compatible with the ZPU
|
||||
// and K64F.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: modifications (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: January 2020 - Initial file created from various sources.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__K64F__)
|
||||
//#include <ctype.h>
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include "ctypelocal.h"
|
||||
|
||||
#define _CTYPE_DATA_0_127 \
|
||||
_C, _C, _C, _C, _C, _C, _C, _C, \
|
||||
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \
|
||||
_C, _C, _C, _C, _C, _C, _C, _C, \
|
||||
_C, _C, _C, _C, _C, _C, _C, _C, \
|
||||
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
|
||||
_P, _P, _P, _P, _P, _P, _P, _P, \
|
||||
_N, _N, _N, _N, _N, _N, _N, _N, \
|
||||
_N, _N, _P, _P, _P, _P, _P, _P, \
|
||||
_P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, \
|
||||
_U, _U, _U, _U, _U, _U, _U, _U, \
|
||||
_U, _U, _U, _U, _U, _U, _U, _U, \
|
||||
_U, _U, _U, _P, _P, _P, _P, _P, \
|
||||
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, \
|
||||
_L, _L, _L, _L, _L, _L, _L, _L, \
|
||||
_L, _L, _L, _L, _L, _L, _L, _L, \
|
||||
_L, _L, _L, _P, _P, _P, _P, _C
|
||||
#define _CTYPE_DATA_128_255 \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
_CONST char _ctype_[1 + 256] = {
|
||||
0,
|
||||
_CTYPE_DATA_0_127,
|
||||
_CTYPE_DATA_128_255
|
||||
};
|
||||
_CONST char *__ctype_ptr = (char *) _ctype_ + 1;
|
||||
_CONST char *__locale_ctype_ptr = (char *) _ctype_ + 1;
|
||||
_CONST char *__ctype_ptr__ = (char *) _ctype_;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
110
apps/common/sbrk.c
Normal file
110
apps/common/sbrk.c
Normal file
@@ -0,0 +1,110 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: sbrk.c
|
||||
// Created: January 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: System heap allocation for use when linking with the stdlib. This method is called
|
||||
// by the stdlib malloc to allocate a chunk of heap for it to use.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: modifications (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: January 2020 - Utilities assembled from various sources.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__K64F__)
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
extern unsigned long _stext;
|
||||
extern unsigned long _etext;
|
||||
extern unsigned long _sdata;
|
||||
extern unsigned long _edata;
|
||||
extern unsigned long _sbss;
|
||||
extern unsigned long _ebss;
|
||||
extern unsigned long _estack;
|
||||
|
||||
#ifndef STACK_MARGIN
|
||||
#define STACK_MARGIN 8192
|
||||
#endif
|
||||
|
||||
//char *__brkval = (char *)&_ebss;
|
||||
//
|
||||
//void * _sbrk(int incr)
|
||||
//{
|
||||
// char *prev, *stack;
|
||||
//
|
||||
// prev = __brkval;
|
||||
// if (incr != 0) {
|
||||
// #if defined __K64F__
|
||||
// __asm__ volatile("mov %0, sp" : "=r" (stack) ::);
|
||||
// #endif
|
||||
// if (prev + incr >= stack - STACK_MARGIN) {
|
||||
//// errno = ENOMEM;
|
||||
// return (void *)-1;
|
||||
// }
|
||||
// __brkval = prev + incr;
|
||||
// }
|
||||
// return prev;
|
||||
//}
|
||||
|
||||
extern char __HeapBase; /**< Defined by the linker */
|
||||
extern char __HeapLimit; /**< Defined by the linker */
|
||||
void * _sbrk(int incr)
|
||||
{
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0)
|
||||
{
|
||||
heap_end = &__HeapBase;
|
||||
}
|
||||
//xprintf("Head_end=%08lx, incr=%08lx\n", heap_end, incr);
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
if ((heap_end + incr) > (char*) &__HeapLimit)
|
||||
{
|
||||
//xprintf("Ovfl Head_end=%08lx, incr=%08lx\n", heap_end, incr);
|
||||
//errno = ENOMEM;
|
||||
return ((void*)-1); // error - no more memory
|
||||
}
|
||||
heap_end += incr;
|
||||
//xprintf("Head_end=%08lx, incr=%08lx\n", heap_end, incr);
|
||||
return prev_heap_end;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
297
apps/common/sysutils.c
Normal file
297
apps/common/sysutils.c
Normal file
@@ -0,0 +1,297 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: sysutils.c
|
||||
// Created: January 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Utilities for C compilation when stdlib is not included in the linker list.
|
||||
// Basically a set of functions which are in libc cut down to basics. EVentually this
|
||||
// module should be replaced by a micro libc compatible with the ZPU and K64F.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: modifications (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: January 2020 - Utilities assembled from various sources.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__K64F__)
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
extern unsigned long _stext;
|
||||
extern unsigned long _etext;
|
||||
extern unsigned long _sdata;
|
||||
extern unsigned long _edata;
|
||||
extern unsigned long _sbss;
|
||||
extern unsigned long _ebss;
|
||||
extern unsigned long _estack;
|
||||
|
||||
#ifndef STACK_MARGIN
|
||||
#define STACK_MARGIN 8192
|
||||
#endif
|
||||
|
||||
int strlen(const char* s) {
|
||||
int i;
|
||||
for (i = 0; s[i]; i++) {
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void* memcpy(void* dst, const void* src, int sz) {
|
||||
char* d = (char*) dst;
|
||||
char* s = (char*) src;
|
||||
while (sz-- > 0) {
|
||||
*(d++) = *(s++);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
int memcmp(const void* dst, const void* src, int sz) {
|
||||
unsigned char* d = (unsigned char*) dst;
|
||||
unsigned char* s = (unsigned char*) src;
|
||||
int i, v;
|
||||
for (i = 0; i < sz; i++) {
|
||||
v = *(d++) - *(s++);
|
||||
if (v != 0) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *memset (void *dest, int val, size_t len)
|
||||
{
|
||||
unsigned char *ptr = dest;
|
||||
while (len-- > 0)
|
||||
*ptr++ = val;
|
||||
return dest;
|
||||
}
|
||||
|
||||
void* memmove(void* dst, const void* src, int sz) {
|
||||
unsigned char* d = (unsigned char*) dst;
|
||||
unsigned char* s = (unsigned char*) src;
|
||||
int i;
|
||||
if (d < s) {
|
||||
for (i = 0; i < sz; i++) {
|
||||
*(d++) = *(s++);
|
||||
}
|
||||
} else {
|
||||
d += sz;
|
||||
s += sz;
|
||||
for (i = 0; i < sz; i++) {
|
||||
*(--d) = *(--s);
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
int strcmp (const char *p1, const char *p2)
|
||||
{
|
||||
const unsigned char *s1 = (const unsigned char *) p1;
|
||||
const unsigned char *s2 = (const unsigned char *) p2;
|
||||
unsigned char c1, c2;
|
||||
do
|
||||
{
|
||||
c1 = (unsigned char) *s1++;
|
||||
c2 = (unsigned char) *s2++;
|
||||
if (c1 == '\0')
|
||||
return c1 - c2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
char *strchr (register const char *s, int c)
|
||||
{
|
||||
do {
|
||||
if (*s == c)
|
||||
{
|
||||
return (char*)s;
|
||||
}
|
||||
} while (*s++);
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *strcpy (char *dest, const char *src)
|
||||
{
|
||||
return memcpy (dest, src, strlen (src) + 1);
|
||||
}
|
||||
|
||||
int strncmp(const char *s1, const char *s2, register size_t n)
|
||||
{
|
||||
register unsigned char u1, u2;
|
||||
while (n-- > 0)
|
||||
{
|
||||
u1 = (unsigned char) *s1++;
|
||||
u2 = (unsigned char) *s2++;
|
||||
if (u1 != u2)
|
||||
return u1 - u2;
|
||||
if (u1 == '\0')
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strstr (const char *s1, const char *s2)
|
||||
{
|
||||
const char *p = s1;
|
||||
const size_t len = strlen (s2);
|
||||
for (; (p = strchr (p, *s2)) != 0; p++)
|
||||
{
|
||||
if (strncmp (p, s2, len) == 0)
|
||||
return (char *)p;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
//char *__brkval = (char *)&_ebss;
|
||||
//
|
||||
//void * _sbrk(int incr)
|
||||
//{
|
||||
// char *prev, *stack;
|
||||
//
|
||||
// prev = __brkval;
|
||||
// if (incr != 0) {
|
||||
// #if defined __K64F__
|
||||
// __asm__ volatile("mov %0, sp" : "=r" (stack) ::);
|
||||
// #endif
|
||||
// if (prev + incr >= stack - STACK_MARGIN) {
|
||||
//// errno = ENOMEM;
|
||||
// return (void *)-1;
|
||||
// }
|
||||
// __brkval = prev + incr;
|
||||
// }
|
||||
// return prev;
|
||||
//}
|
||||
|
||||
//extern char __end__; /**< Defined by the linker */
|
||||
//extern char __HeapLimit; /**< Defined by the linker */
|
||||
//void * _sbrk(int incr)
|
||||
//{
|
||||
// static char *heap_end;
|
||||
// char *prev_heap_end;
|
||||
//
|
||||
// if (heap_end == 0)
|
||||
// {
|
||||
// heap_end = &__end__;
|
||||
//xprintf("Memory start:%d, %08lx\n",incr, heap_end);
|
||||
// }
|
||||
//
|
||||
// prev_heap_end = heap_end;
|
||||
// if ((heap_end + incr) > (char*) &__HeapLimit)
|
||||
// {
|
||||
//xprintf("Memory exhausted:%d, %08lx\n",incr, prev_heap_end);
|
||||
// //errno = ENOMEM;
|
||||
// return ((void*)-1); // error - no more memory
|
||||
// }
|
||||
// heap_end += incr;
|
||||
//xprintf("Allocate:%d,end:%08lx\n",incr, prev_heap_end);
|
||||
// return prev_heap_end;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
__attribute__((weak))
|
||||
int _read(int file, char *ptr, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int _close(int fd)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
__attribute__((weak))
|
||||
int _fstat(int fd, struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int _isatty(int fd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int _lseek(int fd, long long offset, int whence)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void _exit(int status)
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void __cxa_pure_virtual()
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int __cxa_guard_acquire (char *g)
|
||||
{
|
||||
return !(*g);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void __cxa_guard_release(char *g)
|
||||
{
|
||||
*g = 1;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void abort(void)
|
||||
{
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
58
apps/coremark/Makefile
Executable file
58
apps/coremark/Makefile
Executable file
@@ -0,0 +1,58 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = coremark
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
|
||||
# Coremark specific settings.
|
||||
COREMARK_DIR = $(SWDIR)/common/CoreMark
|
||||
COREMARK_SRC = $(COREMARK_DIR)/core_list_join.c $(COREMARK_DIR)/core_main_embedded.c $(COREMARK_DIR)/core_matrix.c $(COREMARK_DIR)/core_state.c $(COREMARK_DIR)/core_util.c $(COREMARK_DIR)/ee_printf.c $(COREMARK_DIR)/core_portme.c
|
||||
COREMARK_OBJ = $(patsubst $(COREMARK_DIR)/%.c,$(BUILD_DIR)/%.o,$(COREMARK_SRC))
|
||||
|
||||
MAIN_OBJ = $(COREMARK_OBJ)
|
||||
|
||||
CFLAGS += -I$(COREMARK_DIR)
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
110
apps/coremark/coremark.c
Executable file
110
apps/coremark/coremark.c
Executable file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: coremark.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "coremk.h"
|
||||
#include "coremark.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.h"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "COREMARK"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
//char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
// Run a CoreMark test to evaluate CPU speed.
|
||||
xputs("Running CoreMark test, please wait ...\n\n");
|
||||
CoreMarkTest();
|
||||
retCode = 0;
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
125
apps/coremark/coremk.h
Executable file
125
apps/coremark/coremk.h
Executable file
@@ -0,0 +1,125 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: coremark.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef COREMARK_H
|
||||
#define COREMARK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
#define DEBUG 1
|
||||
#define CORE_DEBUG 1
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 1
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // COREMARK_H
|
||||
45
apps/ddump/Makefile
Executable file
45
apps/ddump/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = ddump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
123
apps/ddump/ddump.c
Executable file
123
apps/ddump/ddump.c
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ddump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "ddump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "DDUMP"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, §or)) sector = G->Sector;
|
||||
fr = disk_read((BYTE)drive, G->Buff, sector, 1);
|
||||
if(!fr)
|
||||
{
|
||||
G->Sector = sector + 1;
|
||||
xprintf("Sector:%lu\n", sector);
|
||||
memoryDump((uint32_t)G->Buff, 0x200, 16, 0, 32);
|
||||
}
|
||||
}
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/ddump/ddump.h
Executable file
123
apps/ddump/ddump.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ddump.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DDUMP_H
|
||||
#define DDUMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 1
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // DDUMP_H
|
||||
58
apps/dhry/Makefile
Executable file
58
apps/dhry/Makefile
Executable file
@@ -0,0 +1,58 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = dhry
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
|
||||
# Dhrystone specific settings.
|
||||
DHRY_DIR = $(SWDIR)/common/Dhrystone
|
||||
DHRY_SRC = $(DHRY_DIR)/dhry_1.c $(DHRY_DIR)/dhry_2.c
|
||||
DHRY_OBJ = $(patsubst $(DHRY_DIR)/%.c,$(BUILD_DIR)/%.o,$(DHRY_SRC))
|
||||
|
||||
MAIN_OBJ = $(DHRY_OBJ)
|
||||
|
||||
CFLAGS += -I$(DHRY_DIR)
|
||||
# Enable Dhrystone Test
|
||||
OFLAGS += -DDHRYSTONE_TEST
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
110
apps/dhry/dhry.c
Executable file
110
apps/dhry/dhry.c
Executable file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dhrystone.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "dhrystone.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "DHRYSTONE"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
//char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
//FRESULT fr = 1;
|
||||
|
||||
// Run a Dhrystone test to evaluate CPU speed.
|
||||
xputs("Running Dhrystone test, please wait ...\n");
|
||||
main_dhry();
|
||||
retCode = 0;
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
124
apps/dhry/dhrystone.h
Executable file
124
apps/dhry/dhrystone.h
Executable file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dhry.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DHRY_H
|
||||
#define DHRY_H
|
||||
#include <dhry.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 1
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // DHRY_H
|
||||
45
apps/dstat/Makefile
Executable file
45
apps/dstat/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = dstat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
151
apps/dstat/dstat.c
Executable file
151
apps/dstat/dstat.c
Executable file
@@ -0,0 +1,151 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dstat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "dstat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "DSTAT"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char line[120];
|
||||
long drive;
|
||||
long sector;
|
||||
uint8_t cardType;
|
||||
|
||||
if (xatoi(&ptr, &drive))
|
||||
{
|
||||
if (disk_ioctl((BYTE)drive, GET_SECTOR_COUNT, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Drive size: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, GET_BLOCK_SIZE, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Erase block: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_TYPE, &cardType) == RES_OK)
|
||||
{
|
||||
xprintf("Card type: %u\n", cardType);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_CSD, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("CSD:\n"); memoryDump((uint32_t)G->Buff, 16, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_CID, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("CID:\n"); memoryDump((uint32_t)G->Buff, 16, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_OCR, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("OCR:\n"); memoryDump((uint32_t)G->Buff, 4, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_SDSTAT, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("SD Status:\n");
|
||||
memoryDump((uint32_t)G->Buff, 64, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, ATA_GET_MODEL, line) == RES_OK)
|
||||
{
|
||||
line[40] = '\0'; xprintf("Model: %s\n", line);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, ATA_GET_SN, line) == RES_OK)
|
||||
{
|
||||
line[20] = '\0'; xprintf("S/N: %s\n", line);
|
||||
}
|
||||
} else
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/dstat/dstat.h
Executable file
123
apps/dstat/dstat.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dstat.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DSTAT_H
|
||||
#define DSTAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 1
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // DSTAT_H
|
||||
65
apps/ed/Makefile
Executable file
65
apps/ed/Makefile
Executable file
@@ -0,0 +1,65 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = ed
|
||||
APP_DIR = $(CURDIR)/..
|
||||
APP_COMMON_DIR = $(CURDIR)/../common
|
||||
BASEDIR = ../../..
|
||||
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
override HEAPADDR = 0x1FFF5000
|
||||
override HEAPSIZE = 0x00033000
|
||||
override STACKADDR = 0x20028000
|
||||
override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Kilo.
|
||||
APP_C_SRC = $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
|
||||
CFLAGS =
|
||||
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS = -nostdlib
|
||||
|
||||
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
|
||||
# Useful for sub-makes
|
||||
FILTER1 = $(filter-out $(filter HEAPADDR=%,$(MAKEFLAGS)), $(MAKEFLAGS))
|
||||
FILTER2 = $(filter-out $(filter HEAPSIZE=%,$(FILTER1)), $(FILTER1))
|
||||
NEWMAKEFLAGS = $(FILTER2) HEAPADDR=$(HEADADDR) HEAPSIZE=$(HEAPSIZE)
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
1284
apps/ed/ed.c
Normal file
1284
apps/ed/ed.c
Normal file
File diff suppressed because it is too large
Load Diff
130
apps/ed/ed.h
Executable file
130
apps/ed/ed.h
Executable file
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ed.h
|
||||
// Created: April 2020
|
||||
// Author(s): Philip Smart
|
||||
// Description: A stripped down memory lean version of the Kilo editor. Kilo uses more than 3x the
|
||||
// size of the file being editted through malloc which can be a problem on the zpu
|
||||
// depending upon model and also limits the filesize to 64K on the K4F. Hence stripping
|
||||
// out nicities such as highlights and render.
|
||||
//
|
||||
// This program implements a loadable application which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits: Salvatore Sanfilippo <antirez at gmail dot com> 2016 for his 0.0.1 verson of Kilo
|
||||
// upon which this editor is based.
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org> zOS/ZPUTA enhancements, bug
|
||||
// fixes and adaptation to the zOS/ZPUTA framework.
|
||||
//
|
||||
// History: April 2020 - Ported v0.0.1 of Kilo and stripped it of features to get a leaner
|
||||
// memory using editor. Some functionality has been lost from the
|
||||
// original editor but it is still very useable.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef ED_H
|
||||
#define ED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 1
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // ED_H
|
||||
45
apps/falloc/Makefile
Executable file
45
apps/falloc/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = falloc
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
123
apps/falloc/falloc.c
Executable file
123
apps/falloc/falloc.c
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: falloc.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "falloc.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.2"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FALLOC"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long size;
|
||||
long option = 0;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot allocate block.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &size) || !xatoi(&ptr, &option))
|
||||
{
|
||||
xputs("Illegal <size> or <option> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_expand(&G->File[0], (DWORD)size, (BYTE)option);
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/falloc/falloc.h
Executable file
123
apps/falloc/falloc.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: falloc.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FALLOC_H
|
||||
#define FALLOC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 1
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FALLOC_H
|
||||
103
apps/falloc/falloc.rpt.tmp2
Normal file
103
apps/falloc/falloc.rpt.tmp2
Normal file
@@ -0,0 +1,103 @@
|
||||
|
||||
falloc.elf: file format elf32-littlearm
|
||||
falloc.elf
|
||||
architecture: arm, flags 0x00000112:
|
||||
EXEC_P, HAS_SYMS, D_PAGED
|
||||
start address 0x1fff8000
|
||||
|
||||
Program Header:
|
||||
LOAD off 0x00000000 vaddr 0x1fff0000 paddr 0x1fff0000 align 2**16
|
||||
filesz 0x00008564 memsz 0x00008564 flags r-x
|
||||
LOAD off 0x00018000 vaddr 0x20018000 paddr 0x1fff8564 align 2**16
|
||||
filesz 0x00000428 memsz 0x00000444 flags rw-
|
||||
private flags = 5000400: [Version5 EABI] [hard-float ABI]
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .text 00000560 1fff8000 1fff8000 00008000 2**2
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
1 .fini 00000004 1fff8560 1fff8560 00008560 2**2
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .usbdescriptortable 00000000 20018000 20018000 00018428 2**0
|
||||
CONTENTS
|
||||
3 .dmabuffers 00000000 20018000 20018000 00018428 2**0
|
||||
CONTENTS
|
||||
4 .usbbuffers 00000000 20018000 20018000 00018428 2**0
|
||||
CONTENTS
|
||||
5 .data 00000428 20018000 1fff8564 00018000 2**3
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
6 .bss 0000001c 20018428 1fff898c 00018428 2**2
|
||||
ALLOC
|
||||
7 .ARM.attributes 00000030 00000000 00000000 00018428 2**0
|
||||
CONTENTS, READONLY
|
||||
8 .debug_frame 000000d8 00000000 00000000 00018458 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
SYMBOL TABLE:
|
||||
1fff8000 l d .text 00000000 .text
|
||||
1fff8560 l d .fini 00000000 .fini
|
||||
20018000 l d .usbdescriptortable 00000000 .usbdescriptortable
|
||||
20018000 l d .dmabuffers 00000000 .dmabuffers
|
||||
20018000 l d .usbbuffers 00000000 .usbbuffers
|
||||
20018000 l d .data 00000000 .data
|
||||
20018428 l d .bss 00000000 .bss
|
||||
00000000 l d .ARM.attributes 00000000 .ARM.attributes
|
||||
00000000 l d .debug_frame 00000000 .debug_frame
|
||||
00000000 l df *ABS* 00000000 crtstuff.c
|
||||
1fff8400 l F .text 00000000 __do_global_dtors_aux
|
||||
20018428 l .bss 00000000 completed.8605
|
||||
1fff8424 l F .text 00000000 frame_dummy
|
||||
2001842c l .bss 00000000 object.8610
|
||||
1fff855c l O .text 00000000 __frame_dummy_init_array_entry
|
||||
00000000 l df *ABS* 00000000 __call_atexit.c
|
||||
1fff845c l F .text 00000014 register_fini
|
||||
00000000 l df *ABS* 00000000 atexit.c
|
||||
00000000 l df *ABS* 00000000 fini.c
|
||||
00000000 l df *ABS* 00000000 __atexit.c
|
||||
00000000 l df *ABS* 00000000 impure.c
|
||||
20018000 l O .data 00000428 impure_data
|
||||
00000000 l df *ABS* 00000000 /srv/dvlp/Projects/dev/github/tranZPUter/software/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/crti.o
|
||||
00000000 l df *ABS* 00000000 /srv/dvlp/Projects/dev/github/tranZPUter/software/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/crtn.o
|
||||
00000000 l df *ABS* 00000000
|
||||
00000000 l *UND* 00000000 printFSCode
|
||||
00000000 l *UND* 00000000 f_expand
|
||||
20018428 l .bss 00000000 __bss_start__
|
||||
00000000 l *UND* 00000000 xatoi
|
||||
00000000 l *UND* 00000000 xprintf
|
||||
00000000 l *UND* 00000000 _VectorsFlash
|
||||
20018444 l .bss 00000000 __bss_end__
|
||||
00000000 l *UND* 00000000 xputs
|
||||
00000000 l *UND* 00000000 software_init_hook
|
||||
00000000 l *UND* 00000000 main
|
||||
1fff8560 l .text 00000000 __init_array_end
|
||||
00000000 l *UND* 00000000 hardware_init_hook
|
||||
1fff8558 l .text 00000000 __preinit_array_end
|
||||
00000000 l *UND* 00000000 __stack
|
||||
1fff8558 l .text 00000000 __init_array_start
|
||||
00000000 l *UND* 00000000 _exit
|
||||
1fff8558 l .text 00000000 __preinit_array_start
|
||||
00000000 l *UND* 00000000 free
|
||||
1fff8564 g .fini 00000000 __exidx_end
|
||||
1fff8564 g .fini 00000000 _etext
|
||||
20018428 g .bss 00000000 _sbss
|
||||
00000000 w *UND* 00000000 __fini_array_end
|
||||
00000000 w *UND* 00000000 malloc
|
||||
20018000 g .data 00000000 _sdata
|
||||
1fff8564 g .fini 00000000 __exidx_start
|
||||
1fff8548 g O .text 00000004 _global_impure_ptr
|
||||
20018444 g .bss 00000000 __bss_end
|
||||
1fff854c g F .text 00000000 _init
|
||||
1fff847c g F .text 00000028 __libc_fini_array
|
||||
20018444 g .bss 00000000 _ebss
|
||||
00000000 w *UND* 00000000 __deregister_frame_info
|
||||
1fff84a4 g F .text 000000a4 __register_exitproc
|
||||
0000001f g *ABS* 00000000 _teensy_model_identifier
|
||||
00000000 w *UND* 00000000 __fini_array_start
|
||||
00000000 w *UND* 00000000 __libc_fini
|
||||
1fff8560 g F .fini 00000000 _fini
|
||||
1fff8470 g F .text 0000000c atexit
|
||||
20030000 g .bss 00000000 _estack
|
||||
20018428 g .data 00000000 _edata
|
||||
00000000 w *UND* 00000000 _Jv_RegisterClasses
|
||||
00000000 w *UND* 00000000 __register_frame_info
|
||||
|
||||
|
||||
45
apps/fattr/Makefile
Executable file
45
apps/fattr/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fattr
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
119
apps/fattr/fattr.c
Executable file
119
apps/fattr/fattr.c
Executable file
@@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fattr.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fattr.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FATTR"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *fileName;
|
||||
long attr;
|
||||
long mask;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if (!xatoi(&ptr, &attr) || !xatoi(&ptr, &mask))
|
||||
{
|
||||
xprintf("Illegal <attr> <mask> value.\n");
|
||||
} else
|
||||
{
|
||||
fileName = getStrParam(&ptr);
|
||||
fr = f_chmod(fileName, attr, mask);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fattr/fattr.h
Executable file
123
apps/fattr/fattr.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fattr.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FATTR_H
|
||||
#define FATTR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 1
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FATTR_H
|
||||
45
apps/fcat/Makefile
Executable file
45
apps/fcat/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
115
apps/fcat/fcat.c
Executable file
115
apps/fcat/fcat.c
Executable file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fcat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FCAT"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *fileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
fileName = getStrParam(&ptr);
|
||||
if(*fileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
} else
|
||||
fr = fileCat(fileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fcat/fcat.h
Executable file
123
apps/fcat/fcat.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcat.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCAT_H
|
||||
#define FCAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 1
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FSAVE_H
|
||||
45
apps/fcd/Makefile
Executable file
45
apps/fcd/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcd
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
115
apps/fcd/fcd.c
Executable file
115
apps/fcd/fcd.c
Executable file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcd.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fcd.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FCD"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dirName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <path> value.\n");
|
||||
} else
|
||||
fr = f_chdir(dirName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fcd/fcd.h
Executable file
123
apps/fcd/fcd.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcd.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCD_H
|
||||
#define FCD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 1
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FCD_H
|
||||
45
apps/fclose/Makefile
Executable file
45
apps/fclose/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fclose
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
116
apps/fclose/fclose.c
Executable file
116
apps/fclose/fclose.c
Executable file
@@ -0,0 +1,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fclose.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fclose.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FCLOSE"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
//char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot close.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_close(&G->File[0]);
|
||||
if( fr == FR_OK ) { G->fileInUse = 0; }
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fclose/fclose.h
Executable file
123
apps/fclose/fclose.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fclose.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCLOSE_H
|
||||
#define FCLOSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 1
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FCLOSE_H
|
||||
45
apps/fconcat/Makefile
Executable file
45
apps/fconcat/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fconcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
119
apps/fconcat/fconcat.c
Executable file
119
apps/fconcat/fconcat.c
Executable file
@@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fconcat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fconcat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FCONCAT"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *src1FileName;
|
||||
char *src2FileName;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
src1FileName= getStrParam(&ptr);
|
||||
src2FileName= getStrParam(&ptr);
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*src1FileName == 0x00 || *src2FileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src1>, <src2> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileConcatenate(src1FileName, src2FileName, dstFileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fconcat/fconcat.h
Executable file
123
apps/fconcat/fconcat.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fconcat.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCONCAT_H
|
||||
#define FCONCAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 1
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FCONCAT_H
|
||||
45
apps/fcp/Makefile
Executable file
45
apps/fcp/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcp
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
117
apps/fcp/fcp.c
Executable file
117
apps/fcp/fcp.c
Executable file
@@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcp.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fcp.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FCP"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *srcFileName;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
srcFileName = getStrParam(&ptr);
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileCopy(srcFileName, dstFileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fcp/fcp.h
Executable file
123
apps/fcp/fcp.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcp.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCP_H
|
||||
#define FCP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 1
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FCP_H
|
||||
45
apps/fdel/Makefile
Executable file
45
apps/fdel/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
119
apps/fdel/fdel.c
Executable file
119
apps/fdel/fdel.c
Executable file
@@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdel.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fdel.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FDEL"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("GOING TO UNLINK(%s)\n", dstFileName);
|
||||
fr = f_unlink(dstFileName);
|
||||
xprintf("UNLINKED(%s)\n", dstFileName);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
xprintf("DONE\n");
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fdel/fdel.h
Executable file
123
apps/fdel/fdel.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdel.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FSAVE_H
|
||||
#define FSAVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 1
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FDEL_H
|
||||
45
apps/fdir/Makefile
Executable file
45
apps/fdir/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
111
apps/fdir/fdir.c
Executable file
111
apps/fdir/fdir.c
Executable file
@@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdir.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fdir.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FDIR"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *pathName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
pathName = getStrParam(&ptr);
|
||||
fr = printDirectoryListing(pathName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fdir/fdir.h
Executable file
123
apps/fdir/fdir.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdir.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDIR_H
|
||||
#define FDIR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 1
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FDIR_H
|
||||
45
apps/fdrive/Makefile
Executable file
45
apps/fdrive/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdrive
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
111
apps/fdrive/fdrive.c
Executable file
111
apps/fdrive/fdrive.c
Executable file
@@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdrive.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fdrive.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FDRIVE"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *driveNo;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
driveNo = getStrParam(&ptr);
|
||||
fr = f_chdrive(driveNo);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fdrive/fdrive.h
Executable file
123
apps/fdrive/fdrive.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdrive.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDRIVE_H
|
||||
#define FDRIVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 1
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FDRIVE_H
|
||||
45
apps/fdump/Makefile
Executable file
45
apps/fdump/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
113
apps/fdump/fdump.c
Executable file
113
apps/fdump/fdump.c
Executable file
@@ -0,0 +1,113 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fdump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FDUMP"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *srcFileName;
|
||||
uint32_t width;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
srcFileName = getStrParam(&ptr);
|
||||
if((width = getUintParam(&ptr)) == 0) { width = 8; }
|
||||
fr = fileDump(srcFileName, width);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fdump/fdump.h
Executable file
123
apps/fdump/fdump.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdump.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDUMP_H
|
||||
#define FDUMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 1
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FDUMP_H
|
||||
45
apps/finspect/Makefile
Executable file
45
apps/finspect/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = finspect
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
123
apps/finspect/finspect.c
Executable file
123
apps/finspect/finspect.c
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: finspect.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "finspect.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FINSPECT"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t startPos;
|
||||
uint32_t len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, buffer contents invalid.\n");
|
||||
} else
|
||||
{
|
||||
startPos = getUintParam(&ptr);
|
||||
len = getUintParam(&ptr);
|
||||
if(len == 0)
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
} else
|
||||
fr = fileBlockDump(startPos, len);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/finspect/finspect.h
Executable file
123
apps/finspect/finspect.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: finspect.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FINSPECT_H
|
||||
#define FINSPECT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 1
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FINSPECT_H
|
||||
45
apps/flabel/Makefile
Executable file
45
apps/flabel/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = flabel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
115
apps/flabel/flabel.c
Executable file
115
apps/flabel/flabel.c
Executable file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: flabel.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "flabel.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FLABEL"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *labelName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
labelName = getStrParam(&ptr);
|
||||
if(*labelName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <label> value.\n");
|
||||
} else
|
||||
fr = f_setlabel(labelName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/flabel/flabel.h
Executable file
123
apps/flabel/flabel.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: flabel.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FLABEL_H
|
||||
#define FLABEL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 1
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FLABEL_H
|
||||
45
apps/fmkdir/Makefile
Executable file
45
apps/fmkdir/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fmkdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
115
apps/fmkdir/fmkdir.c
Executable file
115
apps/fmkdir/fmkdir.c
Executable file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkdir.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fmkdir.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FMKDIR"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dirName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <dir> value.\n");
|
||||
} else
|
||||
fr = f_mkdir(dirName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fmkdir/fmkdir.h
Executable file
123
apps/fmkdir/fmkdir.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkdir.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FMKDIR_H
|
||||
#define FMKDIR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 1
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FMKDIR_H
|
||||
45
apps/fmkfs/Makefile
Executable file
45
apps/fmkfs/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fmkfs
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
127
apps/fmkfs/fmkfs.c
Executable file
127
apps/fmkfs/fmkfs.c
Executable file
@@ -0,0 +1,127 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkfs.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fmkfs.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FMKFS"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char line[120];
|
||||
long driveNo;
|
||||
long type;
|
||||
long bytesClust;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
BYTE Buff[4096];
|
||||
FRESULT fr = 1;
|
||||
|
||||
if (!xatoi(&ptr, &driveNo) || (UINT)driveNo > 9 || !xatoi(&ptr, &type) || !xatoi(&ptr, &bytesClust))
|
||||
{
|
||||
xprintf("Illegal parameters, should be: <ld#> <type> <bytes/clust>\n");
|
||||
fr = FR_INVALID_DRIVE;
|
||||
} else
|
||||
{
|
||||
xprintf("The drive %u will be formatted. Are you sure? (Y/n)=", (WORD)driveNo);
|
||||
xgets(line, sizeof line);
|
||||
if (line[0] == 'Y')
|
||||
{
|
||||
xsprintf(line, "%u:", (UINT)driveNo);
|
||||
fr = f_mkfs(line, (BYTE)type, (DWORD)bytesClust, Buff, sizeof Buff);
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fmkfs/fmkfs.h
Executable file
123
apps/fmkfs/fmkfs.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkfs.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FMKFS_H
|
||||
#define FMKFS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 1
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FMKFS_H
|
||||
45
apps/fopen/Makefile
Executable file
45
apps/fopen/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fopen
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
125
apps/fopen/fopen.c
Executable file
125
apps/fopen/fopen.c
Executable file
@@ -0,0 +1,125 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fopen.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fopen.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FOPEN"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *fileName;
|
||||
long mode;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse)
|
||||
{
|
||||
xputs("File already open, please close before re-opening\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &mode))
|
||||
{
|
||||
xprintf("Illegal <mode> value.\n");
|
||||
} else
|
||||
{
|
||||
fileName = getStrParam(&ptr);
|
||||
fr = f_open(&G->File[0], fileName, (BYTE)mode);
|
||||
if( fr == FR_OK ) { G->fileInUse = 1; }
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
124
apps/fopen/fopen.h
Executable file
124
apps/fopen/fopen.h
Executable file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fopen.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FOPEN_H
|
||||
#define FOPEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 1
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FOPEN_H
|
||||
45
apps/fread/Makefile
Executable file
45
apps/fread/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fread
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
122
apps/fread/fread.c
Executable file
122
apps/fread/fread.c
Executable file
@@ -0,0 +1,122 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fread.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fread.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FREAD"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot read.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileBlockRead(&G->File[0], len);
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fread/fread.h
Executable file
123
apps/fread/fread.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fread.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FREAD_H
|
||||
#define FREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 1
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FREAD_H
|
||||
45
apps/frename/Makefile
Executable file
45
apps/frename/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = frename
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
117
apps/frename/frename.c
Executable file
117
apps/frename/frename.c
Executable file
@@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: frename.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "frename.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FRENAME"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *srcFileName;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
srcFileName = getStrParam(&ptr);
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src> or <dst> value.\n");
|
||||
} else
|
||||
fr = f_rename(srcFileName, dstFileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/frename/frename.h
Executable file
123
apps/frename/frename.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: frename.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FRENAME_H
|
||||
#define FRENAME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 1
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FRENAME_H
|
||||
45
apps/fsave/Makefile
Executable file
45
apps/fsave/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fsave
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
119
apps/fsave/fsave.c
Executable file
119
apps/fsave/fsave.c
Executable file
@@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fsave.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fsave.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FSAVE"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dstFileName;
|
||||
uint32_t memAddr;
|
||||
uint32_t len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
dstFileName = getStrParam(&ptr);
|
||||
memAddr = getUintParam(&ptr);
|
||||
len = getUintParam(&ptr);
|
||||
if(*dstFileName == 0x00 || len == 0)
|
||||
{
|
||||
xprintf("Illegal <dst> or <len> value.\n");
|
||||
} else
|
||||
fr = fileSave(dstFileName, memAddr, len);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
123
apps/fsave/fsave.h
Executable file
123
apps/fsave/fsave.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fsave.h
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FSAVE_H
|
||||
#define FSAVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 1
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // FSAVE_H
|
||||
45
apps/fseek/Makefile
Executable file
45
apps/fseek/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
|
||||
## operating system.
|
||||
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
|
||||
## The app is for testing some component where the code is not built into ZPUTA or
|
||||
## a user application for zOS.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fseek
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
123
apps/fseek/fseek.c
Executable file
123
apps/fseek/fseek.c
Executable file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fseek.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the zOS/ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the zOS/ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by zOS/ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of zOS/ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
// April 2020 - Updates to function with the K64F processor and zOS.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "k64f_soc.h"
|
||||
#define uint32_t __uint32_t
|
||||
#define uint16_t __uint16_t
|
||||
#define uint8_t __uint8_t
|
||||
#define int32_t __int32_t
|
||||
#define int16_t __int16_t
|
||||
#define int8_t __int8_t
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
#include "zputa_app.h"
|
||||
#elif defined __ZOS__
|
||||
#include "zOS_app.h"
|
||||
#else
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "fseek.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.1"
|
||||
#define VERSION_DATE "10/04/2020"
|
||||
#define APP_NAME "FSEEK"
|
||||
|
||||
// Main entry and start point of a zOS/ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code for the ZPU is saved in _memreg by the C compiler, this is transferred to _memreg in zOS/ZPUTA in appcrt0.s prior to return.
|
||||
// The K64F ARM processor uses the standard register passing conventions, return code is stored in R0.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long pos;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr = 1;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot seek.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &pos))
|
||||
{
|
||||
xprintf("Illegal <pos> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_lseek(&G->File[0], pos);
|
||||
if( fr == FR_OK ) { xprintf("fptr = %lu(0x%lX)\n", (DWORD)G->File[0].fptr, (DWORD)G->File[0].fptr); }
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user