Further updates, added libraries to make the build independent of toolchain libraries

This commit is contained in:
Philip Smart
2020-05-05 23:14:11 +01:00
parent 7a87cb7d5f
commit ef0fef097b
275 changed files with 164208 additions and 155659 deletions

View File

@@ -89,6 +89,8 @@ DHRY_DIR = $(CURDIR)/../../common/Dhrystone
COREMARK_DIR = $(CURDIR)/../../common/CoreMark
UMM_DIR = $(CURDIR)/../../common/umm
INCLUDE_DIR = $(CURDIR)/../../include
LIB_DIR = $(CURDIR)/../../libraries/lib
LIB_INCLUDE_DIR= $(CURDIR)/../../libraries/include
APP_INCLUDE_DIR= $(CURDIR)/../include
# Working directory to build object files.
@@ -109,7 +111,7 @@ endif
# Common modules needed for this app.
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
COMMON_SRC = $(COMMON_DIR)/syscalls.c # $(COMMON_DIR)/malloc.c
COMMON_SRC = #$(CURDIR)/../common/sysutils.c #$(COMMON_DIR)/syscalls.c # $(COMMON_DIR)/malloc.c
MAIN_PRJ_APP = $(APP_NAME)
MAIN_SRC = $(APP_NAME).c
@@ -136,7 +138,7 @@ ZPUOPTS = -mloadsp \
-mcompare \
-mpoppcrel \
-mmemreg
ifeq ($(CPU), $(filter $(CPU),SMALL MEDIUM FLEX))
ifeq ($(CPU), $(filter $(CPU),SMALL MEDIUM FLEX EVOMIN))
ZPUOPTS += -mno-mult \
-mno-div \
-mno-mod \
@@ -150,7 +152,8 @@ ifeq ($(CPU), $(filter $(CPU),EVO))
endif
#CFLAGS += -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
CFLAGS += -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(OSDIR) -I$(INCLUDE_DIR) -I$(APP_INCLUDE_DIR) -I${UMM_DIR} -c -O3 -ffunction-sections -fdata-sections $(ZPUOPTS)
CFLAGS += -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(OSDIR) -I$(INCLUDE_DIR) -I$(APP_INCLUDE_DIR) -I${UMM_DIR} -I$(LIB_INCLUDE_DIR)
CFLAGS += -c -Os -ffunction-sections -fdata-sections $(ZPUOPTS)
CFLAGS += -D__ZPU__ -D__APP__ -DOS_BASEADDR=$(OS_BASEADDR) -DOS_APPADDR=$(OS_APPADDR)
ifeq (-nostdlib,$(findstring -nostdlib,$(LDFLAGS)))
CFLAGS += -DUMM_BEST_FIT -DUMM_INFO -DUMM_DBG_LOG_LEVEL=0
@@ -192,7 +195,7 @@ OFLAGS += -DUSELOADB
# Enable SD Card functionality
OFLAGS += -D__SD_CARD__
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR)
LDFLAGS += -nostartfiles -Wl,--gc-sections -Wl,--relax -Os -Wl,--defsym=OS_BASEADDR=$(OS_BASEADDR) -Wl,--defsym=OS_APPADDR=$(OS_APPADDR) -L$(LIB_DIR)
#
# Assembler flags.
ifeq ($(OS_BASEADDR),0x000000)
@@ -280,7 +283,7 @@ $(MAIN_PRJ_APP).elf: $(OBJS)
-e "s/APP_STACK_SIZE/$(STACKSIZE)/g" \
-e "s/APP_STACK_STARTADDR/$(STACKADDR)/g" \
-e "s/APP_STACK_ENDADDR/$(STACKENDADDR)/g" > $(LINKMAPAPP)
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $(OBJS) $(LIBS)
$(LD) $(LDFLAGS) -T $(LINKMAPAPP) -o $@ $(OBJS) $(LIBS)
$(BUILD_DIR)/%.o: %.c Makefile
@mkdir -p "$(dir $@)"

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -40,15 +40,13 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdio.h>
#include <stdlib.h>
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif
#include <errno.h>
extern unsigned long _stext;
extern unsigned long _etext;
extern unsigned long _sdata;
@@ -61,6 +59,18 @@ extern unsigned long _estack;
#define STACK_MARGIN 8192
#endif
#if defined(__ZPU__)
void outbyte(char c)
{
(void)xputc(c);
}
char inbyte(void)
{
return getserial();
}
#endif
int strlen(const char* s) {
int i;
for (i = 0; s[i]; i++) {

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -41,16 +41,27 @@ APP_COMMON_DIR = $(CURDIR)/../common
BASEDIR = ../../..
# Override values given by parent make for this application as its memory usage differs from the standard app.
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
ifeq ($(__K64F__),1)
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
# Modules making up Kilo.
APP_C_SRC = $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
LIBS =
else
# 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-zpu -limath-zpu
endif
# Modules making up Kilo.
APP_C_SRC = $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
# Useful for sub-makes

View File

@@ -51,7 +51,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctypelocal.h>
#include <stdarg.h>
#include <usb_serial.h>
#include "k64f_soc.h"
@@ -62,13 +61,14 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif
//#include <ctypelocal.h>
#include <ctype.h>
#include "interrupts.h"
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h"

View File

@@ -49,10 +49,8 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -41,16 +41,26 @@ APP_COMMON_DIR = $(CURDIR)/../common
BASEDIR = ../../..
# Override values given by parent make for this application as its memory usage differs from the standard app.
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
# Modules making up Kilo.
APP_C_SRC = $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
ifeq ($(__K64F__),1)
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
# Modules making up Kilo.
APP_C_SRC = $(APP_COMMON_DIR)/sysutils.c $(APP_COMMON_DIR)/ctypelocal.c
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
LIBS =
else
# 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-zpu -limath-zpu
endif
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
# Useful for sub-makes

View File

@@ -49,7 +49,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctypelocal.h>
#include <stdarg.h>
#include "k64f_soc.h"
#define uint32_t __uint32_t
@@ -59,13 +58,14 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif
//#include <ctypelocal.h>
#include <ctype.h>
#include "interrupts.h"
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h"

View File

@@ -18,8 +18,7 @@
##
## Notes: Optional component enables:
## USELOADB - The Byte write command is implemented in hw#sw so use it.
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
## USE_BOOT_ROM - The target is ROM so dont use initialised data. ## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
##
#########################################################################################################
## This source file is free software: you can redistribute it and/or modify
@@ -43,15 +42,17 @@ COMMON_DIR = $(CURDIR)../../common
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
endif
# Modules making up Mbasic.
APP_C_SRC = basic.c ed.c $(APP_COMMON_DIR)/sbrk.c $(APP_COMMON_DIR)/sysutils.c $(COMMON_DIR)/readline.c
UMM_C_SRC = fail
CFLAGS =
UMM_C_SRC =
CFLAGS = -Os
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS =
@@ -64,7 +65,7 @@ NEWMAKEFLAGS = $(FILTER2) HEAPADDR=$(HEADADDR) HEAPSIZE=$(HEAPSIZE)
ifeq ($(__K64F__),1)
include $(APP_DIR)/Makefile.k64f
else
# Currently mbasic doesnt build on the ZPU due to missing maths libraries. Once I can source them it should build.
# Mbasic needs 128K on the ZPU for some reason, 50% more than the Cortex-M4, so for small ZPU installations, we have to disable it!
#include $(APP_DIR)/Makefile.zpu
clean:

View File

@@ -31,6 +31,20 @@
#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
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif
@@ -2420,6 +2434,10 @@ char *stringliteral(void)
*/
int integer(double x)
{
#if defined(__ZPU__)
#define INT_MIN -2147483648L
#define INT_MAX 2147483647L
#endif
if( x < INT_MIN || x > INT_MAX )
seterror( ERR_BADVALUE );
if( x != floor(x) )

View File

@@ -52,8 +52,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
@@ -120,6 +119,13 @@ static t_basic_cmdstruct basicCmdTable[] = {
// Define the number of commands in the array.
#define NBASICCMDKEYS (sizeof(basicCmdTable)/sizeof(t_basic_cmdstruct))
// 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) */
extern struct editorConfig E;
// Print out the commands which are recognised by the interactive command processor.

View File

@@ -427,13 +427,6 @@ char *mystrconcat(const char *, const char *);
double factorial(double);
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

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -50,8 +50,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -41,16 +41,31 @@ APP_COMMON_DIR = $(CURDIR)/../common
BASEDIR = ../../..
# Override values given by parent make for this application as its memory usage differs from the standard app.
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
ifeq ($(__K64F__),1)
override HEAPADDR = 0x1FFF5000
override HEAPSIZE = 0x00033000
override STACKADDR = 0x20028000
override STACKSIZE = 0x00000000
# Modules making up Kilo.
APP_C_SRC = basic_main.c basic_editor.c basic_exectoks.c basic_expr.c basic_tokens.c basic_utils.c $(APP_COMMON_DIR)/sysutils.c
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
# Modules making up BASIC.
APP_C_SRC = basic_main.c basic_editor.c basic_exectoks.c basic_expr.c basic_tokens.c basic_utils.c $(APP_COMMON_DIR)/sysutils.c
CFLAGS = -Wno-write-strings -Wno-char-subscripts
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
LIBS =
else
override HEAPADDR = 0x0000E200
override HEAPSIZE = 0x00000D00
override STACKADDR = 0x0000F000
override STACKSIZE = 0x00000000
# Modules making up BASIC.
APP_C_SRC = basic_main.c basic_editor.c basic_exectoks.c basic_expr.c basic_tokens.c basic_utils.c #$(APP_COMMON_DIR)/sysutils.c
CFLAGS = -Wno-write-strings -Wno-char-subscripts
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS = -nostdlib
LIBS = -lumansi-zpu -limath-zpu
endif
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
# Useful for sub-makes
@@ -58,10 +73,6 @@ FILTER1 = $(filter-out $(filter HEAPADDR=%,$(MAKEFLAGS)), $(MAKEFLAGS))
FILTER2 = $(filter-out $(filter HEAPSIZE=%,$(FILTER1)), $(FILTER1))
NEWMAKEFLAGS = $(FILTER2) HEAPADDR=$(HEADADDR) HEAPSIZE=$(HEAPSIZE)
# Modules making up BASIC.
CFLAGS =
CPPFLAGS =
ifeq ($(__K64F__),1)
include $(APP_DIR)/Makefile.k64f
else

View File

@@ -277,6 +277,7 @@ void calcArray(char letter) {
numeric calcExpression(void) {
while (1) {
switch (curTok->type) {
case TT_NONE:
case TT_SEPARATOR:
@@ -590,4 +591,3 @@ void executeParsedRun(void) {
progLine = next;
}
}

View File

@@ -65,6 +65,7 @@ void printToken(token* t) {
outputChar('E');
break;
}
outputChar('\n');
}
void printTokens(token* t) {

View File

@@ -89,7 +89,7 @@ void setTokenError(char* pos, char code) {
}
token* nextToken(token* t) {
return (token*)(void*)((char*)(void*)t + tokenSize(t));
return (token*)(void*) ((char*)(void*)t + tokenSize(t));
}
void skipTokenInInput(char offset) {

View File

@@ -1 +1 @@
g++ -Wall -Wno-write-strings -Wno-char-subscripts -o tinybas.out main_nix.c ../core/*.c
g++ -Wall -Wno-write-strings -Wno-char-subscripts -o tinybas.out main_nix.c *.c

View File

@@ -52,8 +52,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
@@ -161,13 +160,13 @@ numeric sysMillis(numeric div)
numeric milliSec;
#if defined __ZPU__
milliSec = (numeric)RTC_MILLISECONDS;
milliSec = (numeric)TIMER_MILLISECONDS_UP;
#elif defined __K64F__
milliSec = (numeric)*G->millis;
#else
#error "Target CPU not defined, use __ZPU__ or __K64F__"
#endif
return milliSec;
return milliSec/div;
}
char translateInput(short c)
@@ -333,6 +332,11 @@ uint32_t app(uint32_t param1, uint32_t param2)
// Initialisation.
//
//char *ptr = (char *)param1;
//
// Initialise the ZPU timer.
#if defined __ZPU__
TIMER_MILLISECONDS_UP = 0;
#endif
init(VARS_SPACE_SIZE, 80, sizeof(dataSpace) - VARS_SPACE_SIZE);
while(doExit == 0)

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else
@@ -96,31 +95,61 @@ uint32_t app(uint32_t param1, uint32_t param2)
//uint32_t *pWordArray = malloc(2048);
//uint16_t *pHwordArray = malloc(2048);
//uint8_t *pByteArray = malloc(2048);
static uint32_t wordArray[2048];
static uint16_t hwordArray[2048];
static uint8_t byteArray[2048];
static uint idx;
static uint32_t wordArray[1024];
static uint16_t hwordArray[1024];
static uint8_t byteArray[1024];
static uint16_t idx;
static uint32_t sum;
long int i, j, k, m;
int32_t idx1;
uint32_t idx2;
xputs("This is a test.\n");
xputs("Print another line.\n");
xprintf("This is another test.\n");
xputs("All done\n");
// Test the maths division.
for (i = -10000; i < 10000; i += 8)
{
for (j = -10000; j < 10000; j += 11)
{
k = i / j;
m = __divsi3 (i, j);
if (k != m)
xprintf ("fail %d %d %d %d\n", i, j, k, m);
}
}
// Test the mod, div and mul.
for(idx1=-500; idx1 < 500; idx1++)
{
xprintf("Result(%d)=%d %d,%u,%u:Mul=%d\n", idx1, (idx1/10), (idx1 % 10),((uint32_t)idx1/10), ((uint32_t)idx1 % 10), idx1 * 10);
xprintf("%d, %d\n", __divsi3(idx1,10), __udivsi3(idx1,10));
xprintf("%u, %u\n", __divsi3(idx1,10), __udivsi3(idx1,10));
}
for(idx2=0; idx2 < 500; idx2++)
{
xprintf("Result(%d)=%d %d, Mul:%d\n", idx2, (int32_t)(idx2/10), (int32_t)(idx2 % 10), idx2 * 10);
xprintf(" (%d)=%d %d\n", idx2, (uint32_t)(idx2/10), (uint32_t)(idx2 % 10));
xprintf("%d, %d\n", __divsi3(idx2,10), __udivsi3(idx2,10));
xprintf("%u, %u\n", __divsi3(idx2,10), __udivsi3(idx2,10));
}
// These are just memory tests, the main test is in premain where a closer knit write operation of BSS fails, thus trying to debug.
for(idx=0, sum=0; idx < 2048; idx++)
{
sum += wordArray[idx];
sum += wordArray[idx];
}
for(idx=0, sum=0; idx < 2048; idx++)
{
sum += hwordArray[idx];
sum += hwordArray[idx];
}
for(idx=0, sum=0; idx < 2048; idx++)
{
sum += byteArray[idx];
sum += byteArray[idx];
}
return(0);

View File

@@ -49,8 +49,7 @@
#define int16_t __int16_t
#define int8_t __int8_t
#elif defined(__ZPU__)
#include <zstdio.h>
#include <zpu-types.h>
#include <stdint.h>
#include "zpu_soc.h"
#include <stdlib.h>
#else