|
| 1 | +/* |
| 2 | +Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC) |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +
|
| 16 | +Original Author: Shay Gal-on |
| 17 | +*/ |
| 18 | + |
| 19 | +/* Topic : Description |
| 20 | + This file contains configuration constants required to execute on |
| 21 | + different platforms |
| 22 | +*/ |
| 23 | +#ifndef CORE_PORTME_H |
| 24 | +#define CORE_PORTME_H |
| 25 | +/************************/ |
| 26 | +/* Data types and settings */ |
| 27 | +/************************/ |
| 28 | +/* Configuration : HAS_FLOAT |
| 29 | + Define to 1 if the platform supports floating point. |
| 30 | +*/ |
| 31 | +#ifndef HAS_FLOAT |
| 32 | +#define HAS_FLOAT 1 |
| 33 | +#endif |
| 34 | +/* Configuration : HAS_TIME_H |
| 35 | + Define to 1 if platform has the time.h header file, |
| 36 | + and implementation of functions thereof. |
| 37 | +*/ |
| 38 | +#ifndef HAS_TIME_H |
| 39 | +#define HAS_TIME_H 1 |
| 40 | +#endif |
| 41 | +/* Configuration : USE_CLOCK |
| 42 | + Define to 1 if platform has the time.h header file, |
| 43 | + and implementation of functions thereof. |
| 44 | +*/ |
| 45 | +#ifndef USE_CLOCK |
| 46 | +#define USE_CLOCK 1 |
| 47 | +#endif |
| 48 | +/* Configuration : HAS_STDIO |
| 49 | + Define to 1 if the platform has stdio.h. |
| 50 | +*/ |
| 51 | +#ifndef HAS_STDIO |
| 52 | +#define HAS_STDIO 1 |
| 53 | +#endif |
| 54 | +/* Configuration : HAS_PRINTF |
| 55 | + Define to 1 if the platform has stdio.h and implements the printf |
| 56 | + function. |
| 57 | +*/ |
| 58 | +#ifndef HAS_PRINTF |
| 59 | +#define HAS_PRINTF 1 |
| 60 | +#endif |
| 61 | + |
| 62 | +/* Configuration : CORE_TICKS |
| 63 | + Define type of return from the timing functions. |
| 64 | + */ |
| 65 | +#include <time.h> |
| 66 | +typedef clock_t CORE_TICKS; |
| 67 | + |
| 68 | +/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION |
| 69 | + Initialize these strings per platform |
| 70 | +*/ |
| 71 | +#ifndef COMPILER_VERSION |
| 72 | +#ifdef __GNUC__ |
| 73 | +#define COMPILER_VERSION "GCC"__VERSION__ |
| 74 | +#else |
| 75 | +#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)" |
| 76 | +#endif |
| 77 | +#endif |
| 78 | +#ifndef COMPILER_FLAGS |
| 79 | +#define COMPILER_FLAGS \ |
| 80 | + FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */ |
| 81 | +#endif |
| 82 | +#ifndef MEM_LOCATION |
| 83 | +#define MEM_LOCATION "STACK" |
| 84 | +#endif |
| 85 | + |
| 86 | +/* Data Types : |
| 87 | + To avoid compiler issues, define the data types that need ot be used for |
| 88 | + 8b, 16b and 32b in <core_portme.h>. |
| 89 | +
|
| 90 | + *Imprtant* : |
| 91 | + ee_ptr_int needs to be the data type used to hold pointers, otherwise |
| 92 | + coremark may fail!!! |
| 93 | +*/ |
| 94 | +typedef signed short ee_s16; |
| 95 | +typedef unsigned short ee_u16; |
| 96 | +typedef signed int ee_s32; |
| 97 | +typedef double ee_f32; |
| 98 | +typedef unsigned char ee_u8; |
| 99 | +typedef unsigned int ee_u32; |
| 100 | +typedef ee_u32 ee_ptr_int; |
| 101 | +typedef size_t ee_size_t; |
| 102 | +/* align_mem : |
| 103 | + This macro is used to align an offset to point to a 32b value. It is |
| 104 | + used in the Matrix algorithm to initialize the input memory blocks. |
| 105 | +*/ |
| 106 | +#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x)-1) & ~3)) |
| 107 | + |
| 108 | +/* Configuration : SEED_METHOD |
| 109 | + Defines method to get seed values that cannot be computed at compile |
| 110 | + time. |
| 111 | +
|
| 112 | + Valid values : |
| 113 | + SEED_ARG - from command line. |
| 114 | + SEED_FUNC - from a system function. |
| 115 | + SEED_VOLATILE - from volatile variables. |
| 116 | +*/ |
| 117 | +#ifndef SEED_METHOD |
| 118 | +#define SEED_METHOD SEED_VOLATILE |
| 119 | +#endif |
| 120 | + |
| 121 | +/* Configuration : MEM_METHOD |
| 122 | + Defines method to get a block of memry. |
| 123 | +
|
| 124 | + Valid values : |
| 125 | + MEM_MALLOC - for platforms that implement malloc and have malloc.h. |
| 126 | + MEM_STATIC - to use a static memory array. |
| 127 | + MEM_STACK - to allocate the data block on the stack (NYI). |
| 128 | +*/ |
| 129 | +#ifndef MEM_METHOD |
| 130 | +#define MEM_METHOD MEM_STACK |
| 131 | +#endif |
| 132 | + |
| 133 | +/* Configuration : MULTITHREAD |
| 134 | + Define for parallel execution |
| 135 | +
|
| 136 | + Valid values : |
| 137 | + 1 - only one context (default). |
| 138 | + N>1 - will execute N copies in parallel. |
| 139 | +
|
| 140 | + Note : |
| 141 | + If this flag is defined to more then 1, an implementation for launching |
| 142 | + parallel contexts must be defined. |
| 143 | +
|
| 144 | + Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> |
| 145 | + to enable them. |
| 146 | +
|
| 147 | + It is valid to have a different implementation of <core_start_parallel> |
| 148 | + and <core_end_parallel> in <core_portme.c>, to fit a particular architecture. |
| 149 | +*/ |
| 150 | +#ifndef MULTITHREAD |
| 151 | +#define MULTITHREAD 1 |
| 152 | +#define USE_PTHREAD 0 |
| 153 | +#define USE_FORK 0 |
| 154 | +#define USE_SOCKET 0 |
| 155 | +#endif |
| 156 | + |
| 157 | +/* Configuration : MAIN_HAS_NOARGC |
| 158 | + Needed if platform does not support getting arguments to main. |
| 159 | +
|
| 160 | + Valid values : |
| 161 | + 0 - argc/argv to main is supported |
| 162 | + 1 - argc/argv to main is not supported |
| 163 | +
|
| 164 | + Note : |
| 165 | + This flag only matters if MULTITHREAD has been defined to a value |
| 166 | + greater then 1. |
| 167 | +*/ |
| 168 | +#ifndef MAIN_HAS_NOARGC |
| 169 | +#define MAIN_HAS_NOARGC 0 |
| 170 | +#endif |
| 171 | + |
| 172 | +/* Configuration : MAIN_HAS_NORETURN |
| 173 | + Needed if platform does not support returning a value from main. |
| 174 | +
|
| 175 | + Valid values : |
| 176 | + 0 - main returns an int, and return value will be 0. |
| 177 | + 1 - platform does not support returning a value from main |
| 178 | +*/ |
| 179 | +#ifndef MAIN_HAS_NORETURN |
| 180 | +#define MAIN_HAS_NORETURN 0 |
| 181 | +#endif |
| 182 | + |
| 183 | +/* Variable : default_num_contexts |
| 184 | + Not used for this simple port, must contain the value 1. |
| 185 | +*/ |
| 186 | +extern ee_u32 default_num_contexts; |
| 187 | + |
| 188 | +typedef struct CORE_PORTABLE_S |
| 189 | +{ |
| 190 | + ee_u8 portable_id; |
| 191 | +} core_portable; |
| 192 | + |
| 193 | +/* target specific init/fini */ |
| 194 | +void portable_init(core_portable *p, int *argc, char *argv[]); |
| 195 | +void portable_fini(core_portable *p); |
| 196 | + |
| 197 | +#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) \ |
| 198 | + && !defined(VALIDATION_RUN) |
| 199 | +#if (TOTAL_DATA_SIZE == 1200) |
| 200 | +#define PROFILE_RUN 1 |
| 201 | +#elif (TOTAL_DATA_SIZE == 2000) |
| 202 | +#define PERFORMANCE_RUN 1 |
| 203 | +#else |
| 204 | +#define VALIDATION_RUN 1 |
| 205 | +#endif |
| 206 | +#endif |
| 207 | + |
| 208 | +#endif /* CORE_PORTME_H */ |
0 commit comments