Initial commit created from manual fork of development tree

This commit is contained in:
root
2019-10-22 14:49:06 +01:00
commit f21bf07f4b
454 changed files with 291780 additions and 0 deletions

Binary file not shown.

Binary file not shown.

42
software/apps/bwrite/Makefile Executable file
View File

@@ -0,0 +1,42 @@
#########################################################################################################
##
## Name: Makefile
## Created: July 2019
## Author(s): Philip Smart
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
## test application. The app generally is for testing some component where the code is
## not built into ZPUTA or memory restrictions prohibit it being built in.
##
## Credits:
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
##
## History: July 2019 - Initial Makefile created for template use.
##
## 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.
## COREMARK_TEST - Add the CoreMark test suite.
## DHYRSTONE_TEST - Add the Dhrystone test suite.
## USE_SDCARD - Add the SDCard logic.
##
#########################################################################################################
## 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 = ../../..
include $(APP_DIR)/Makefile.inc

90
software/apps/bwrite/bwrite.c Executable file
View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Name: bwrite.c
// Created: July 2019
// Author(s): Philip Smart
// Description: Standalone App for the ZPU test application.
// This program implements a loadable appliation which can be loaded from SD card by
// the ZPUTA application. The idea is that commands or programs can be stored on the
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
// available.
//
// Credits:
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
//
// History: July 2019 - Initial framework creation.
//
// 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/>.
/////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <zstdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <zpu-types.h>
#include "zpu_soc.h"
//#include "uart.h"
#include "interrupts.h"
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h"
#include <zstdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "xprintf.h"
#include "utils.h"
#include "zputa_app.h"
#include "bwrite.h"
// Utility functions.
#include "tools.c"
// Version info.
#define VERSION "v1.0"
#define VERSION_DATE "18/07/2019"
#define APP_NAME "BWRITE"
// Main entry and start point of a 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 is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
//
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, &sector))
{
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);
}

107
software/apps/bwrite/bwrite.h Executable file
View File

@@ -0,0 +1,107 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Name: bwrite.h
// Created: July 2018
// Author(s): Philip Smart
// Description: Standalone App for the ZPU test application.
//
// Credits:
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
//
// History: July 2019 - Initial framework created.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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
// 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_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) */
#endif // BWRITE_H