1 Gemeinsame Unterverzeichnisse: coremark_v1.0/barebones und coremark-z80/barebones.
2 Nur in coremark_v1.0: coremark-1.0-z80.patch.
3 diff -u coremark_v1.0/core_portme.c coremark-z80/core_portme.c
4 --- coremark_v1.0/core_portme.c 2021-07-05 11:44:20.727282106 +0200
5 +++ coremark-z80/core_portme.c 2021-07-05 11:43:58.622525621 +0200
7 Author : Shay Gal-On, EEMBC
13 #include "core_portme.h"
15 +#define ITERATIONS 100
18 volatile ee_s32 seed1_volatile=0x3415;
19 volatile ee_s32 seed2_volatile=0x3415;
21 e.g. Read value from on board RTC, read value from cpu clock cycles performance counter etc.
22 Sample implementation for standard time.h and windows.h definitions included.
24 -CORETIMETYPE barebones_clock() {
25 - #error "You must implement a method to measure time in barebones_clock()! This function should return current time.\n"
27 /* Define : TIMER_RES_DIVIDER
28 Divider to trade off timer resolution and total time that can be measured.
30 Use lower values to increase resolution, but make sure that overflow does not occur.
31 If there are issues with the return value overflowing, increase this value.
33 -#define GETMYTIME(_t) (*_t=barebones_clock())
34 +#define CLOCKS_PER_SEC 32768
35 +#define NSECS_PER_SEC CLOCKS_PER_SEC
36 +unsigned long clock(void);
37 +//#define CORETIMETYPE clock_t
38 +#define GETMYTIME(_t) (*_t=clock())
39 #define MYTIMEDIFF(fin,ini) ((fin)-(ini))
40 #define TIMER_RES_DIVIDER 1
41 #define SAMPLE_TIME_IMPLEMENTATION 1
42 -#define EE_TICKS_PER_SEC (CLOCKS_PER_SEC / TIMER_RES_DIVIDER)
43 +#define EE_TICKS_PER_SEC (NSECS_PER_SEC / TIMER_RES_DIVIDER)
45 /** Define Host specific (POSIX), or target specific global time variables. */
46 static CORETIMETYPE start_time_val, stop_time_val;
49 ee_u32 default_num_contexts=1;
53 /* Function : portable_init
54 Target specific initialization code
55 Test for some common mistakes.
57 void portable_init(core_portable *p, int *argc, char *argv[])
59 - #error "Call board initialization routines in portable init (if needed), in particular initialize UART!\n"
62 if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) {
63 ee_printf("ERROR! Please define ee_ptr_int to a type that holds a pointer!\n");
72 +__sfr __at 0x00 Exec_port;
73 +__sfr __at 0x01 StorOpc_port;
75 +volatile CORE_TICKS ticks;
79 + // Setup tick interrupt.
80 + StorOpc_port = 0x0f; // Set tick opcode
81 + Exec_port = 10; // Once every 10 ms.
83 + StorOpc_port = 0x0e; // Set interrupt opcode
84 + Exec_port = 0x02; // Tick interrupt only.
97 +CORE_TICKS clock(void)
102 + while (ret != ticks);
106 +#if defined(__SDCC) && __SDCC_REVISION < 9624 // Old SDCC weirdness
107 +void putchar (char c)
112 + StorOpc_port = 0x1;
124 + StorOpc_port = 0x1;
133 diff -u coremark_v1.0/core_portme.h coremark-z80/core_portme.h
134 --- coremark_v1.0/core_portme.h 2021-07-05 11:44:20.727282106 +0200
135 +++ coremark-z80/core_portme.h 2021-07-05 11:08:00.831561745 +0200
137 Define to 1 if the platform supports floating point.
143 /* Configuration : HAS_TIME_H
144 Define to 1 if platform has the time.h header file,
145 and implementation of functions thereof.
148 -#define HAS_TIME_H 1
149 +#define HAS_TIME_H 0
151 /* Configuration : USE_CLOCK
152 Define to 1 if platform has the time.h header file,
153 and implementation of functions thereof.
159 /* Configuration : HAS_STDIO
160 Define to 1 if the platform has stdio.h.
162 Define to 1 if the platform has stdio.h and implements the printf function.
165 -#define HAS_PRINTF 0
166 +#define HAS_PRINTF 1
170 +/* Configuration : CORE_TICKS
171 + Define type of return from the timing functions.
174 +//typedef clock_t CORE_TICKS;
175 +typedef unsigned long CORE_TICKS;
176 +CORE_TICKS clock(void);
177 +/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
178 + Initialize these strings per platform
180 /* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
181 Initialize these strings per platform
186 #ifndef COMPILER_FLAGS
187 - #define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
188 + #define COMPILER_FLAGS "Please put compiler flags here (e.g. -o3)"
191 #define MEM_LOCATION "STACK"
194 ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
196 -typedef signed short ee_s16;
197 -typedef unsigned short ee_u16;
198 -typedef signed int ee_s32;
199 -typedef double ee_f32;
200 -typedef unsigned char ee_u8;
201 -typedef unsigned int ee_u32;
202 -typedef ee_u32 ee_ptr_int;
207 +typedef int16_t ee_s16;
208 +typedef uint16_t ee_u16;
209 +typedef int32_t ee_s32;
210 +typedef float ee_f32;
211 +typedef uint8_t ee_u8;
212 +typedef uint32_t ee_u32;
213 +typedef uintptr_t ee_ptr_int;
214 typedef size_t ee_size_t;
215 -#define NULL ((void *)0)
217 This macro is used to align an offset to point to a 32b value. It is used in the Matrix algorithm to initialize the input memory blocks.
220 Define type of return from the timing functions.
222 #define CORETIMETYPE ee_u32
223 -typedef ee_u32 CORE_TICKS;
224 +//typedef ee_u32 CORE_TICKS;
226 /* Configuration : SEED_METHOD
227 Defines method to get seed values that cannot be computed at compile time.
229 This flag only matters if MULTITHREAD has been defined to a value greater then 1.
231 #ifndef MAIN_HAS_NOARGC
232 -#define MAIN_HAS_NOARGC 0
233 +#define MAIN_HAS_NOARGC 1
236 /* Configuration : MAIN_HAS_NORETURN
238 1 - platform does not support returning a value from main
240 #ifndef MAIN_HAS_NORETURN
241 -#define MAIN_HAS_NORETURN 0
242 +#define MAIN_HAS_NORETURN 1
245 /* Variable : default_num_contexts
246 Nur in coremark_v1.0: core_portme.mak.
247 Nur in coremark-z80: crt0.s.
248 Gemeinsame Unterverzeichnisse: coremark_v1.0/cygwin und coremark-z80/cygwin.
249 Gemeinsame Unterverzeichnisse: coremark_v1.0/docs und coremark-z80/docs.
250 Gemeinsame Unterverzeichnisse: coremark_v1.0/linux und coremark-z80/linux.
251 Gemeinsame Unterverzeichnisse: coremark_v1.0/linux64 und coremark-z80/linux64.
252 diff -u coremark_v1.0/Makefile coremark-z80/Makefile
253 --- coremark_v1.0/Makefile 2009-07-10 19:48:43.000000000 +0200
254 +++ coremark-z80/Makefile 2021-07-05 11:08:00.831561745 +0200
256 -#Author : Shay Gal-On, EEMBC
258 -#This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009
259 -#All rights reserved.
261 -#EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the
262 -#CoreMark License that is distributed with the official EEMBC COREMARK Software release.
263 -#If you received this EEMBC CoreMark Software without the accompanying CoreMark License,
264 -#you must discontinue use and download the official release from www.coremark.org.
266 -#Also, if you are publicly displaying scores generated from the EEMBC CoreMark software,
267 -#make sure that you are in compliance with Run and Reporting rules specified in the accompanying readme.txt file.
270 -#4354 Town Center Blvd. Suite 114-200
271 -#El Dorado Hills, CA, 95762
274 -# Make sure the default target is to simply build and run the benchmark.
278 -run: $(OUTFILE) rerun score
281 - @echo "Check run1.log and run2.log for results."
282 - @echo "See readme.txt for run and reporting rules."
285 -# Ports for a couple of common self hosted platforms
286 -UNAME=$(shell if [[ `uname 2> /dev/null` ]] ; then uname ; fi)
287 -ifneq (,$(findstring CYGWIN,$(UNAME)))
290 -ifneq (,$(findstring Linux,$(UNAME)))
291 -MACHINE=$(shell uname -m)
292 -ifneq (,$(findstring 64,$(MACHINE)))
300 -$(error PLEASE define PORT_DIR! (e.g. make PORT_DIR=simple))
302 -vpath %.c $(PORT_DIR)
303 -vpath %.h $(PORT_DIR)
304 -vpath %.mak $(PORT_DIR)
305 -include $(PORT_DIR)/core_portme.mak
307 -ifndef $(ITERATIONS)
311 -FORCE_REBUILD=force_rebuild
314 -CFLAGS += -DITERATIONS=$(ITERATIONS)
316 -CORE_FILES = core_list_join core_main core_matrix core_state core_util
317 -ORIG_SRCS = $(addsuffix .c,$(CORE_FILES))
318 -SRCS = $(ORIG_SRCS) $(PORT_SRCS)
319 -OBJS = $(addprefix $(OPATH),$(addsuffix $(OEXT),$(CORE_FILES)) $(PORT_OBJS))
320 -OUTNAME = coremark$(EXE)
321 -OUTFILE = $(OPATH)$(OUTNAME)
322 -LOUTCMD = $(OFLAG) $(OUTFILE) $(LFLAGS_END)
323 -OUTCMD = $(OUTFLAG) $(OUTFILE) $(LFLAGS_END)
325 -HEADERS = coremark.h
326 -CHECK_FILES = $(ORIG_SRCS) $(HEADERS)
331 -.PHONY: compile link
332 -ifdef SEPARATE_COMPILE
333 -$(OPATH)$(PORT_DIR):
334 - $(MKDIR) $(OPATH)$(PORT_DIR)
336 -compile: $(OPATH) $(OPATH)$(PORT_DIR) $(OBJS) $(HEADERS)
338 - $(LD) $(LFLAGS) $(XLFLAGS) $(OBJS) $(LOUTCMD)
342 -compile: $(OPATH) $(SRCS) $(HEADERS)
343 - $(CC) $(CFLAGS) $(XCFLAGS) $(SRCS) $(OUTCMD)
345 - @echo "Link performed along with compile"
349 -$(OUTFILE): $(SRCS) $(HEADERS) Makefile core_portme.mak $(FORCE_REBUILD)
350 - $(MAKE) port_prebuild
352 - $(MAKE) port_postbuild
356 - $(MAKE) XCFLAGS="$(XCFLAGS) -DPERFORMANCE_RUN=1" load run1.log
357 - $(MAKE) XCFLAGS="$(XCFLAGS) -DVALIDATION_RUN=1" load run2.log
359 -PARAM1=$(PORT_PARAMS) 0x0 0x0 0x66 $(ITERATIONS)
360 -PARAM2=$(PORT_PARAMS) 0x3415 0x3415 0x66 $(ITERATIONS)
361 -PARAM3=$(PORT_PARAMS) 8 8 8 $(ITERATIONS)
363 -run1.log-PARAM=$(PARAM1) 7 1 2000
364 -run2.log-PARAM=$(PARAM2) 7 1 2000
365 -run3.log-PARAM=$(PARAM3) 7 1 1200
367 -run1.log run2.log run3.log: load
368 - $(MAKE) port_prerun
369 - $(RUN) $(OUTFILE) $($(@)-PARAM) > $(OPATH)$@
370 - $(MAKE) port_postrun
372 -.PHONY: gen_pgo_data
373 -gen_pgo_data: run3.log
377 - $(MAKE) port_preload
379 - $(MAKE) port_postload
380 +SOURCES = core_list_join.c core_main.c core_matrix.c core_state.c core_util.c core_portme.c
381 +OBJ = crt0.rel $(SOURCES:.c=.rel)
389 - rm -f $(OUTFILE) $(OPATH)*.log *.info $(OPATH)index.html $(PORT_CLEAN)
390 + rm -f *.ihx *.lnk *.lst *.noi *.rel *.sym *.size *.dot *.lk *.rst *.asm
393 + $(SDCC) -c --std-c99 --fverbose-asm $(SDCCFLAGS) --fverbose-asm $< ||:
396 + $(SDAS) -plosgff $<
399 + $(SDCC) $(SDCCFLAGS) --no-std-crt0 $(OBJ) -o image.ihx
401 -.PHONY: force_rebuild
403 - echo "Forcing Rebuild"
407 - md5sum -c coremark.md5
410 -# Targets related to testing and releasing CoreMark. Not part of the general release!
411 -include Makefile.internal
413 Gemeinsame Unterverzeichnisse: coremark_v1.0/simple und coremark-z80/simple.