Completed port of k64f to stdio and system heap with optional local heap
This commit is contained in:
@@ -113,18 +113,18 @@ BUILD_DIR = $(abspath $(CURDIR)/build)
|
||||
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
|
||||
#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 =
|
||||
COMMON_SRC = #../common/sysutils.c #../common/sbrk.c
|
||||
|
||||
# Application being built.
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
@@ -136,10 +136,11 @@ 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) # -I$(LIB_INCLUDE_DIR)
|
||||
CPPFLAGS += -Wall -g -mthumb -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)
|
||||
CPPFLAGS += -I$(COREMARK_DIR) -I$(DHRY_DIR) -I$(UMM_DIR) #-I$(LIB_INCLUDE_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.
|
||||
CPPFLAGS += -fno-builtin -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
|
||||
@@ -218,6 +219,18 @@ else
|
||||
$(error Invalid setting for TEENSY)
|
||||
endif
|
||||
|
||||
# Application specific library handling.
|
||||
ifeq ($(APP_NAME),mbasic)
|
||||
LIBS += -lnosys
|
||||
else ifeq ($(APP_NAME),ed)
|
||||
LIBS += -lc -lnosys
|
||||
else ifeq ($(APP_NAME),kilo)
|
||||
LIBS += -lc -lnosys
|
||||
else
|
||||
LIBS += -lc_s -lnosys
|
||||
endif
|
||||
|
||||
|
||||
# set arduino define if given
|
||||
ifdef ARDUINO
|
||||
CPPFLAGS += -DARDUINO=$(ARDUINO)
|
||||
|
||||
@@ -103,11 +103,11 @@ LINKMAPAPP = $(STARTUP_DIR)/app_zpu_${OS_BASEADDR}_${OS_APPADDR}.ld
|
||||
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
|
||||
#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
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "bdump.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -98,7 +91,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &offset))
|
||||
{
|
||||
xprintf("Illegal <offset> value.\n");
|
||||
printf("Illegal <offset> value.\n");
|
||||
} else
|
||||
{
|
||||
memoryDump((uint32_t)&G->Buff[offset], 0x200, 16, offset, 32);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "bedit.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &addr))
|
||||
{
|
||||
xprintf("Illegal <addr> value.\n");
|
||||
printf("Illegal <addr> value.\n");
|
||||
} else
|
||||
{
|
||||
if (xatoi(&ptr, &data))
|
||||
@@ -112,15 +105,15 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
xprintf("%04X %02X-", (WORD)addr, G->Buff[addr]);
|
||||
xgets(line, sizeof line);
|
||||
printf("%04X %02X-", (WORD)addr, G->Buff[addr]);
|
||||
fgets(line, sizeof line, stdin);
|
||||
ptr = line;
|
||||
if (*ptr == '.') break;
|
||||
if (*ptr < ' ') { addr++; continue; }
|
||||
if (xatoi(&ptr, &data)) {
|
||||
G->Buff[addr++] = (BYTE)data;
|
||||
} else {
|
||||
xputs("???\n");
|
||||
puts("???\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
APP_NAME = bfill
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
LIBS = -lumansi-k64f
|
||||
else
|
||||
LIBS =
|
||||
endif
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "bfill.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -98,7 +91,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &value))
|
||||
{
|
||||
xprintf("Illegal <n> value.\n");
|
||||
printf("Illegal <n> value.\n");
|
||||
} else
|
||||
{
|
||||
memset(G->Buff, (BYTE)value, sizeof G->Buff);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "blen.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,11 +92,11 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
printf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileSetBlockLen(len);
|
||||
if(fr) { printFSCode(fr); } else { xprintf("R/W length = %u\n", len); retCode = 0; }
|
||||
if(fr) { printFSCode(fr); } else { printf("R/W length = %lu\n", len); retCode = 0; }
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
|
||||
@@ -46,77 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,22 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +65,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "bread.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,14 +94,14 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
printf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
printf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_read((BYTE)drive, G->Buff, sector, count));
|
||||
printf("rc=%u\n", disk_read((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,77 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,22 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +65,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "bwrite.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,14 +94,14 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
printf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
printf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_write((BYTE)drive, G->Buff, sector, count));
|
||||
printf("rc=%u\n", disk_write((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,77 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -236,7 +236,8 @@ char *strstr (const char *s1, const char *s2)
|
||||
__attribute__((weak))
|
||||
int _read(int file, char *ptr, int len)
|
||||
{
|
||||
return 0;
|
||||
strcpy(ptr, "HEREHERE\n");
|
||||
return 9;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
|
||||
@@ -38,18 +38,39 @@
|
||||
APP_NAME = coremark
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
COMMON_DIR = $(CURDIR)../../common
|
||||
COREMARK_DIR = $(COMMON_DIR)/CoreMark
|
||||
|
||||
# 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))
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
ifeq ($(__K64F__),1)
|
||||
#override HEAPADDR = 0x2002f000
|
||||
#override HEAPSIZE = 0x00000000
|
||||
#override STACKADDR = 0x2002f000
|
||||
#override STACKSIZE = 0x00000000
|
||||
|
||||
MAIN_OBJ = $(COREMARK_OBJ)
|
||||
# Coremark specific settings.
|
||||
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
|
||||
CFLAGS += -I$(COREMARK_DIR)
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
else
|
||||
#override HEAPADDR = 0x0000D000
|
||||
#override HEAPSIZE = 0x00002000
|
||||
#override STACKADDR = 0x0000F000
|
||||
#override STACKSIZE = 0x00000000
|
||||
|
||||
# Coremark specific settings.
|
||||
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
|
||||
endif
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
|
||||
@@ -38,30 +38,22 @@
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdint.h>
|
||||
#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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -74,6 +66,7 @@
|
||||
//
|
||||
#include "coremk.h"
|
||||
#include "coremark.h"
|
||||
#include "app.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.h"
|
||||
@@ -97,7 +90,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
// Run a CoreMark test to evaluate CPU speed.
|
||||
xputs("Running CoreMark test, please wait ...\n\n");
|
||||
puts("Running CoreMark test, please wait ...\n\n");
|
||||
CoreMarkTest();
|
||||
retCode = 0;
|
||||
|
||||
|
||||
@@ -45,79 +45,7 @@ extern "C" {
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,22 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +65,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "ddump.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +94,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
printf("Illegal <#pd> value.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, §or)) sector = G->Sector;
|
||||
@@ -108,7 +102,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
if(!fr)
|
||||
{
|
||||
G->Sector = sector + 1;
|
||||
xprintf("Sector:%lu\n", sector);
|
||||
printf("Sector:%lu\n", sector);
|
||||
memoryDump((uint32_t)G->Buff, 0x200, 16, 0, 32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -38,18 +38,55 @@
|
||||
APP_NAME = dhry
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
COMMON_DIR = $(CURDIR)/../../common
|
||||
DHRY_DIR = $(COMMON_DIR)/Dhrystone
|
||||
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
ifeq ($(__K64F__),1)
|
||||
override HEAPADDR = 0x2002f000
|
||||
override HEAPSIZE = 0x00000000
|
||||
override STACKADDR = 0x2002f000
|
||||
override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Kilo.
|
||||
APP_C_SRC = #$(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
|
||||
CFLAGS += -I$(DHRY_DIR)
|
||||
# Enable Dhrystone Test
|
||||
OFLAGS += -DDHRYSTONE_TEST
|
||||
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS = -nostdlib
|
||||
LIBS = -lumansi-k64f -lumstdio-k64f
|
||||
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)
|
||||
else
|
||||
override HEAPADDR = 0x0000dc00
|
||||
override HEAPSIZE = 0x00001000
|
||||
override STACKADDR = 0x0000ec00
|
||||
override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Kilo.
|
||||
# Modules making up Kilo.
|
||||
APP_C_SRC = #$(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
|
||||
CFLAGS += -I$(DHRY_DIR)
|
||||
# Enable Dhrystone Test
|
||||
OFLAGS += -DDHRYSTONE_TEST
|
||||
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS = -nostdlib
|
||||
LIBS = -lumansi-zpu -limath-zpu
|
||||
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)
|
||||
endif
|
||||
|
||||
# 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)
|
||||
|
||||
# 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
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "dhrystone.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -97,7 +90,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
//FRESULT fr = 1;
|
||||
|
||||
// Run a Dhrystone test to evaluate CPU speed.
|
||||
xputs("Running Dhrystone test, please wait ...\n");
|
||||
puts("Running Dhrystone test, please wait ...\n");
|
||||
main_dhry();
|
||||
retCode = 0;
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ uint32_t app(uint32_t, uint32_t);
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
struct __file *__iob[3];
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
@@ -39,29 +39,22 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +65,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "dstat.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -102,44 +96,44 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
if (disk_ioctl((BYTE)drive, GET_SECTOR_COUNT, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Drive size: %lu sectors\n", sector);
|
||||
printf("Drive size: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, GET_BLOCK_SIZE, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Erase block: %lu sectors\n", sector);
|
||||
printf("Erase block: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_TYPE, &cardType) == RES_OK)
|
||||
{
|
||||
xprintf("Card type: %u\n", cardType);
|
||||
printf("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);
|
||||
puts("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);
|
||||
puts("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);
|
||||
puts("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");
|
||||
puts("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);
|
||||
line[40] = '\0'; printf("Model: %s\n", line);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, ATA_GET_SN, line) == RES_OK)
|
||||
{
|
||||
line[20] = '\0'; xprintf("S/N: %s\n", line);
|
||||
line[20] = '\0'; printf("S/N: %s\n", line);
|
||||
}
|
||||
} else
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
printf("Illegal <#pd> value.\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -42,18 +42,23 @@ BASEDIR = ../../..
|
||||
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
ifeq ($(__K64F__),1)
|
||||
override HEAPADDR = 0x1FFF5000
|
||||
override HEAPSIZE = 0x00033000
|
||||
override STACKADDR = 0x20028000
|
||||
override STACKSIZE = 0x00000000
|
||||
#override HEAPADDR = 0x2002f000
|
||||
#override HEAPSIZE = 0x00000000
|
||||
#override STACKADDR = 0x2002f000
|
||||
#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
|
||||
LIBS = -lumansi-k64f -lumstdio-k64f
|
||||
CPPFLAGS = #-D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
else
|
||||
override HEAPADDR = 0x0000ED00
|
||||
override HEAPSIZE = 0x00000300
|
||||
override STACKADDR = 0x0000F000
|
||||
override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Kilo.
|
||||
APP_C_SRC = #$(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
|
||||
CFLAGS =
|
||||
|
||||
145
apps/ed/ed.c
145
apps/ed/ed.c
@@ -48,30 +48,26 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <usb_serial.h>
|
||||
#include "k64f_soc.h"
|
||||
#include "../../libraries/include/ansi.h"
|
||||
#include "../../libraries/include/ctype.h"
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdmisc.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 <umm_malloc.h>
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
@@ -82,6 +78,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "ed.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -296,15 +293,15 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Save cursor position.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '7');
|
||||
printf("%c%c", 0x1b, '7');
|
||||
|
||||
// Cursor to maximum X/Y location, report cursor location
|
||||
//
|
||||
xputs("\x1b[0;0H");
|
||||
fputs("\x1b[0;0H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[999;999H");
|
||||
fputs("\x1b[999;999H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[6n");
|
||||
fputs("\x1b[6n", stdout);
|
||||
|
||||
// Read the response: ESC [ rows ; cols R
|
||||
//
|
||||
@@ -329,7 +326,7 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Restore cursor.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '8');
|
||||
printf("%c%c", 0x1b, '8');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -363,8 +360,8 @@ int editorInsertRow(int at, char *s, size_t len)
|
||||
|
||||
if (at > E.numrows) return 0;
|
||||
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
|
||||
if (at != E.numrows)
|
||||
{
|
||||
@@ -373,8 +370,8 @@ int editorInsertRow(int at, char *s, size_t len)
|
||||
}
|
||||
|
||||
E.row[at].size = len;
|
||||
E.row[at].chars = malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row[at].chars = sys_malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[at].chars,s,len+1);
|
||||
E.row[at].idx = at;
|
||||
E.numrows++;
|
||||
@@ -387,7 +384,7 @@ void editorFreeRow(erow *row)
|
||||
{
|
||||
if(row->chars != NULL)
|
||||
{
|
||||
free(row->chars);
|
||||
sys_free(row->chars);
|
||||
row->chars = NULL;
|
||||
}
|
||||
}
|
||||
@@ -398,19 +395,21 @@ void editorCleanup(void)
|
||||
{
|
||||
int idx;
|
||||
|
||||
// Go through and free all row memory.
|
||||
//
|
||||
for(idx=0; idx < E.numrows; idx++)
|
||||
{
|
||||
if(E.row[idx].chars != NULL)
|
||||
{
|
||||
free(E.row[idx].chars);
|
||||
}
|
||||
}
|
||||
|
||||
// Free the editor config structure.
|
||||
if(E.row)
|
||||
free(E.row);
|
||||
{
|
||||
// Go through and free all row memory.
|
||||
//
|
||||
for(idx=0; idx < E.numrows; idx++)
|
||||
{
|
||||
if(E.row[idx].chars != NULL)
|
||||
{
|
||||
sys_free(E.row[idx].chars);
|
||||
}
|
||||
}
|
||||
|
||||
sys_free(E.row);
|
||||
}
|
||||
|
||||
// Reset necessary variables.
|
||||
E.cx = 0;
|
||||
@@ -452,8 +451,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
|
||||
/* In the next line +2 means: new char and null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memset(row->chars+row->size,' ',padlen);
|
||||
row->chars[row->size+padlen+1] = '\0';
|
||||
row->size += padlen+1;
|
||||
@@ -461,8 +460,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* If we are in the middle of the string just make space for 1 new
|
||||
* char plus the (already existing) null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memmove(row->chars+at+1,row->chars+at,row->size-at+1);
|
||||
row->size++;
|
||||
}
|
||||
@@ -475,8 +474,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* Append the string 's' at the end of a row */
|
||||
int editorRowAppendString(erow *row, char *s, size_t len)
|
||||
{
|
||||
row->chars = realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { xprintf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { printf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
memcpy(row->chars+row->size,s,len);
|
||||
|
||||
row->size += len;
|
||||
@@ -619,11 +618,10 @@ int editorOpen(char *filename)
|
||||
|
||||
E.dirty = 0;
|
||||
E.filename = filename;
|
||||
|
||||
fr = f_open(&fp, filename, FA_OPEN_ALWAYS | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to open file:%s\n", filename);
|
||||
printf("Failed to open file:%s\n", filename);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -637,7 +635,7 @@ int editorOpen(char *filename)
|
||||
fr = f_lseek(&fp, 0);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to rewind file:%s\n", filename);
|
||||
printf("Failed to rewind file:%s\n", filename);
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -647,8 +645,9 @@ int editorOpen(char *filename)
|
||||
{
|
||||
// Allocate memory for the row array.
|
||||
//
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_malloc(sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memset(E.row, '\0', sizeof(erow)*(E.numrows));
|
||||
|
||||
// Now go through the file again and populate each row with the data.
|
||||
//
|
||||
@@ -660,14 +659,15 @@ int editorOpen(char *filename)
|
||||
buf[--linelen] = '\0';
|
||||
|
||||
E.row[rowNo].size = linelen;
|
||||
E.row[rowNo].chars = malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row[rowNo].chars = sys_malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[rowNo].chars, buf, linelen+1);
|
||||
E.row[rowNo].idx = rowNo;
|
||||
rowNo++;
|
||||
}
|
||||
}
|
||||
f_close(&fp);
|
||||
printf("EXIT\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ int editorSave(char *newFileName)
|
||||
fr = f_open(&fp, (newFileName == NULL ? E.filename : newFileName), FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
sprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -710,13 +710,13 @@ int editorSave(char *newFileName)
|
||||
f_close(&fp);
|
||||
|
||||
E.dirty = 0;
|
||||
xsprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
sprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 0;
|
||||
|
||||
writeerr:
|
||||
f_close(&fp);
|
||||
xsprintf(E.statusmsg, "Can't save! I/O error");
|
||||
sprintf(E.statusmsg, "Can't save! I/O error");
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -740,10 +740,10 @@ void abAppend(const char *s, int len, int flush)
|
||||
// First call, allocate memory for the buffer.
|
||||
if(ab == NULL)
|
||||
{
|
||||
ab = malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab = sys_malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = sys_malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->len = 0;
|
||||
}
|
||||
|
||||
@@ -752,14 +752,14 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
const char *ptr = ab->b;
|
||||
for(ptr=ab->b; ptr < ab->b+ab->len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
// If we are flushing then write out the additional data passed in to the method.
|
||||
//
|
||||
if(flush)
|
||||
{
|
||||
for(ptr=s; ptr < s+len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
}
|
||||
ab->len = 0;
|
||||
@@ -775,8 +775,8 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
// On flush we free up the memory, extra cycles in alloc and free but keeps the heap balanced and no memory leaks when we exit.
|
||||
//
|
||||
free(ab->b);
|
||||
free(ab);
|
||||
sys_free(ab->b);
|
||||
sys_free(ab);
|
||||
ab = NULL;
|
||||
}
|
||||
}
|
||||
@@ -801,7 +801,7 @@ int editorRefreshScreen(void)
|
||||
if (E.numrows == 0 && y == E.screenrows/3)
|
||||
{
|
||||
char welcome[80];
|
||||
xsprintf(welcome, "Ed(itor) -- version %s\x1b[0K\r\n", ED_VERSION);
|
||||
sprintf(welcome, "Ed(itor) -- version %s\x1b[0K\r\n", ED_VERSION);
|
||||
int welcomelen = strlen(welcome);
|
||||
int padding = (E.screencols-welcomelen)/2;
|
||||
if (padding)
|
||||
@@ -858,9 +858,9 @@ int editorRefreshScreen(void)
|
||||
abAppend("\x1b[0K",4, 0);
|
||||
abAppend("\x1b[7m",4, 0);
|
||||
char status[80], rstatus[80];
|
||||
xsprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
sprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
int len = strlen(status);
|
||||
xsprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
sprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
int rlen = strlen(rstatus);
|
||||
if (len > E.screencols) len = E.screencols;
|
||||
abAppend(status,len, 0);
|
||||
@@ -897,7 +897,7 @@ int editorRefreshScreen(void)
|
||||
cx++;
|
||||
}
|
||||
}
|
||||
xsprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
sprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
abAppend(buf,strlen(buf), 0);
|
||||
|
||||
/* Show cursor and Flush to complete.
|
||||
@@ -921,7 +921,7 @@ void editorFind(void) {
|
||||
|
||||
while(1)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
sprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
E.statusmsg_time = sysmillis();
|
||||
editorRefreshScreen();
|
||||
|
||||
@@ -934,7 +934,7 @@ void editorFind(void) {
|
||||
E.cx = saved_cx; E.cy = saved_cy;
|
||||
E.coloff = saved_coloff; E.rowoff = saved_rowoff;
|
||||
}
|
||||
xsprintf(E.statusmsg, "");
|
||||
E.statusmsg[0] = '\0';
|
||||
E.statusmsg_time = sysmillis();
|
||||
return;
|
||||
} else if (c == ARROW_RIGHT || c == ARROW_DOWN) {
|
||||
@@ -1119,7 +1119,7 @@ uint32_t editorProcessKeypress(void)
|
||||
*/
|
||||
if (E.dirty > 0 && quit_times > 0)
|
||||
{
|
||||
xsprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
sprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
E.statusmsg_time = sysmillis();
|
||||
quit_times--;
|
||||
}
|
||||
@@ -1129,8 +1129,8 @@ uint32_t editorProcessKeypress(void)
|
||||
cySave = E.cy;
|
||||
E.cy = E.screenrows-1;
|
||||
lastLine = editorRefreshScreen();
|
||||
xprintf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
xputs("\x1b[0J");
|
||||
printf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
fputs("\x1b[0J", stdout);
|
||||
|
||||
// Restore the cursor so it opens in the same place when edit is restarted.
|
||||
E.cx = cxSave;
|
||||
@@ -1212,7 +1212,7 @@ uint32_t initEditor(void)
|
||||
E.syntax = NULL;
|
||||
if (getWindowSize(&E.screenrows,&E.screencols) == -1)
|
||||
{
|
||||
xprintf("Unable to query the screen for size (columns / rows)");
|
||||
printf("Unable to query the screen for size (columns / rows)");
|
||||
return(1);
|
||||
}
|
||||
E.screenrows -= 2; /* Get room for status bar. */
|
||||
@@ -1238,14 +1238,14 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
pathName = getStrParam(&ptr);
|
||||
if(strlen(pathName) == 0)
|
||||
{
|
||||
xprintf("Usage: ed <file>\n");
|
||||
printf("Usage: ed <file>\n");
|
||||
} else
|
||||
{
|
||||
if((retCode = initEditor()) == 0)
|
||||
{
|
||||
if((retCode = editorOpen(pathName)) == 0)
|
||||
{
|
||||
xsprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
sprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
E.statusmsg_time = sysmillis();
|
||||
while(retCode == 0)
|
||||
{
|
||||
@@ -1254,22 +1254,23 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
}
|
||||
|
||||
// Clear screen on exit.
|
||||
xputs("\x1b[2J");
|
||||
fputs("\x1b[2J", stdout);
|
||||
} else
|
||||
{
|
||||
// Memory exhausted?
|
||||
if(retCode == 1)
|
||||
{
|
||||
// Force a dump of the memory block list to aid in evaluation
|
||||
umm_info(NULL, 1);
|
||||
|
||||
xprintf("Insufficient memory to process this file.\n", pathName);
|
||||
printf("Insufficient memory to process this file.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("Failed to create or open file:%s\n", pathName);
|
||||
printf("Failed to create or open file:%s\n", pathName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Important to release all memory back to the heap otherwise future apps wont be able to allocate it.
|
||||
//
|
||||
editorCleanup();
|
||||
}
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
73
apps/ed/ed.h
73
apps/ed/ed.h
@@ -51,79 +51,6 @@
|
||||
// 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
|
||||
|
||||
@@ -39,28 +39,20 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdmisc.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__
|
||||
@@ -71,6 +63,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "falloc.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,12 +92,12 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot allocate block.\n");
|
||||
puts("No file open, cannot allocate block.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &size) || !xatoi(&ptr, &option))
|
||||
{
|
||||
xputs("Illegal <size> or <option> value.\n");
|
||||
puts("Illegal <size> or <option> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_expand(&G->File[0], (DWORD)size, (BYTE)option);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fattr.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -101,7 +94,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if (!xatoi(&ptr, &attr) || !xatoi(&ptr, &mask))
|
||||
{
|
||||
xprintf("Illegal <attr> <mask> value.\n");
|
||||
printf("Illegal <attr> <mask> value.\n");
|
||||
} else
|
||||
{
|
||||
fileName = getStrParam(&ptr);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
APP_NAME = fcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fcat.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
fileName = getStrParam(&ptr);
|
||||
if(*fileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
printf("Illegal <file> value.\n");
|
||||
} else
|
||||
fr = fileCat(fileName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fcd.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <path> value.\n");
|
||||
printf("Illegal <path> value.\n");
|
||||
} else
|
||||
fr = f_chdir(dirName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fclose.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -98,7 +91,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot close.\n");
|
||||
puts("No file open, cannot close.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_close(&G->File[0]);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fconcat.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -104,7 +97,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*src1FileName == 0x00 || *src2FileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src1>, <src2> or <dst> value.\n");
|
||||
printf("Illegal <src1>, <src2> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileConcatenate(src1FileName, src2FileName, dstFileName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fcp.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -102,7 +95,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src> or <dst> value.\n");
|
||||
printf("Illegal <src> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileCopy(srcFileName, dstFileName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fdel.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,16 +93,16 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
printf("Illegal <file> value.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("GOING TO UNLINK(%s)\n", dstFileName);
|
||||
printf("GOING TO UNLINK(%s)\n", dstFileName);
|
||||
fr = f_unlink(dstFileName);
|
||||
xprintf("UNLINKED(%s)\n", dstFileName);
|
||||
printf("UNLINKED(%s)\n", dstFileName);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
xprintf("DONE\n");
|
||||
printf("DONE\n");
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fdir.h"
|
||||
|
||||
// Utility functions.
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fdrive.h"
|
||||
|
||||
// Utility functions.
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fdump.h"
|
||||
|
||||
// Utility functions.
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "finspect.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,14 +93,14 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, buffer contents invalid.\n");
|
||||
puts("No file open, buffer contents invalid.\n");
|
||||
} else
|
||||
{
|
||||
startPos = getUintParam(&ptr);
|
||||
len = getUintParam(&ptr);
|
||||
if(len == 0)
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
printf("Illegal <len> value.\n");
|
||||
} else
|
||||
fr = fileBlockDump(startPos, len);
|
||||
}
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "flabel.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
labelName = getStrParam(&ptr);
|
||||
if(*labelName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <label> value.\n");
|
||||
printf("Illegal <label> value.\n");
|
||||
} else
|
||||
fr = f_setlabel(labelName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fmkdir.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <dir> value.\n");
|
||||
printf("Illegal <dir> value.\n");
|
||||
} else
|
||||
fr = f_mkdir(dirName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fmkfs.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -103,15 +96,15 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if (!xatoi(&ptr, &driveNo) || (UINT)driveNo > 9 || !xatoi(&ptr, &type) || !xatoi(&ptr, &bytesClust))
|
||||
{
|
||||
xprintf("Illegal parameters, should be: <ld#> <type> <bytes/clust>\n");
|
||||
printf("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);
|
||||
printf("The drive %u will be formatted. Are you sure? (Y/n)=", (WORD)driveNo);
|
||||
fgets(line, sizeof line, stdin);
|
||||
if (line[0] == 'Y')
|
||||
{
|
||||
xsprintf(line, "%u:", (UINT)driveNo);
|
||||
sprintf(line, "%u:", (UINT)driveNo);
|
||||
fr = f_mkfs(line, (BYTE)type, (DWORD)bytesClust, Buff, sizeof Buff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fopen.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,12 +93,12 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse)
|
||||
{
|
||||
xputs("File already open, please close before re-opening\n");
|
||||
puts("File already open, please close before re-opening\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &mode))
|
||||
{
|
||||
xprintf("Illegal <mode> value.\n");
|
||||
printf("Illegal <mode> value.\n");
|
||||
} else
|
||||
{
|
||||
fileName = getStrParam(&ptr);
|
||||
|
||||
@@ -46,77 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fread.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,12 +92,12 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot read.\n");
|
||||
puts("No file open, cannot read.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
printf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileBlockRead(&G->File[0], len);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "frename.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -102,7 +95,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src> or <dst> value.\n");
|
||||
printf("Illegal <src> or <dst> value.\n");
|
||||
} else
|
||||
fr = f_rename(srcFileName, dstFileName);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fsave.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -104,7 +97,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
len = getUintParam(&ptr);
|
||||
if(*dstFileName == 0x00 || len == 0)
|
||||
{
|
||||
xprintf("Illegal <dst> or <len> value.\n");
|
||||
printf("Illegal <dst> or <len> value.\n");
|
||||
} else
|
||||
fr = fileSave(dstFileName, memAddr, len);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fseek.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,16 +92,16 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot seek.\n");
|
||||
puts("No file open, cannot seek.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &pos))
|
||||
{
|
||||
xprintf("Illegal <pos> value.\n");
|
||||
printf("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 == FR_OK ) { printf("fptr = %lu(0x%lX)\n", (DWORD)G->File[0].fptr, (DWORD)G->File[0].fptr); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fshowdir.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,7 +92,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
fr = f_getcwd(line, sizeof line);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { xprintf("%s\n", line); retCode = 0; }
|
||||
if(fr) { printFSCode(fr); } else { printf("%s\n", line); retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
APP_NAME = fstat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
|
||||
LIBS = -lumansi-k64f
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fstat.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -100,7 +93,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
pathName = getStrParam(&ptr);
|
||||
if(*pathName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <path> value.\n");
|
||||
printf("Illegal <path> value.\n");
|
||||
} else
|
||||
fr = printFatFSStatus(pathName);
|
||||
|
||||
|
||||
@@ -46,77 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "ftime.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -106,13 +99,13 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if (!xatoi(&ptr, &year) || !xatoi(&ptr, &month) || !xatoi(&ptr, &day))
|
||||
{
|
||||
xprintf("Illegal <year> <month> <day> value.\n");
|
||||
printf("Illegal <year> <month> <day> value.\n");
|
||||
} else
|
||||
{
|
||||
Finfo.fdate = ((year - 1980) << 9) | ((month & 15) << 5) | (day & 31);
|
||||
if (!xatoi(&ptr, &hour) || !xatoi(&ptr, &min) || !xatoi(&ptr, &sec))
|
||||
{
|
||||
xprintf("Illegal <hour> <min> <sec> value.\n");
|
||||
printf("Illegal <hour> <min> <sec> value.\n");
|
||||
} else
|
||||
{
|
||||
Finfo.ftime = ((hour & 31) << 11) | ((min & 63) << 5) | ((sec >> 1) & 31);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "ftrunc.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -98,7 +91,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot truncate.\n");
|
||||
puts("No file open, cannot truncate.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_truncate(&G->File[0]);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fwrite.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -99,12 +92,12 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot write.\n");
|
||||
puts("No file open, cannot write.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
printf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileBlockWrite(&G->File[0], len);
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "fxtract.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -106,7 +99,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
len = getUintParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00 || len == 0)
|
||||
{
|
||||
xprintf("Illegal <src>, <dst> or <len> value.\n");
|
||||
printf("Illegal <src>, <dst> or <len> value.\n");
|
||||
} else
|
||||
fr = fileXtract(srcFileName, dstFileName, startPos, len);
|
||||
|
||||
|
||||
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@ APP_NAME = help
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
# Enable Dhrystone Test
|
||||
OFLAGS += -DDHRYSTONE_TEST
|
||||
ifeq ($(__K64F__),1)
|
||||
LIBS = -lumansi-k64f
|
||||
else
|
||||
LIBS =
|
||||
endif
|
||||
|
||||
ifeq ($(__K64F__),1)
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
include $(APP_DIR)/Makefile.k64f
|
||||
else
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
include $(APP_DIR)/Makefile.zpu
|
||||
endif
|
||||
|
||||
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "help.h"
|
||||
|
||||
// Version info.
|
||||
|
||||
198
apps/help/help.h
198
apps/help/help.h
@@ -41,83 +41,135 @@
|
||||
|
||||
// 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
|
||||
#define BUILTIN_HW_TCPU 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#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 1
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
#if defined __ZOS__
|
||||
#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_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
|
||||
#define BUILTIN_HW_TCPU 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 1
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
#else
|
||||
|
||||
// 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) */
|
||||
#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_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
|
||||
#define BUILTIN_HW_TCPU 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 1
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
29
apps/hr/hr.c
29
apps/hr/hr.c
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "hr.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -96,17 +89,17 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t memAddr;
|
||||
|
||||
xputs("Register information\n");
|
||||
xputs("Interrupt: ");
|
||||
xprintf("%08X %08X\n", INTERRUPT_STATUS(INTR0), INTERRUPT_CTRL(INTR0));
|
||||
puts("Register information\n");
|
||||
puts("Interrupt: ");
|
||||
printf("%08X %08X\n", INTERRUPT_STATUS(INTR0), INTERRUPT_CTRL(INTR0));
|
||||
while(getserial_nonblocking() == -1)
|
||||
{
|
||||
xprintf("UART 0/1: %08X %08X %08X %08X %08X %08X\r", UART_STATUS(UART0), UART_FIFO_STATUS(UART0), UART_BRGEN(UART0), UART_STATUS(UART1), UART_FIFO_STATUS(UART1), UART_BRGEN(UART1));
|
||||
printf("UART 0/1: %08X %08X %08X %08X %08X %08X\r", UART_STATUS(UART0), UART_FIFO_STATUS(UART0), UART_BRGEN(UART0), UART_STATUS(UART1), UART_FIFO_STATUS(UART1), UART_BRGEN(UART1));
|
||||
memAddr = INTERRUPT_STATUS(INTR0);
|
||||
}
|
||||
xputs("\n");
|
||||
puts("\n");
|
||||
#elif defined __K64F__
|
||||
xputs("This application only works on the ZPU processor.\n");
|
||||
puts("This application only works on the ZPU processor.\n");
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
|
||||
68
apps/hr/hr.h
68
apps/hr/hr.h
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
#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
|
||||
}
|
||||
|
||||
37
apps/ht/ht.c
37
apps/ht/ht.c
@@ -39,29 +39,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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__
|
||||
@@ -72,6 +64,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "ht.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -95,38 +88,38 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
#if defined __ZPU__
|
||||
char *ptr = (char *)param1;
|
||||
|
||||
xputs("Testing RTC & Up/Down Timers\n");
|
||||
puts("Testing RTC & Up/Down Timers\n");
|
||||
TIMER_MILLISECONDS_UP = 60000;
|
||||
xputs("Timer Set\n");
|
||||
puts("Timer Set\n");
|
||||
while(getserial_nonblocking() == -1)
|
||||
{
|
||||
xputs("While loop\n");
|
||||
puts("While loop\n");
|
||||
if(TIMER_MICROSECONDS_DOWN == 0)
|
||||
{
|
||||
TIMER_MICROSECONDS_DOWN = 10000000;
|
||||
xputs("\r\nuSec down counter expired.\n");
|
||||
puts("\r\nuSec down counter expired.\n");
|
||||
}
|
||||
if(TIMER_MILLISECONDS_DOWN == 0)
|
||||
{
|
||||
TIMER_MILLISECONDS_DOWN = 60000;
|
||||
xputs("\r\nmSec down counter expired.\n");
|
||||
puts("\r\nmSec down counter expired.\n");
|
||||
}
|
||||
if(TIMER_SECONDS_DOWN == 0)
|
||||
{
|
||||
TIMER_SECONDS_DOWN = 60;
|
||||
xputs("\r\nSecond down counter expired.\n");
|
||||
puts("\r\nSecond down counter expired.\n");
|
||||
}
|
||||
if(TIMER_MILLISECONDS_UP == 60000)
|
||||
{
|
||||
TIMER_MILLISECONDS_UP = 0;
|
||||
xputs("\r\nmSec up counter expired.\n");
|
||||
puts("\r\nmSec up counter expired.\n");
|
||||
}
|
||||
|
||||
xprintf("%02d/%02d/%02d %02d:%02d:%02d.%03d%03d %10lu %10lu %10lu %10lu\r", RTC_YEAR, RTC_MONTH, RTC_DAY, RTC_HOUR, RTC_MINUTE, RTC_SECOND, RTC_MILLISECONDS, RTC_MICROSECONDS, TIMER_MICROSECONDS_DOWN, TIMER_MILLISECONDS_DOWN, TIMER_SECONDS_DOWN, TIMER_MILLISECONDS_UP);
|
||||
printf("%02d/%02d/%02d %02d:%02d:%02d.%03d%03d %10lu %10lu %10lu %10lu\r", RTC_YEAR, RTC_MONTH, RTC_DAY, RTC_HOUR, RTC_MINUTE, RTC_SECOND, RTC_MILLISECONDS, RTC_MICROSECONDS, TIMER_MICROSECONDS_DOWN, TIMER_MILLISECONDS_DOWN, TIMER_SECONDS_DOWN, TIMER_MILLISECONDS_UP);
|
||||
}
|
||||
xputs("\n");
|
||||
puts("\n");
|
||||
#elif defined __K64F__
|
||||
xputs("This application only works on the ZPU processor.\n");
|
||||
puts("This application only works on the ZPU processor.\n");
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
|
||||
68
apps/ht/ht.h
68
apps/ht/ht.h
@@ -46,76 +46,8 @@
|
||||
|
||||
// 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 1
|
||||
// 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
|
||||
}
|
||||
|
||||
84
apps/include/app.h
Normal file
84
apps/include/app.h
Normal file
@@ -0,0 +1,84 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: app.h
|
||||
// Created: January 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: zOS application definitions.
|
||||
// Header file to define prototypes and constants specific to an application
|
||||
// compilation.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019-2020 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: January 2019 - Initial script written.
|
||||
// April 2020 - Tweaked for the K64F processor.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 APP_H
|
||||
#define APP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Constants.
|
||||
|
||||
|
||||
// Redefinitions.
|
||||
//#define malloc sys_malloc
|
||||
//#define realloc sys_realloc
|
||||
//#define calloc sys_calloc
|
||||
//#define free sys_free
|
||||
|
||||
// For the ARM Cortex-M compiler, the standard filestreams in an app are set by the CRT0 startup code,
|
||||
// the original reentrant definition is undefined as it is not needed in the app.
|
||||
#if defined __K64F__
|
||||
#undef stdout
|
||||
#undef stdin
|
||||
#undef stderr
|
||||
FILE *stdout;
|
||||
FILE *stdin;
|
||||
FILE *stderr;
|
||||
#endif
|
||||
|
||||
// Prototypes for integer math - needs a new common home!
|
||||
int32_t __divsi3(int32_t, int32_t );
|
||||
int32_t __modsi3(int32_t, int32_t );
|
||||
uint32_t __udivsi3(uint32_t, uint32_t);
|
||||
uint32_t __umodsi3(uint32_t, uint32_t);
|
||||
|
||||
// Prototypes
|
||||
void *sys_malloc(size_t); // Allocate memory managed by the OS.
|
||||
void *sys_realloc(void *, size_t); // Reallocate a block of memory managed by the OS.
|
||||
void *sys_calloc(size_t, size_t); // Allocate and zero a block of memory managed by the OS.
|
||||
void sys_free(void *); // Free memory managed by the OS.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
#if defined __ZPU__
|
||||
struct __file *__iob[3];
|
||||
#endif
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -42,18 +42,23 @@ BASEDIR = ../../..
|
||||
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
ifeq ($(__K64F__),1)
|
||||
override HEAPADDR = 0x1FFF5000
|
||||
override HEAPSIZE = 0x00033000
|
||||
override STACKADDR = 0x20028000
|
||||
override STACKSIZE = 0x00000000
|
||||
#override HEAPADDR = 0x2002f000
|
||||
#override HEAPSIZE = 0x00000000
|
||||
#override STACKADDR = 0x2002f000
|
||||
#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
|
||||
LIBS = -lumansi-k64f -lumstdio-k64f
|
||||
CPPFLAGS = #-D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
else
|
||||
override HEAPADDR = 0x0000ED00
|
||||
override HEAPSIZE = 0x00000300
|
||||
override STACKADDR = 0x0000F000
|
||||
override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Kilo.
|
||||
APP_C_SRC = #$(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
|
||||
CFLAGS =
|
||||
|
||||
188
apps/kilo/kilo.c
188
apps/kilo/kilo.c
@@ -46,29 +46,27 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <usb_serial.h>
|
||||
#include "k64f_soc.h"
|
||||
#include "../../libraries/include/ansi.h"
|
||||
#include "../../libraries/include/ctype.h"
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdmisc.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 <umm_malloc.h>
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
@@ -79,6 +77,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "kilo.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -361,15 +360,15 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Save cursor position.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '7');
|
||||
printf("%c%c", 0x1b, '7');
|
||||
|
||||
// Cursor to maximum X/Y location, report cursor location
|
||||
//
|
||||
xputs("\x1b[0;0H");
|
||||
fputs("\x1b[0;0H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[999;999H");
|
||||
fputs("\x1b[999;999H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[6n");
|
||||
fputs("\x1b[6n", stdout);
|
||||
|
||||
// Read the response: ESC [ rows ; cols R
|
||||
//
|
||||
@@ -394,7 +393,7 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Restore cursor.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '8');
|
||||
printf("%c%c", 0x1b, '8');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -407,12 +406,12 @@ int getWindowSize(int *rows, int *cols)
|
||||
uint32_t termRows, termCols;
|
||||
if(getCursorPosition(&termRows,&termCols) == 0)
|
||||
{
|
||||
*cols = (int)termCols;
|
||||
*rows = (int)termRows;
|
||||
*cols = (int)termCols;
|
||||
*rows = (int)termRows;
|
||||
} else
|
||||
{
|
||||
*cols = 80;
|
||||
*rows = 24;
|
||||
*cols = 80;
|
||||
*rows = 24;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -441,8 +440,8 @@ int editorUpdateSyntax(erow *row)
|
||||
{
|
||||
if(row->rsize == 0) return 0;
|
||||
|
||||
row->hl = realloc(row->hl,row->rsize);
|
||||
if(row->hl == NULL) { xprintf("editorUpdateSyntax: Memory exhausted\n"); return 1; }
|
||||
row->hl = sys_realloc(row->hl,row->rsize);
|
||||
if(row->hl == NULL) { printf("editorUpdateSyntax: Memory exhausted\n"); return 1; }
|
||||
memset(row->hl,HL_NORMAL,row->rsize);
|
||||
|
||||
if (E.syntax == NULL) return 0; /* No syntax, everything is HL_NORMAL. */
|
||||
@@ -591,7 +590,7 @@ int editorUpdateSyntax(erow *row)
|
||||
int oc = editorRowHasOpenComment(row);
|
||||
if (row->hl_oc != oc && row->idx+1 < E.numrows)
|
||||
{
|
||||
if(editorUpdateSyntax(&E.row[row->idx+1])) { xprintf("Exit from here\n"); return 1; }
|
||||
if(editorUpdateSyntax(&E.row[row->idx+1])) { printf("Exit from here\n"); return 1; }
|
||||
}
|
||||
row->hl_oc = oc;
|
||||
return 0;
|
||||
@@ -618,7 +617,7 @@ int editorSyntaxToColor(int hl)
|
||||
* setting it in the global state E.syntax. */
|
||||
void editorSelectSyntaxHighlight(char *filename)
|
||||
{
|
||||
unsigned int j;
|
||||
unsigned int j;
|
||||
|
||||
for (j = 0; j < HLDB_ENTRIES; j++)
|
||||
{
|
||||
@@ -653,14 +652,14 @@ int editorUpdateRow(erow *row)
|
||||
*/
|
||||
if(row->render != NULL)
|
||||
{
|
||||
free(row->render);
|
||||
sys_free(row->render);
|
||||
row->render = NULL;
|
||||
}
|
||||
for (j = 0; j < row->size; j++)
|
||||
if (row->chars[j] == TAB) tabs++;
|
||||
|
||||
row->render = malloc(row->size + tabs*KILO_TAB_SIZE + 1);
|
||||
if(row->render == NULL) { xprintf("editorUpdateRow: Memory exhausted\n"); return 1; }
|
||||
row->render = sys_malloc(row->size + tabs*KILO_TAB_SIZE + 1);
|
||||
if(row->render == NULL) { printf("editorUpdateRow: Memory exhausted\n"); return 1; }
|
||||
idx = 0;
|
||||
for (j = 0; j < row->size; j++)
|
||||
{
|
||||
@@ -686,12 +685,12 @@ int editorUpdateRow(erow *row)
|
||||
*/
|
||||
int editorInsertRow(int at, char *s, size_t len)
|
||||
{
|
||||
int j;
|
||||
int j;
|
||||
|
||||
if (at > E.numrows) return 0;
|
||||
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
|
||||
if (at != E.numrows)
|
||||
{
|
||||
@@ -700,8 +699,8 @@ int editorInsertRow(int at, char *s, size_t len)
|
||||
}
|
||||
|
||||
E.row[at].size = len;
|
||||
E.row[at].chars = malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row[at].chars = sys_malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[at].chars,s,len+1);
|
||||
E.row[at].hl = NULL;
|
||||
E.row[at].hl_oc = 0;
|
||||
@@ -719,17 +718,17 @@ void editorFreeRow(erow *row)
|
||||
{
|
||||
if(row->render != NULL)
|
||||
{
|
||||
free(row->render);
|
||||
sys_free(row->render);
|
||||
row->render = NULL;
|
||||
}
|
||||
if(row->chars != NULL)
|
||||
{
|
||||
free(row->chars);
|
||||
sys_free(row->chars);
|
||||
row->chars = NULL;
|
||||
}
|
||||
if(row->hl != NULL)
|
||||
{
|
||||
free(row->hl);
|
||||
sys_free(row->hl);
|
||||
row->hl = NULL;
|
||||
}
|
||||
}
|
||||
@@ -740,19 +739,29 @@ void editorCleanup(void)
|
||||
{
|
||||
int idx;
|
||||
|
||||
// Go through and free all row memory.
|
||||
//
|
||||
for(idx=0; idx < E.numrows; idx++)
|
||||
{
|
||||
if(E.row[idx].chars != NULL)
|
||||
{
|
||||
free(E.row[idx].chars);
|
||||
}
|
||||
}
|
||||
|
||||
// Free the editor config structure.
|
||||
if(E.row)
|
||||
free(E.row);
|
||||
{
|
||||
// Go through and free all row memory.
|
||||
//
|
||||
for(idx=0; idx < E.numrows; idx++)
|
||||
{
|
||||
if(E.row[idx].chars != NULL)
|
||||
{
|
||||
sys_free(E.row[idx].chars);
|
||||
}
|
||||
if(E.row[idx].render != NULL)
|
||||
{
|
||||
sys_free(E.row[idx].render);
|
||||
}
|
||||
if(E.row[idx].hl != NULL)
|
||||
{
|
||||
sys_free(E.row[idx].hl);
|
||||
}
|
||||
}
|
||||
|
||||
sys_free(E.row);
|
||||
}
|
||||
|
||||
// Reset necessary variables.
|
||||
E.cx = 0;
|
||||
@@ -768,7 +777,7 @@ void editorCleanup(void)
|
||||
/* Remove the row at the specified position, shifting the remainign on the
|
||||
* top. */
|
||||
void editorDelRow(int at) {
|
||||
int j;
|
||||
int j;
|
||||
erow *row;
|
||||
|
||||
if (at >= E.numrows) return;
|
||||
@@ -794,8 +803,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
|
||||
/* In the next line +2 means: new char and null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memset(row->chars+row->size,' ',padlen);
|
||||
row->chars[row->size+padlen+1] = '\0';
|
||||
row->size += padlen+1;
|
||||
@@ -803,8 +812,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* If we are in the middle of the string just make space for 1 new
|
||||
* char plus the (already existing) null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memmove(row->chars+at+1,row->chars+at,row->size-at+1);
|
||||
row->size++;
|
||||
}
|
||||
@@ -818,8 +827,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* Append the string 's' at the end of a row */
|
||||
int editorRowAppendString(erow *row, char *s, size_t len)
|
||||
{
|
||||
row->chars = realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { xprintf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { printf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
memcpy(row->chars+row->size,s,len);
|
||||
|
||||
row->size += len;
|
||||
@@ -971,7 +980,7 @@ int editorOpen(char *filename)
|
||||
fr = f_open(&fp, filename, FA_OPEN_ALWAYS | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to open file:%s\n", filename);
|
||||
printf("Failed to open file:%s\n", filename);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -985,7 +994,7 @@ int editorOpen(char *filename)
|
||||
fr = f_lseek(&fp, 0);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to rewind file:%s\n", filename);
|
||||
printf("Failed to rewind file:%s\n", filename);
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -995,8 +1004,9 @@ int editorOpen(char *filename)
|
||||
{
|
||||
// Allocate memory for the row array.
|
||||
//
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_malloc(sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memset(E.row, '\0', sizeof(erow)*(E.numrows));
|
||||
|
||||
// Now go through the file again and populate each row with the data.
|
||||
//
|
||||
@@ -1008,8 +1018,8 @@ int editorOpen(char *filename)
|
||||
buf[--linelen] = '\0';
|
||||
|
||||
E.row[rowNo].size = linelen;
|
||||
E.row[rowNo].chars = malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row[rowNo].chars = sys_malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[rowNo].chars, buf, linelen+1);
|
||||
E.row[rowNo].idx = rowNo;
|
||||
if(editorUpdateRow(E.row+rowNo)) return 1;
|
||||
@@ -1035,7 +1045,7 @@ int editorSave(char *newFileName)
|
||||
fr = f_open(&fp, (newFileName == NULL ? E.filename : newFileName), FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
sprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -1059,13 +1069,13 @@ int editorSave(char *newFileName)
|
||||
f_close(&fp);
|
||||
|
||||
E.dirty = 0;
|
||||
xsprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
sprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 0;
|
||||
|
||||
writeerr:
|
||||
f_close(&fp);
|
||||
xsprintf(E.statusmsg, "Can't save! I/O error");
|
||||
sprintf(E.statusmsg, "Can't save! I/O error");
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -1089,10 +1099,10 @@ void abAppend(const char *s, int len, int flush)
|
||||
// First call, allocate memory for the buffer.
|
||||
if(ab == NULL)
|
||||
{
|
||||
ab = malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab = sys_malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = sys_malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { sys_free(ab); printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->len = 0;
|
||||
}
|
||||
|
||||
@@ -1101,14 +1111,14 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
const char *ptr = ab->b;
|
||||
for(ptr=ab->b; ptr < ab->b+ab->len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
// If we are flushing then write out the additional data passed in to the method.
|
||||
//
|
||||
if(flush)
|
||||
{
|
||||
for(ptr=s; ptr < s+len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
}
|
||||
ab->len = 0;
|
||||
@@ -1124,8 +1134,8 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
// On flush we free up the memory, extra cycles in alloc and free but keeps the heap balanced and no memory leaks when we exit.
|
||||
//
|
||||
free(ab->b);
|
||||
free(ab);
|
||||
sys_free(ab->b);
|
||||
sys_free(ab);
|
||||
ab = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1150,7 +1160,7 @@ int editorRefreshScreen(void)
|
||||
if (E.numrows == 0 && y == E.screenrows/3)
|
||||
{
|
||||
char welcome[80];
|
||||
xsprintf(welcome, "Kilo editor -- version %s\x1b[0K\r\n", KILO_VERSION);
|
||||
sprintf(welcome, "Kilo editor -- version %s\x1b[0K\r\n", KILO_VERSION);
|
||||
int welcomelen = strlen(welcome);
|
||||
int padding = (E.screencols-welcomelen)/2;
|
||||
if (padding)
|
||||
@@ -1201,7 +1211,7 @@ int editorRefreshScreen(void)
|
||||
if (color != current_color)
|
||||
{
|
||||
char buf[16];
|
||||
xsprintf(buf,"\x1b[%dm",color);
|
||||
sprintf(buf,"\x1b[%dm",color);
|
||||
int clen = strlen(buf);
|
||||
current_color = color;
|
||||
abAppend(buf,clen, 0);
|
||||
@@ -1219,9 +1229,9 @@ int editorRefreshScreen(void)
|
||||
abAppend("\x1b[0K",4, 0);
|
||||
abAppend("\x1b[7m",4, 0);
|
||||
char status[80], rstatus[80];
|
||||
xsprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
sprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
int len = strlen(status);
|
||||
xsprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
sprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
int rlen = strlen(rstatus);
|
||||
if (len > E.screencols) len = E.screencols;
|
||||
abAppend(status,len, 0);
|
||||
@@ -1256,7 +1266,7 @@ int editorRefreshScreen(void)
|
||||
cx++;
|
||||
}
|
||||
}
|
||||
xsprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
sprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
abAppend(buf,strlen(buf), 0);
|
||||
|
||||
/* Show cursor and Flush to complete.
|
||||
@@ -1289,7 +1299,7 @@ void editorFind(void) {
|
||||
|
||||
while(1)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
sprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
E.statusmsg_time = sysmillis();
|
||||
editorRefreshScreen();
|
||||
|
||||
@@ -1303,7 +1313,7 @@ void editorFind(void) {
|
||||
E.coloff = saved_coloff; E.rowoff = saved_rowoff;
|
||||
}
|
||||
FIND_RESTORE_HL;
|
||||
xsprintf(E.statusmsg, "");
|
||||
E.statusmsg[0] = '\0';
|
||||
E.statusmsg_time = sysmillis();
|
||||
return;
|
||||
} else if (c == ARROW_RIGHT || c == ARROW_DOWN) {
|
||||
@@ -1345,8 +1355,8 @@ void editorFind(void) {
|
||||
last_match = current;
|
||||
if (row->hl) {
|
||||
saved_hl_line = current;
|
||||
saved_hl = malloc(row->rsize);
|
||||
if(saved_hl == NULL) { xprintf("editorFind: Memory exhausted\n"); return; }
|
||||
saved_hl = sys_malloc(row->rsize);
|
||||
if(saved_hl == NULL) { printf("editorFind: Memory exhausted\n"); return; }
|
||||
memcpy(saved_hl,row->hl,row->rsize);
|
||||
memset(row->hl+match_offset,HL_MATCH,qlen);
|
||||
}
|
||||
@@ -1499,7 +1509,7 @@ uint32_t editorProcessKeypress(void)
|
||||
*/
|
||||
if (E.dirty > 0 && quit_times > 0)
|
||||
{
|
||||
xsprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
sprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
E.statusmsg_time = sysmillis();
|
||||
quit_times--;
|
||||
}
|
||||
@@ -1509,8 +1519,8 @@ uint32_t editorProcessKeypress(void)
|
||||
cySave = E.cy;
|
||||
E.cy = E.screenrows-1;
|
||||
lastLine = editorRefreshScreen();
|
||||
xprintf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
xputs("\x1b[0J");
|
||||
printf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
fputs("\x1b[0J", stdout);
|
||||
|
||||
// Restore the cursor so it opens in the same place when edit is restarted.
|
||||
E.cx = cxSave;
|
||||
@@ -1592,7 +1602,7 @@ uint32_t initEditor(void)
|
||||
E.syntax = NULL;
|
||||
if (getWindowSize(&E.screenrows,&E.screencols) == -1)
|
||||
{
|
||||
xprintf("Unable to query the screen for size (columns / rows)");
|
||||
printf("Unable to query the screen for size (columns / rows)");
|
||||
return(1);
|
||||
}
|
||||
E.screenrows -= 2; /* Get room for status bar. */
|
||||
@@ -1618,7 +1628,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
pathName = getStrParam(&ptr);
|
||||
if(strlen(pathName) == 0)
|
||||
{
|
||||
xprintf("Usage: kilo <file>\n");
|
||||
printf("Usage: kilo <file>\n");
|
||||
} else
|
||||
{
|
||||
if((retCode = initEditor()) == 0)
|
||||
@@ -1626,7 +1636,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
editorSelectSyntaxHighlight(pathName);
|
||||
if((retCode = editorOpen(pathName)) == 0)
|
||||
{
|
||||
xsprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
sprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
E.statusmsg_time = sysmillis();
|
||||
while(retCode == 0)
|
||||
{
|
||||
@@ -1635,23 +1645,25 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
}
|
||||
|
||||
// Clear screen on exit.
|
||||
xputs("\x1b[2J");
|
||||
fputs("\x1b[2J", stdout);
|
||||
} else
|
||||
{
|
||||
// Memory exhausted?
|
||||
if(retCode == 1)
|
||||
{
|
||||
// Force a dump of the memory block list to aid in evaluation
|
||||
umm_info(NULL, 1);
|
||||
|
||||
xprintf("Insufficient memory to process this file.\n", pathName);
|
||||
printf("Insufficient memory to process this file.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("Failed to create or open file:%s\n", pathName);
|
||||
printf("Failed to create or open file:%s\n", pathName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Important to release all memory otherwise system memory will not be available
|
||||
// to the next app.
|
||||
editorCleanup();
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,79 +49,6 @@
|
||||
// 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
|
||||
|
||||
@@ -43,26 +43,31 @@ BASEDIR = ../../..
|
||||
|
||||
# Override values given by parent make for this application as its memory usage differs from the standard app.
|
||||
ifeq ($(__K64F__),1)
|
||||
override HEAPADDR = 0x2000C000
|
||||
override HEAPSIZE = 0x0001BC00
|
||||
override STACKADDR = 0x20027C00
|
||||
override STACKSIZE = 0x00000400
|
||||
#override HEAPADDR = 0x2002f000
|
||||
#override HEAPSIZE = 0x00000000
|
||||
#override STACKADDR = 0x2002f000
|
||||
#override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Mbasic.
|
||||
APP_C_SRC = basic.c ed.c $(APP_COMMON_DIR)/sbrk.c $(COMMON_DIR)/readline.c $(APP_COMMON_DIR)/sysutils.c
|
||||
UMM_C_SRC =
|
||||
CFLAGS = -Os
|
||||
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
# Modules making up Mbasic.
|
||||
APP_C_SRC = basic.c ed.c $(COMMON_DIR)/readline.c $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/sbrk.c
|
||||
UMM_C_SRC =
|
||||
CFLAGS = -Os
|
||||
CPPFLAGS = #-D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
else
|
||||
# Modules making up Mbasic.
|
||||
APP_C_SRC = basic.c ed.c $(APP_COMMON_DIR)/sbrk.c $(COMMON_DIR)/readline.c $(APP_COMMON_DIR)/sysutils.c
|
||||
UMM_C_SRC =
|
||||
CFLAGS = -Os
|
||||
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
#override HEAPADDR = 0x2002f000
|
||||
#override HEAPSIZE = 0x00000000
|
||||
#override STACKADDR = 0x2002f000
|
||||
#override STACKSIZE = 0x00000000
|
||||
|
||||
# Modules making up Mbasic.
|
||||
APP_C_SRC = basic.c ed.c $(APP_COMMON_DIR)/sbrk.c $(COMMON_DIR)/readline.c $(APP_COMMON_DIR)/sysutils.c
|
||||
UMM_C_SRC =
|
||||
CFLAGS = -Os
|
||||
CPPFLAGS = #-D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
endif
|
||||
|
||||
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
|
||||
|
||||
@@ -9,53 +9,44 @@
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <usb_serial.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
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "k64f_soc.h"
|
||||
#include <ctype.h>
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#undef stdout
|
||||
#undef stdin
|
||||
#undef stderr
|
||||
extern FILE *stdout;
|
||||
extern FILE *stdin;
|
||||
extern FILE *stderr;
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define assert(a)
|
||||
#define acos acosf
|
||||
#define floor floorf
|
||||
#define sin sinf
|
||||
#define cos cosf
|
||||
#define tan tanf
|
||||
#define log logf
|
||||
#define pow powf
|
||||
#define sqrt sqrtf
|
||||
#define asin asinf
|
||||
#define atan atanf
|
||||
#define fmod fmodf
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
|
||||
#define acos acosf
|
||||
#define floor floorf
|
||||
#define sin sinf
|
||||
#define cos cosf
|
||||
#define tan tanf
|
||||
#define log logf
|
||||
#define pow powf
|
||||
#define sqrt sqrtf
|
||||
#define asin asinf
|
||||
#define atan atanf
|
||||
#define fmod fmodf
|
||||
#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 <umm_malloc.h>
|
||||
#include <readline.h>
|
||||
#include "utils.h"
|
||||
//
|
||||
@@ -196,6 +187,7 @@ int execBasicScript(void)
|
||||
|
||||
// Check to see if user is requesting an action.
|
||||
#if defined __K64F__
|
||||
int usb_serial_getchar(void);
|
||||
keyIn = usb_serial_getchar();
|
||||
#elif defined __ZPU__
|
||||
keyIn = getserial_nonblocking();
|
||||
@@ -204,7 +196,7 @@ int execBasicScript(void)
|
||||
#endif
|
||||
if(nextline == -1 || keyIn == CTRL_C)
|
||||
{
|
||||
xprintf("\nExecution stopped, user request.\n");
|
||||
printf("\nExecution stopped, user request.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -219,7 +211,7 @@ int execBasicScript(void)
|
||||
curline = findline(nextline);
|
||||
if(curline == -1)
|
||||
{
|
||||
xprintf("line %d not found\n", nextline);
|
||||
printf("line %d not found\n", nextline);
|
||||
answer = 1;
|
||||
break;
|
||||
}
|
||||
@@ -241,9 +233,9 @@ void cleanup(void)
|
||||
|
||||
for(i=0;i<nvariables;i++)
|
||||
if(variables[i].sval)
|
||||
free(variables[i].sval);
|
||||
sys_free(variables[i].sval);
|
||||
if(variables)
|
||||
free(variables);
|
||||
sys_free(variables);
|
||||
variables = 0;
|
||||
nvariables = 0;
|
||||
|
||||
@@ -258,23 +250,23 @@ void cleanup(void)
|
||||
size *= dimvariables[i].dim[ii];
|
||||
for(ii=0;ii<size;ii++)
|
||||
if(dimvariables[i].str[ii])
|
||||
free(dimvariables[i].str[ii]);
|
||||
free(dimvariables[i].str);
|
||||
sys_free(dimvariables[i].str[ii]);
|
||||
sys_free(dimvariables[i].str);
|
||||
}
|
||||
}
|
||||
else
|
||||
if(dimvariables[i].dval)
|
||||
free(dimvariables[i].dval);
|
||||
sys_free(dimvariables[i].dval);
|
||||
}
|
||||
|
||||
if(dimvariables)
|
||||
free(dimvariables);
|
||||
sys_free(dimvariables);
|
||||
|
||||
dimvariables = 0;
|
||||
ndimvariables = 0;
|
||||
|
||||
if(lines)
|
||||
free(lines);
|
||||
sys_free(lines);
|
||||
|
||||
lines = 0;
|
||||
nlines = 0;
|
||||
@@ -294,70 +286,70 @@ void reporterror(int lineno)
|
||||
assert(0);
|
||||
break;
|
||||
case ERR_SYNTAX:
|
||||
xprintf("Syntax error line %d\n", lineno);
|
||||
printf("Syntax error line %d\n", lineno);
|
||||
break;
|
||||
case ERR_OUTOFMEMORY:
|
||||
xprintf("Out of memory line %d\n", lineno);
|
||||
printf("Out of memory line %d\n", lineno);
|
||||
break;
|
||||
case ERR_IDTOOLONG:
|
||||
xprintf("Identifier too long line %d\n", lineno);
|
||||
printf("Identifier too long line %d\n", lineno);
|
||||
break;
|
||||
case ERR_NOSUCHVARIABLE:
|
||||
xprintf("No such variable line %d\n", lineno);
|
||||
printf("No such variable line %d\n", lineno);
|
||||
break;
|
||||
case ERR_BADSUBSCRIPT:
|
||||
xprintf("Bad subscript line %d\n", lineno);
|
||||
printf("Bad subscript line %d\n", lineno);
|
||||
break;
|
||||
case ERR_TOOMANYDIMS:
|
||||
xprintf("Too many dimensions line %d\n", lineno);
|
||||
printf("Too many dimensions line %d\n", lineno);
|
||||
break;
|
||||
case ERR_TOOMANYINITS:
|
||||
xprintf("Too many initialisers line %d\n", lineno);
|
||||
printf("Too many initialisers line %d\n", lineno);
|
||||
break;
|
||||
case ERR_BADTYPE:
|
||||
xprintf("Illegal type line %d\n", lineno);
|
||||
printf("Illegal type line %d\n", lineno);
|
||||
break;
|
||||
case ERR_TOOMANYFORS:
|
||||
xprintf("Too many nested fors line %d\n", lineno);
|
||||
printf("Too many nested fors line %d\n", lineno);
|
||||
break;
|
||||
case ERR_NONEXT:
|
||||
xprintf("For without matching next line %d\n", lineno);
|
||||
printf("For without matching next line %d\n", lineno);
|
||||
break;
|
||||
case ERR_NOFOR:
|
||||
xprintf("Next without matching for line %d\n", lineno);
|
||||
printf("Next without matching for line %d\n", lineno);
|
||||
break;
|
||||
case ERR_DIVIDEBYZERO:
|
||||
xprintf("Divide by zero lne %d\n", lineno);
|
||||
printf("Divide by zero lne %d\n", lineno);
|
||||
break;
|
||||
case ERR_NEGLOG:
|
||||
xprintf("Negative logarithm line %d\n", lineno);
|
||||
printf("Negative logarithm line %d\n", lineno);
|
||||
break;
|
||||
case ERR_NEGSQRT:
|
||||
xprintf("Negative square root line %d\n", lineno);
|
||||
printf("Negative square root line %d\n", lineno);
|
||||
break;
|
||||
case ERR_BADSINCOS:
|
||||
xprintf("Sine or cosine out of range line %d\n", lineno);
|
||||
printf("Sine or cosine out of range line %d\n", lineno);
|
||||
break;
|
||||
case ERR_EOF:
|
||||
xprintf("End of input file %d\n", lineno);
|
||||
printf("End of input file %d\n", lineno);
|
||||
break;
|
||||
case ERR_ILLEGALOFFSET:
|
||||
xprintf("Illegal offset line %d\n", lineno);
|
||||
printf("Illegal offset line %d\n", lineno);
|
||||
break;
|
||||
case ERR_TYPEMISMATCH:
|
||||
xprintf("Type mismatch line %d\n", lineno);
|
||||
printf("Type mismatch line %d\n", lineno);
|
||||
break;
|
||||
case ERR_INPUTTOOLONG:
|
||||
xprintf("Input too long line %d\n", lineno);
|
||||
printf("Input too long line %d\n", lineno);
|
||||
break;
|
||||
case ERR_BADVALUE:
|
||||
xprintf("Bad value at line %d\n", lineno);
|
||||
printf("Bad value at line %d\n", lineno);
|
||||
break;
|
||||
case ERR_NOTINT:
|
||||
xprintf("Not an integer at line %d\n", lineno);
|
||||
printf("Not an integer at line %d\n", lineno);
|
||||
break;
|
||||
default:
|
||||
xprintf("ERROR line %d\n", lineno);
|
||||
printf("ERROR line %d\n", lineno);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -485,20 +477,20 @@ void doprint(int curline)
|
||||
str = stringexpr();
|
||||
if(str)
|
||||
{
|
||||
xprintf("%s", str);
|
||||
free(str);
|
||||
printf("%s", str);
|
||||
sys_free(str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = expr();
|
||||
sprintf(output, "%g", x);
|
||||
//xprintf("%g", x);
|
||||
xputs(output);
|
||||
//printf("%g", x);
|
||||
fputs(output, stdout);
|
||||
}
|
||||
if(token == COMMA)
|
||||
{
|
||||
xprintf(" ");
|
||||
printf(" ");
|
||||
match(COMMA);
|
||||
}
|
||||
else
|
||||
@@ -509,7 +501,7 @@ void doprint(int curline)
|
||||
match(SEMICOLON);
|
||||
}
|
||||
else
|
||||
xprintf("\n");
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -532,7 +524,7 @@ void dolet(int curline)
|
||||
temp = *lv.sval;
|
||||
*lv.sval = stringexpr();
|
||||
if(temp)
|
||||
free(temp);
|
||||
sys_free(temp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -636,14 +628,14 @@ void dodim(int curline)
|
||||
case STRID:
|
||||
i = 0;
|
||||
if(dimvar->str[i])
|
||||
free(dimvar->str[i]);
|
||||
sys_free(dimvar->str[i]);
|
||||
dimvar->str[i++] = stringexpr();
|
||||
|
||||
while(token == COMMA && i < size)
|
||||
{
|
||||
match(COMMA);
|
||||
if(dimvar->str[i])
|
||||
free(dimvar->str[i]);
|
||||
sys_free(dimvar->str[i]);
|
||||
dimvar->str[i++] = stringexpr();
|
||||
if(errorflag)
|
||||
break;
|
||||
@@ -846,7 +838,7 @@ int doinput(int curline)
|
||||
case STRID:
|
||||
if(*lv.sval)
|
||||
{
|
||||
free(*lv.sval);
|
||||
sys_free(*lv.sval);
|
||||
*lv.sval = 0;
|
||||
}
|
||||
|
||||
@@ -1107,9 +1099,9 @@ int boolfactor(void)
|
||||
if(!strleft || !strright)
|
||||
{
|
||||
if(strleft)
|
||||
free(strleft);
|
||||
sys_free(strleft);
|
||||
if(strright)
|
||||
free(strright);
|
||||
sys_free(strright);
|
||||
return 0;
|
||||
}
|
||||
cmp = strcmp(strleft, strright);
|
||||
@@ -1136,8 +1128,8 @@ int boolfactor(void)
|
||||
default:
|
||||
answer = 0;
|
||||
}
|
||||
free(strleft);
|
||||
free(strright);
|
||||
sys_free(strleft);
|
||||
sys_free(strright);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1388,7 +1380,7 @@ double factor(void)
|
||||
if(str)
|
||||
{
|
||||
answer = strlen(str);
|
||||
free(str);
|
||||
sys_free(str);
|
||||
}
|
||||
else
|
||||
answer = 0;
|
||||
@@ -1401,7 +1393,7 @@ double factor(void)
|
||||
if(str)
|
||||
{
|
||||
answer = *str;
|
||||
free(str);
|
||||
sys_free(str);
|
||||
}
|
||||
else
|
||||
answer = 0;
|
||||
@@ -1465,7 +1457,7 @@ double factor(void)
|
||||
if(str)
|
||||
{
|
||||
answer = strtod(str, 0);
|
||||
free(str);
|
||||
sys_free(str);
|
||||
}
|
||||
else
|
||||
answer = 0;
|
||||
@@ -1479,7 +1471,7 @@ double factor(void)
|
||||
{
|
||||
strtod(str, &end);
|
||||
answer = end - str;
|
||||
free(str);
|
||||
sys_free(str);
|
||||
}
|
||||
else
|
||||
answer = 0.0;
|
||||
@@ -1556,9 +1548,9 @@ double instr(void)
|
||||
if(!str || ! substr)
|
||||
{
|
||||
if(str)
|
||||
free(str);
|
||||
sys_free(str);
|
||||
if(substr)
|
||||
free(substr);
|
||||
sys_free(substr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1569,8 +1561,8 @@ double instr(void)
|
||||
answer = end - str + 1.0;
|
||||
}
|
||||
|
||||
free(str);
|
||||
free(substr);
|
||||
sys_free(str);
|
||||
sys_free(substr);
|
||||
|
||||
return answer;
|
||||
}
|
||||
@@ -1754,7 +1746,7 @@ DIMVAR *dimension(const char *id, int ndims, ...)
|
||||
switch(dv->type)
|
||||
{
|
||||
case FLTID:
|
||||
dtemp = realloc(dv->dval, size * sizeof(double));
|
||||
dtemp = sys_realloc(dv->dval, size * sizeof(double));
|
||||
if(dtemp)
|
||||
dv->dval = dtemp;
|
||||
else
|
||||
@@ -1769,11 +1761,11 @@ DIMVAR *dimension(const char *id, int ndims, ...)
|
||||
for(i=size;i<oldsize;i++)
|
||||
if(dv->str[i])
|
||||
{
|
||||
free(dv->str[i]);
|
||||
sys_free(dv->str[i]);
|
||||
dv->str[i] = 0;
|
||||
}
|
||||
}
|
||||
stemp = realloc(dv->str, size * sizeof(char *));
|
||||
stemp = sys_realloc(dv->str, size * sizeof(char *));
|
||||
if(stemp)
|
||||
{
|
||||
dv->str = stemp;
|
||||
@@ -1785,7 +1777,7 @@ DIMVAR *dimension(const char *id, int ndims, ...)
|
||||
for(i=0;i<oldsize;i++)
|
||||
if(dv->str[i])
|
||||
{
|
||||
free(dv->str[i]);
|
||||
sys_free(dv->str[i]);
|
||||
dv->str[i] = 0;
|
||||
}
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
@@ -1905,7 +1897,7 @@ VARIABLE *addfloat(const char *id)
|
||||
{
|
||||
VARIABLE *vars;
|
||||
|
||||
vars = realloc(variables, (nvariables + 1) * sizeof(VARIABLE));
|
||||
vars = sys_realloc(variables, (nvariables + 1) * sizeof(VARIABLE));
|
||||
if(vars)
|
||||
{
|
||||
variables = vars;
|
||||
@@ -1930,7 +1922,7 @@ VARIABLE *addstring(const char *id)
|
||||
{
|
||||
VARIABLE *vars;
|
||||
|
||||
vars = realloc(variables, (nvariables + 1) * sizeof(VARIABLE));
|
||||
vars = sys_realloc(variables, (nvariables + 1) * sizeof(VARIABLE));
|
||||
if(vars)
|
||||
{
|
||||
variables = vars;
|
||||
@@ -1955,7 +1947,7 @@ DIMVAR *adddimvar(const char *id)
|
||||
{
|
||||
DIMVAR *vars;
|
||||
|
||||
vars = realloc(dimvariables, (ndimvariables + 1) * sizeof(DIMVAR));
|
||||
vars = sys_realloc(dimvariables, (ndimvariables + 1) * sizeof(DIMVAR));
|
||||
if(vars)
|
||||
{
|
||||
dimvariables = vars;
|
||||
@@ -2035,10 +2027,10 @@ char *stringexpr(void)
|
||||
if(right)
|
||||
{
|
||||
temp = mystrconcat(left, right);
|
||||
free(right);
|
||||
sys_free(right);
|
||||
if(temp)
|
||||
{
|
||||
free(left);
|
||||
sys_free(left);
|
||||
left = temp;
|
||||
}
|
||||
else
|
||||
@@ -2126,7 +2118,7 @@ char *leftstring(void)
|
||||
}
|
||||
str[x] = 0;
|
||||
answer = mystrdup(str);
|
||||
free(str);
|
||||
sys_free(str);
|
||||
if(!answer)
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
return answer;
|
||||
@@ -2160,7 +2152,7 @@ char *rightstring(void)
|
||||
}
|
||||
|
||||
answer = mystrdup( &str[strlen(str) - x] );
|
||||
free(str);
|
||||
sys_free(str);
|
||||
if(!answer)
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
return answer;
|
||||
@@ -2194,7 +2186,7 @@ char *midstring(void)
|
||||
|
||||
if( x > (int) strlen(str) || len < 1)
|
||||
{
|
||||
free(str);
|
||||
sys_free(str);
|
||||
answer = mystrdup("");
|
||||
if(!answer)
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
@@ -2209,7 +2201,7 @@ char *midstring(void)
|
||||
|
||||
temp = &str[x-1];
|
||||
|
||||
answer = malloc(len + 1);
|
||||
answer = sys_malloc(len + 1);
|
||||
if(!answer)
|
||||
{
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
@@ -2217,7 +2209,7 @@ char *midstring(void)
|
||||
}
|
||||
strncpy(answer, temp, len);
|
||||
answer[len] = 0;
|
||||
free(str);
|
||||
sys_free(str);
|
||||
|
||||
return answer;
|
||||
}
|
||||
@@ -2248,7 +2240,7 @@ char *stringstring(void)
|
||||
|
||||
if(N < 1)
|
||||
{
|
||||
free(str);
|
||||
sys_free(str);
|
||||
answer = mystrdup("");
|
||||
if(!answer)
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
@@ -2256,10 +2248,10 @@ char *stringstring(void)
|
||||
}
|
||||
|
||||
len = strlen(str);
|
||||
answer = malloc( N * len + 1 );
|
||||
answer = sys_malloc( N * len + 1 );
|
||||
if(!answer)
|
||||
{
|
||||
free(str);
|
||||
sys_free(str);
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
return 0;
|
||||
}
|
||||
@@ -2267,7 +2259,7 @@ char *stringstring(void)
|
||||
{
|
||||
strcpy(answer + len * i, str);
|
||||
}
|
||||
free(str);
|
||||
sys_free(str);
|
||||
|
||||
return answer;
|
||||
}
|
||||
@@ -2394,7 +2386,7 @@ char *stringliteral(void)
|
||||
if(end)
|
||||
{
|
||||
len = end - string;
|
||||
substr = malloc(len);
|
||||
substr = sys_malloc(len);
|
||||
if(!substr)
|
||||
{
|
||||
seterror(ERR_OUTOFMEMORY);
|
||||
@@ -2404,8 +2396,8 @@ char *stringliteral(void)
|
||||
if(answer)
|
||||
{
|
||||
temp = mystrconcat(answer, substr);
|
||||
free(substr);
|
||||
free(answer);
|
||||
sys_free(substr);
|
||||
sys_free(answer);
|
||||
answer = temp;
|
||||
if(!answer)
|
||||
{
|
||||
@@ -2968,7 +2960,7 @@ char *mystrdup(const char *str)
|
||||
{
|
||||
char *answer;
|
||||
|
||||
answer = malloc(strlen(str) + 1);
|
||||
answer = sys_malloc(strlen(str) + 1);
|
||||
if(answer)
|
||||
strcpy(answer, str);
|
||||
|
||||
@@ -2987,7 +2979,7 @@ char *mystrconcat(const char *str, const char *cat)
|
||||
char *answer;
|
||||
|
||||
len = strlen(str) + strlen(cat);
|
||||
answer = malloc(len + 1);
|
||||
answer = sys_malloc(len + 1);
|
||||
if(answer)
|
||||
{
|
||||
strcpy(answer, str);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
By Malcolm Mclean
|
||||
*/
|
||||
|
||||
int basic(const char *script);
|
||||
int basic(const char *script);
|
||||
|
||||
#endif
|
||||
|
||||
167
apps/mbasic/ed.c
167
apps/mbasic/ed.c
@@ -43,36 +43,31 @@
|
||||
#endif
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <usb_serial.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
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <usb_serial.h>
|
||||
#include "k64f_soc.h"
|
||||
#include <ctype.h>
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#undef stdout
|
||||
#undef stdin
|
||||
#undef stderr
|
||||
extern FILE *stdout;
|
||||
extern FILE *stdin;
|
||||
extern FILE *stderr;
|
||||
#elif defined(__ZPU__)
|
||||
#include <zstdio.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#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 <umm_malloc.h>
|
||||
#include "utils.h"
|
||||
//
|
||||
#if defined __ZPUTA__
|
||||
@@ -85,6 +80,8 @@
|
||||
//
|
||||
#include "mbasic.h"
|
||||
|
||||
|
||||
|
||||
// Globals needed by ed.
|
||||
struct editorConfig E;
|
||||
|
||||
@@ -92,23 +89,6 @@ struct editorConfig E;
|
||||
extern LINE *lines;
|
||||
extern int nlines;
|
||||
|
||||
|
||||
// A method to access the millisecond counter within the hardware or main OS.
|
||||
//
|
||||
uint32_t sysmillis(void)
|
||||
{
|
||||
uint32_t milliSec;
|
||||
|
||||
#if defined __ZPU__
|
||||
milliSec = (uint32_t)RTC_MILLISECONDS;
|
||||
#elif defined __K64F__
|
||||
milliSec = (uint32_t)*G->millis;
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
return milliSec;
|
||||
}
|
||||
|
||||
// Simple method to create a local delay timer not dependent on system libraries.
|
||||
//
|
||||
void syswait(uint32_t wait)
|
||||
@@ -217,15 +197,15 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Save cursor position.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '7');
|
||||
printf("%c%c", 0x1b, '7');
|
||||
|
||||
// Cursor to maximum X/Y location, report cursor location
|
||||
//
|
||||
xputs("\x1b[0;0H");
|
||||
fputs("\x1b[0;0H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[999;999H");
|
||||
fputs("\x1b[999;999H", stdout);
|
||||
syswait(10);
|
||||
xputs("\x1b[6n");
|
||||
fputs("\x1b[6n", stdout);
|
||||
|
||||
// Read the response: ESC [ rows ; cols R
|
||||
//
|
||||
@@ -250,7 +230,7 @@ int getCursorPosition(uint32_t *rows, uint32_t *cols)
|
||||
|
||||
// Restore cursor.
|
||||
//
|
||||
xprintf("%c%c", 0x1b, '8');
|
||||
printf("%c%c", 0x1b, '8');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -284,8 +264,8 @@ int editorInsertRow(int at, char *s, size_t len)
|
||||
|
||||
if (at > E.numrows) return 0;
|
||||
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_realloc(E.row,sizeof(erow)*(E.numrows+1));
|
||||
if(E.row == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
|
||||
if (at != E.numrows)
|
||||
{
|
||||
@@ -294,8 +274,8 @@ int editorInsertRow(int at, char *s, size_t len)
|
||||
}
|
||||
|
||||
E.row[at].size = len;
|
||||
E.row[at].chars = malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { xprintf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
E.row[at].chars = sys_malloc(len+1);
|
||||
if(E.row[at].chars == NULL) { printf("editorInsertRow: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[at].chars,s,len+1);
|
||||
E.row[at].idx = at;
|
||||
E.numrows++;
|
||||
@@ -308,7 +288,7 @@ void editorFreeRow(erow *row)
|
||||
{
|
||||
if(row->chars != NULL)
|
||||
{
|
||||
free(row->chars);
|
||||
sys_free(row->chars);
|
||||
row->chars = NULL;
|
||||
}
|
||||
}
|
||||
@@ -325,18 +305,18 @@ void editorCleanup(void)
|
||||
{
|
||||
if(E.row[idx].chars != NULL)
|
||||
{
|
||||
free(E.row[idx].chars);
|
||||
sys_free(E.row[idx].chars);
|
||||
}
|
||||
}
|
||||
|
||||
// Free the editor config structure.
|
||||
if(E.row)
|
||||
free(E.row);
|
||||
sys_free(E.row);
|
||||
|
||||
// Free the BASIC script memory if used.
|
||||
//
|
||||
if(lines)
|
||||
free(lines);
|
||||
sys_free(lines);
|
||||
|
||||
// Reset necessary variables.
|
||||
E.cx = 0;
|
||||
@@ -380,8 +360,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
|
||||
/* In the next line +2 means: new char and null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+padlen+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memset(row->chars+row->size,' ',padlen);
|
||||
row->chars[row->size+padlen+1] = '\0';
|
||||
row->size += padlen+1;
|
||||
@@ -389,8 +369,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* If we are in the middle of the string just make space for 1 new
|
||||
* char plus the (already existing) null term.
|
||||
*/
|
||||
row->chars = realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { xprintf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+2);
|
||||
if(row->chars == NULL) { printf("editorRowInsertChar: Memory exhausted\n"); return 1; }
|
||||
memmove(row->chars+at+1,row->chars+at,row->size-at+1);
|
||||
row->size++;
|
||||
}
|
||||
@@ -403,8 +383,8 @@ int editorRowInsertChar(erow *row, int at, int c)
|
||||
/* Append the string 's' at the end of a row */
|
||||
int editorRowAppendString(erow *row, char *s, size_t len)
|
||||
{
|
||||
row->chars = realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { xprintf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
row->chars = sys_realloc(row->chars,row->size+len+1);
|
||||
if(row->chars == NULL) { printf("editorRowAppendString: Memory exhausted\n"); return 1; }
|
||||
memcpy(row->chars+row->size,s,len);
|
||||
|
||||
row->size += len;
|
||||
@@ -551,7 +531,7 @@ int editorOpen(char *filename)
|
||||
fr = f_open(&fp, filename, FA_OPEN_ALWAYS | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to open file:%s\n", filename);
|
||||
printf("Failed to open file:%s\n", filename);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -565,7 +545,7 @@ int editorOpen(char *filename)
|
||||
fr = f_lseek(&fp, 0);
|
||||
if(fr)
|
||||
{
|
||||
xprintf("Failed to rewind file:%s\n", filename);
|
||||
printf("Failed to rewind file:%s\n", filename);
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -575,8 +555,9 @@ int editorOpen(char *filename)
|
||||
{
|
||||
// Allocate memory for the row array.
|
||||
//
|
||||
E.row = realloc(E.row,sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row = sys_malloc(sizeof(erow)*(E.numrows));
|
||||
if(E.row == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memset(E.row, '\0', sizeof(erow)*(E.numrows));
|
||||
|
||||
// Now go through the file again and populate each row with the data.
|
||||
//
|
||||
@@ -588,8 +569,8 @@ int editorOpen(char *filename)
|
||||
buf[--linelen] = '\0';
|
||||
|
||||
E.row[rowNo].size = linelen;
|
||||
E.row[rowNo].chars = malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { xprintf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
E.row[rowNo].chars = sys_malloc(linelen+1);
|
||||
if(E.row[rowNo].chars == NULL) { printf("editorOpen: Memory exhausted\n"); return 1; }
|
||||
memcpy(E.row[rowNo].chars, buf, linelen+1);
|
||||
E.row[rowNo].idx = rowNo;
|
||||
rowNo++;
|
||||
@@ -614,7 +595,7 @@ int editorSave(char *newFileName)
|
||||
fr = f_open(&fp, (newFileName == NULL ? E.filename : newFileName), FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
|
||||
if(fr)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
sprintf(E.statusmsg, "Failed to open file:%s\n", (newFileName == NULL ? E.filename : newFileName));
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -638,13 +619,13 @@ int editorSave(char *newFileName)
|
||||
f_close(&fp);
|
||||
|
||||
E.dirty = 0;
|
||||
xsprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
sprintf(E.statusmsg, "%d bytes written on disk", totlen);
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 0;
|
||||
|
||||
writeerr:
|
||||
f_close(&fp);
|
||||
xsprintf(E.statusmsg, "Can't save! I/O error");
|
||||
sprintf(E.statusmsg, "Can't save! I/O error");
|
||||
E.statusmsg_time = sysmillis();
|
||||
return 1;
|
||||
}
|
||||
@@ -708,8 +689,8 @@ void editorList(int startLine, int endLine)
|
||||
{
|
||||
if((startLine == -1 || (startLine != -1 && lines[idx].no >= startLine)) && (endLine == -1 || (endLine != -1 && lines[idx].no <= endLine)))
|
||||
{
|
||||
xputs(lines[idx].str);
|
||||
xputc('\n');
|
||||
fputs(lines[idx].str, stdout);
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -733,10 +714,10 @@ int editorBuildScript(void)
|
||||
|
||||
// Allocate memory for the basic lines array.
|
||||
//
|
||||
lines = realloc(lines, E.numrows * sizeof(LINE));
|
||||
lines = sys_realloc(lines, E.numrows * sizeof(LINE));
|
||||
if(lines == NULL)
|
||||
{
|
||||
xprintf("Out of memory converting editor buffer to BASIC script.\n");
|
||||
printf("Out of memory converting editor buffer to BASIC script.\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -759,7 +740,7 @@ int editorBuildScript(void)
|
||||
nlines++;
|
||||
} else if(strlen(paramptr) > 0)
|
||||
{
|
||||
xprintf("Syntax error on line:%s\n", E.row[idx].chars);
|
||||
printf("Syntax error on line:%s\n", E.row[idx].chars);
|
||||
return(3);
|
||||
}
|
||||
}
|
||||
@@ -770,7 +751,7 @@ int editorBuildScript(void)
|
||||
{
|
||||
if(lines[idx].no <= lines[idx-1].no)
|
||||
{
|
||||
xprintf("Program lines %d and %d not in order\n", lines[idx-1].no, lines[idx].no);
|
||||
printf("Program lines %d and %d not in order\n", lines[idx-1].no, lines[idx].no);
|
||||
return(4);
|
||||
}
|
||||
}
|
||||
@@ -800,10 +781,10 @@ void abAppend(const char *s, int len, int flush)
|
||||
// First call, allocate memory for the buffer.
|
||||
if(ab == NULL)
|
||||
{
|
||||
ab = malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { xprintf("abAppend: Memory exhausted\n"); return; }
|
||||
ab = sys_malloc(sizeof(struct abuf));
|
||||
if(ab == NULL) { printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->b = sys_malloc(MAX_APPEND_BUFSIZE);
|
||||
if(ab->b == NULL) { printf("abAppend: Memory exhausted\n"); return; }
|
||||
ab->len = 0;
|
||||
}
|
||||
|
||||
@@ -812,14 +793,14 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
const char *ptr = ab->b;
|
||||
for(ptr=ab->b; ptr < ab->b+ab->len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
// If we are flushing then write out the additional data passed in to the method.
|
||||
//
|
||||
if(flush)
|
||||
{
|
||||
for(ptr=s; ptr < s+len; ptr++)
|
||||
xputc(*ptr);
|
||||
fputc(*ptr, stdout);
|
||||
|
||||
}
|
||||
ab->len = 0;
|
||||
@@ -835,8 +816,8 @@ void abAppend(const char *s, int len, int flush)
|
||||
{
|
||||
// On flush we free up the memory, extra cycles in alloc and free but keeps the heap balanced and no memory leaks when we exit.
|
||||
//
|
||||
free(ab->b);
|
||||
free(ab);
|
||||
sys_free(ab->b);
|
||||
sys_free(ab);
|
||||
ab = NULL;
|
||||
}
|
||||
}
|
||||
@@ -861,7 +842,7 @@ int editorRefreshScreen(void)
|
||||
if (E.numrows == 0 && y == E.screenrows/3)
|
||||
{
|
||||
char welcome[80];
|
||||
xsprintf(welcome, "Ed(itor) -- version %s\x1b[0K\r\n", ED_VERSION);
|
||||
sprintf(welcome, "Ed(itor) -- version %s\x1b[0K\r\n", ED_VERSION);
|
||||
int welcomelen = strlen(welcome);
|
||||
int padding = (E.screencols-welcomelen)/2;
|
||||
if (padding)
|
||||
@@ -918,9 +899,9 @@ int editorRefreshScreen(void)
|
||||
abAppend("\x1b[0K",4, 0);
|
||||
abAppend("\x1b[7m",4, 0);
|
||||
char status[80], rstatus[80];
|
||||
xsprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
sprintf(status, "%-20s - %d lines %s", E.filename, E.numrows, E.dirty > 0 ? "(modified)" : "");
|
||||
int len = strlen(status);
|
||||
xsprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
sprintf(rstatus, "%d/%d",E.rowoff+E.cy+1,E.numrows);
|
||||
int rlen = strlen(rstatus);
|
||||
if (len > E.screencols) len = E.screencols;
|
||||
abAppend(status,len, 0);
|
||||
@@ -957,7 +938,7 @@ int editorRefreshScreen(void)
|
||||
cx++;
|
||||
}
|
||||
}
|
||||
xsprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
sprintf(buf,"\x1b[%d;%dH",E.cy+1,cx);
|
||||
abAppend(buf,strlen(buf), 0);
|
||||
|
||||
/* Show cursor and Flush to complete.
|
||||
@@ -981,7 +962,7 @@ void editorFind(void) {
|
||||
|
||||
while(1)
|
||||
{
|
||||
xsprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
sprintf(E.statusmsg, "Search: %s (Use ESC/Arrows/Enter)", query);
|
||||
E.statusmsg_time = sysmillis();
|
||||
editorRefreshScreen();
|
||||
|
||||
@@ -994,7 +975,7 @@ void editorFind(void) {
|
||||
E.cx = saved_cx; E.cy = saved_cy;
|
||||
E.coloff = saved_coloff; E.rowoff = saved_rowoff;
|
||||
}
|
||||
xsprintf(E.statusmsg, "");
|
||||
E.statusmsg[0] = '\0';
|
||||
E.statusmsg_time = sysmillis();
|
||||
return;
|
||||
} else if (c == ARROW_RIGHT || c == ARROW_DOWN) {
|
||||
@@ -1179,7 +1160,7 @@ uint32_t editorProcessKeypress(void)
|
||||
*/
|
||||
if (E.dirty > 0 && quit_times > 0)
|
||||
{
|
||||
xsprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
sprintf(E.statusmsg, "WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
|
||||
E.statusmsg_time = sysmillis();
|
||||
quit_times--;
|
||||
}
|
||||
@@ -1189,8 +1170,8 @@ uint32_t editorProcessKeypress(void)
|
||||
cySave = E.cy;
|
||||
E.cy = E.screenrows-1;
|
||||
lastLine = editorRefreshScreen();
|
||||
xprintf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
xputs("\x1b[0J");
|
||||
printf("\x1b[%03d;%03dH", (lastLine == -1 ? E.screenrows-1 : lastLine+1), 1);
|
||||
fputs("\x1b[0J", stdout);
|
||||
|
||||
// Restore the cursor so it opens in the same place when edit is restarted.
|
||||
E.cx = cxSave;
|
||||
@@ -1271,7 +1252,7 @@ uint32_t initEditor(void)
|
||||
E.filename = NULL;
|
||||
if (getWindowSize(&E.screenrows,&E.screencols) == -1)
|
||||
{
|
||||
xprintf("Unable to query the screen for size (columns / rows)");
|
||||
printf("Unable to query the screen for size (columns / rows)");
|
||||
return(1);
|
||||
}
|
||||
E.screenrows -= 2; /* Get room for status bar. */
|
||||
|
||||
@@ -42,29 +42,21 @@
|
||||
|
||||
#if defined(__K64F__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.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
|
||||
#include <../../libraries/include/stdmisc.h>
|
||||
#elif defined(__ZPU__)
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "zpu_soc.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdmisc.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"
|
||||
#include <readline.h>
|
||||
#include "basic.h"
|
||||
@@ -77,6 +69,7 @@
|
||||
#error OS not defined, use __ZPUTA__ or __ZOS__
|
||||
#endif
|
||||
//
|
||||
#include "app.h"
|
||||
#include "mbasic.h"
|
||||
|
||||
// Utility functions.
|
||||
@@ -132,15 +125,31 @@ extern struct editorConfig E;
|
||||
//
|
||||
void printBasicHelp(void)
|
||||
{
|
||||
xprintf("\nMini-Basic %s Help\n", VERSION);
|
||||
xprintf("RUN - Execute the basic code.\n");
|
||||
xprintf("EDIT - Open the editor for editting the BASIC code.\n");
|
||||
xprintf("LIST [<start>, [<end>]] - List the code.\n");
|
||||
xprintf("NEW - Clear program from memory.\n");
|
||||
xprintf("LOAD \"<file>\" - Load program into memory.\n");
|
||||
xprintf("SAVE \"<file>\" - Save program to file.\n");
|
||||
xprintf("HELP - This help screen.\n");
|
||||
xprintf("QUIT - Exit BASIC and return to the OS.\n");
|
||||
printf("\nMini-Basic %s Help\n", VERSION);
|
||||
printf("RUN - Execute the basic code.\n");
|
||||
printf("EDIT - Open the editor for editting the BASIC code.\n");
|
||||
printf("LIST [<start>, [<end>]] - List the code.\n");
|
||||
printf("NEW - Clear program from memory.\n");
|
||||
printf("LOAD \"<file>\" - Load program into memory.\n");
|
||||
printf("SAVE \"<file>\" - Save program to file.\n");
|
||||
printf("HELP - This help screen.\n");
|
||||
printf("QUIT - Exit BASIC and return to the OS.\n");
|
||||
}
|
||||
|
||||
// A method to access the millisecond counter within the hardware or main OS.
|
||||
//
|
||||
uint32_t sysmillis(void)
|
||||
{
|
||||
uint32_t milliSec;
|
||||
|
||||
#if defined __ZPU__
|
||||
milliSec = (uint32_t)RTC_MILLISECONDS;
|
||||
#elif defined __K64F__
|
||||
milliSec = (uint32_t)*G->millis;
|
||||
#else
|
||||
#error "Target CPU not defined, use __ZPU__ or __K64F__"
|
||||
#endif
|
||||
return milliSec;
|
||||
}
|
||||
|
||||
// List out the basic source code, either the full test or from the optional Start and End parameters.
|
||||
@@ -163,7 +172,7 @@ int listBasicSource(char *params)
|
||||
//
|
||||
if(endLine < startLine)
|
||||
{
|
||||
xprintf("Illegal line range.\n");
|
||||
printf("Illegal line range.\n");
|
||||
} else
|
||||
{
|
||||
// List out the source from the given lines.
|
||||
@@ -191,7 +200,7 @@ int cmdProcessor()
|
||||
char buf[132];
|
||||
|
||||
// Signon.
|
||||
xprintf("Mini-Basic %s\n", VERSION);
|
||||
printf("Mini-Basic %s\n", VERSION);
|
||||
|
||||
// Loop until a quit command is given.
|
||||
//
|
||||
@@ -199,7 +208,7 @@ int cmdProcessor()
|
||||
{
|
||||
// Indicate we are waiting for a command as needed.
|
||||
if(ready)
|
||||
xputs("Ready\n");
|
||||
fputs("Ready\n", stdout);
|
||||
|
||||
// Get command.
|
||||
//
|
||||
@@ -224,7 +233,7 @@ int cmdProcessor()
|
||||
// Edit the basic program.
|
||||
//
|
||||
case CMD_EDIT:
|
||||
xsprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
sprintf(E.statusmsg, "HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
|
||||
E.statusmsg_time = sysmillis();
|
||||
retCode = 0;
|
||||
while(retCode == 0)
|
||||
@@ -269,11 +278,11 @@ int cmdProcessor()
|
||||
editorOpen(fileName);
|
||||
} else
|
||||
{
|
||||
xprintf("Bad filename, use format \"<file>\" if name contains spaces or just <file> if it doesnt.\n");
|
||||
printf("Bad filename, use format \"<file>\" if name contains spaces or just <file> if it doesnt.\n");
|
||||
}
|
||||
} else
|
||||
{
|
||||
xprintf("Current program hasnt been saved, use 'save' to use current filename, \n'save \"<file>\"' to store to <file> or 'new' to delete current program.\n");
|
||||
printf("Current program hasnt been saved, use 'save' to use current filename, \n'save \"<file>\"' to store to <file> or 'new' to delete current program.\n");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -284,7 +293,7 @@ int cmdProcessor()
|
||||
fileName = getStrParam(¶mptr);
|
||||
if(editorSave((fileName != NULL && strlen(fileName) > 0) ? fileName : NULL) == 1)
|
||||
{
|
||||
xprintf("File save failed, check name, disk space and permissions.\n");
|
||||
printf("File save failed, check name, disk space and permissions.\n");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -304,7 +313,7 @@ int cmdProcessor()
|
||||
// Default case is an error.
|
||||
default:
|
||||
ready=0;
|
||||
xprintf("Bad Command\n");
|
||||
printf("Bad Command\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -325,7 +334,7 @@ int cmdProcessor()
|
||||
if(strlen(paramptr) > 0 && *paramptr > 0x1f)
|
||||
{
|
||||
ready=0;
|
||||
xprintf("Bad Command\n");
|
||||
printf("Bad Command\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,10 +371,10 @@ uint32_t app(uint32_t param1, uint32_t param2)
|
||||
// Memory exhausted?
|
||||
if(retCode == 1)
|
||||
{
|
||||
xprintf("Insufficient memory to process this file.\n", pathName);
|
||||
printf("Insufficient memory to process this file.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("Failed to create or open file:%s\n", pathName);
|
||||
printf("Failed to create or open file:%s\n", pathName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,68 +47,19 @@
|
||||
// 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
|
||||
// Redefinitions.
|
||||
#ifndef assert
|
||||
#define assert(a)
|
||||
#endif
|
||||
#ifndef malloc
|
||||
#define malloc sys_malloc
|
||||
#endif
|
||||
#ifndef realloc
|
||||
#define realloc sys_realloc
|
||||
#endif
|
||||
#ifndef calloc
|
||||
#define calloc sys_calloc
|
||||
#endif
|
||||
|
||||
// Main app configuration variables.
|
||||
//
|
||||
@@ -340,96 +291,97 @@ typedef struct
|
||||
} FORLOOP;
|
||||
|
||||
// Prototypes.
|
||||
uint32_t sysmillis(void);
|
||||
void syswait(uint32_t);
|
||||
int8_t getKey(uint32_t);
|
||||
int editorReadKey(void);
|
||||
int getCursorPosition(uint32_t *, uint32_t *);
|
||||
int getWindowSize(int *, int *);
|
||||
int editorInsertRow(int, char *, size_t);
|
||||
void editorFreeRow(erow *);
|
||||
void editorCleanup(void);
|
||||
void editorDelRow(int);
|
||||
int editorRowInsertChar(erow *, int, int);
|
||||
int editorRowAppendString(erow *, char *, size_t);
|
||||
int editorRowDelChar(erow *, int);
|
||||
void editorInsertChar(int);
|
||||
int editorInsertNewline(void);
|
||||
int editorDelChar(void);
|
||||
int editorOpen(char *);
|
||||
int editorSave(char *);
|
||||
void editorList(int, int);
|
||||
int editorBuildScript(void);
|
||||
void abAppend(const char *, int, int);
|
||||
int editorRefreshScreen(void);
|
||||
void editorFind(void) ;
|
||||
void editorMoveCursor(int);
|
||||
uint32_t editorProcessKeypress(void);
|
||||
int editorFileWasModified(void);
|
||||
int editorAddBasicLine(int, char *, size_t);
|
||||
uint32_t initEditor(void);
|
||||
int execBasicScript(void);
|
||||
void cleanup(void);
|
||||
void reporterror(int);
|
||||
int findline(int);
|
||||
int line(int);
|
||||
void doprint(int);
|
||||
void dolet(int);
|
||||
void dodim(int);
|
||||
int doif(int);
|
||||
int dogoto(int);
|
||||
int dofor(int);
|
||||
int donext(int);
|
||||
int doinput(int);
|
||||
void dorem(int);
|
||||
int dopoke(int);
|
||||
void lvalue(LVALUE *);
|
||||
int boolexpr(void);
|
||||
int boolfactor(void);
|
||||
int relop(void);
|
||||
double expr(void);
|
||||
double term(void);
|
||||
double factor(void);
|
||||
double instr(void);
|
||||
double variable(void);
|
||||
double dimvariable(void);
|
||||
VARIABLE *findvariable(const char *);
|
||||
DIMVAR *finddimvar(const char *);
|
||||
DIMVAR *dimension(const char *, int , ...);
|
||||
void *getdimvar(DIMVAR *, ...);
|
||||
VARIABLE *addfloat(const char *);
|
||||
VARIABLE *addstring(const char *);
|
||||
DIMVAR *adddimvar(const char *);
|
||||
char *stringexpr(void);
|
||||
char *chrstring(void);
|
||||
char *strstring(void);
|
||||
char *leftstring(void);
|
||||
char *rightstring(void);
|
||||
char *midstring(void);
|
||||
char *stringstring(void);
|
||||
char *stringdimvar(void);
|
||||
char *stringvar(void);
|
||||
char *stringliteral(void);
|
||||
int integer(double);
|
||||
void match(int);
|
||||
void seterror(int);
|
||||
int getnextline(int);
|
||||
int gettoken(const char *);
|
||||
int tokenlen(const char *, int);
|
||||
int isstring(int);
|
||||
double getvalue(const char *, int *);
|
||||
void getid(const char *, char *, int *);
|
||||
void mystrgrablit(char *, const char *);
|
||||
char *mystrend(const char *, char);
|
||||
int mystrcount(const char *, char);
|
||||
char *mystrdup(const char *);
|
||||
char *mystrconcat(const char *, const char *);
|
||||
double factorial(double);
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
uint32_t sysmillis(void);
|
||||
void syswait(uint32_t);
|
||||
int8_t getKey(uint32_t);
|
||||
int editorReadKey(void);
|
||||
int getCursorPosition(uint32_t *, uint32_t *);
|
||||
int getWindowSize(int *, int *);
|
||||
int editorInsertRow(int, char *, size_t);
|
||||
void editorFreeRow(erow *);
|
||||
void editorCleanup(void);
|
||||
void editorDelRow(int);
|
||||
int editorRowInsertChar(erow *, int, int);
|
||||
int editorRowAppendString(erow *, char *, size_t);
|
||||
int editorRowDelChar(erow *, int);
|
||||
void editorInsertChar(int);
|
||||
int editorInsertNewline(void);
|
||||
int editorDelChar(void);
|
||||
int editorOpen(char *);
|
||||
int editorSave(char *);
|
||||
void editorList(int, int);
|
||||
int editorBuildScript(void);
|
||||
void abAppend(const char *, int, int);
|
||||
int editorRefreshScreen(void);
|
||||
void editorFind(void) ;
|
||||
void editorMoveCursor(int);
|
||||
uint32_t editorProcessKeypress(void);
|
||||
int editorFileWasModified(void);
|
||||
int editorAddBasicLine(int, char *, size_t);
|
||||
uint32_t initEditor(void);
|
||||
int execBasicScript(void);
|
||||
void cleanup(void);
|
||||
void reporterror(int);
|
||||
int findline(int);
|
||||
int line(int);
|
||||
void doprint(int);
|
||||
void dolet(int);
|
||||
void dodim(int);
|
||||
int doif(int);
|
||||
int dogoto(int);
|
||||
int dofor(int);
|
||||
int donext(int);
|
||||
int doinput(int);
|
||||
void dorem(int);
|
||||
int dopoke(int);
|
||||
void lvalue(LVALUE *);
|
||||
int boolexpr(void);
|
||||
int boolfactor(void);
|
||||
int relop(void);
|
||||
double expr(void);
|
||||
double term(void);
|
||||
double factor(void);
|
||||
double instr(void);
|
||||
double variable(void);
|
||||
double dimvariable(void);
|
||||
VARIABLE *findvariable(const char *);
|
||||
DIMVAR *finddimvar(const char *);
|
||||
DIMVAR *dimension(const char *, int , ...);
|
||||
void *getdimvar(DIMVAR *, ...);
|
||||
VARIABLE *addfloat(const char *);
|
||||
VARIABLE *addstring(const char *);
|
||||
DIMVAR *adddimvar(const char *);
|
||||
char *stringexpr(void);
|
||||
char *chrstring(void);
|
||||
char *strstring(void);
|
||||
char *leftstring(void);
|
||||
char *rightstring(void);
|
||||
char *midstring(void);
|
||||
char *stringstring(void);
|
||||
char *stringdimvar(void);
|
||||
char *stringvar(void);
|
||||
char *stringliteral(void);
|
||||
int integer(double);
|
||||
void match(int);
|
||||
void seterror(int);
|
||||
int getnextline(int);
|
||||
int gettoken(const char *);
|
||||
int tokenlen(const char *, int);
|
||||
int isstring(int);
|
||||
double getvalue(const char *, int *);
|
||||
void getid(const char *, char *, int *);
|
||||
void mystrgrablit(char *, const char *);
|
||||
char *mystrend(const char *, char);
|
||||
int mystrcount(const char *, char);
|
||||
char *mystrdup(const char *);
|
||||
char *mystrconcat(const char *, const char *);
|
||||
double factorial(double);
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
void *sys_malloc(size_t); // Allocate memory managed by the OS.
|
||||
void *sys_realloc(void *, size_t); // Reallocate a block of memory managed by the OS.
|
||||
void *sys_calloc(size_t, size_t); // Allocate and zero a block of memory managed by the OS.
|
||||
void sys_free(void *); // Free memory managed by the OS.
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
extern GLOBALS *G;
|
||||
extern SOC_CONFIG *cfgSoC;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user