diff --git a/barebones/core_portme.c b/barebones/core_portme.c index 30112ff..113e189 100644 --- a/barebones/core_portme.c +++ b/barebones/core_portme.c @@ -44,8 +44,7 @@ volatile ee_s32 seed5_volatile = 0; CORETIMETYPE barebones_clock() { -#error \ - "You must implement a method to measure time in barebones_clock()! This function should return current time.\n" + return time(); } /* Define : TIMER_RES_DIVIDER Divider to trade off timer resolution and total time that can be @@ -129,8 +128,10 @@ ee_u32 default_num_contexts = 1; void portable_init(core_portable *p, int *argc, char *argv[]) { +/* #error \ "Call board initialization routines in portable init (if needed), in particular initialize UART!\n" +*/ (void)argc; // prevent unused warning (void)argv; // prevent unused warning diff --git a/barebones/core_portme.h b/barebones/core_portme.h index b221363..74b91ab 100644 --- a/barebones/core_portme.h +++ b/barebones/core_portme.h @@ -21,6 +21,17 @@ Original Author: Shay Gal-on */ #ifndef CORE_PORTME_H #define CORE_PORTME_H + +#include "tpl_os.h" +#include "stddef.h" +#define COMPILER_FLAGS "Unknown" +#define MAIN_HAS_NOARGC 1 +#define MEM_METHOD MEM_STATIC +#define CLOCKS_PER_SEC 1 +#define HAS_FLOAT 0 +extern uint32 time(void); +extern void __nop(void); + /************************/ /* Data types and settings */ /************************/ diff --git a/core_main.c b/core_main.c index a4beeb6..ed42640 100644 --- a/core_main.c +++ b/core_main.c @@ -21,6 +21,13 @@ Original Author: Shay Gal-on initial parameters, tun t he benchmark and report the results. */ #include "coremark.h" +//#define ee_printf(...) printf(__VA_ARGS__) +#include +#define ee_printf(...) __nop() +extern uint8 shared_memory[16][16]; +extern uint8 result_array[4][17]; +extern void float_to_char(uint8 input_array[], float input); +extern void int_to_char(uint8 input_array[], int input); /* Function: iterate Run the benchmark for a specified number of iterations. @@ -48,6 +55,9 @@ static ee_u16 state_known_crc[] = { (ee_u16)0x5e47, (ee_u16)0xe5a4, (ee_u16)0x8e3a, (ee_u16)0x8d84 }; + +extern void print(uint8* data); + void * iterate(void *pres) { @@ -68,6 +78,13 @@ iterate(void *pres) res->crc = crcu16(crc, res->crc); if (i == 0) res->crclist = res->crc; +#ifdef COREMARK_DEBUG + if( (i%100) == 0 ) { + int_to_char((uint8*)&result_array[0], i); + strncpy ((char*)&shared_memory[ 3], "Iterate Num: " , 16); + strncpy ((char*)&shared_memory[ 4], (char*)result_array[0] , 16); + } +#endif } return NULL; } @@ -106,13 +123,13 @@ char *mem_name[3] = { "Static", "Heap", "Stack" }; #if MAIN_HAS_NOARGC MAIN_RETURN_TYPE -main(void) +coremark_main(void) { int argc = 0; char *argv[1]; #else MAIN_RETURN_TYPE -main(int argc, char *argv[]) +coremark_main(int argc, char *argv[]) { #endif ee_u16 i, j = 0, num_algorithms = 0; @@ -120,9 +137,14 @@ main(int argc, char *argv[]) ee_u16 seedcrc = 0; CORE_TICKS total_time; core_results results[MULTITHREAD]; + char buf[17]; #if (MEM_METHOD == MEM_STACK) ee_u8 stack_memblock[TOTAL_DATA_SIZE * MULTITHREAD]; #endif + strncpy ((char*)&shared_memory[0], "CoreMark PROG ", 16); + strncpy ((char*)&shared_memory[1], "is now running ", 16); + print("CoreMark PROG is now running\r\n"); + /* first call any initializations needed */ portable_init(&(results[0].port), &argc, argv); /* First some checks to make sure benchmark will run ok */ @@ -435,6 +457,38 @@ for (i = 0; i < MULTITHREAD; i++) for (i = 0; i < MULTITHREAD; i++) portable_free(results[i].memblock[0]); #endif + + strncpy ((char*)&shared_memory[ 1], "is finished !! ", 16); + strncpy ((char*)&shared_memory[ 2], " ", 16); + strncpy ((char*)&shared_memory[ 3], " ", 16); + strncpy ((char*)&shared_memory[ 4], "Result ", 16); + strncpy ((char*)&shared_memory[ 5], "----------------", 16); + strncpy ((char*)&shared_memory[ 6], "CoreMark Size ", 16); + int_to_char((uint8*)&result_array[0], results[0].size); + strncpy ((char*)&shared_memory[ 7], (char*)result_array[0] , 16); + strncpy ((char*)&shared_memory[ 8], "Total ticks ", 16); + int_to_char((uint8*)&result_array[1], total_time); + strncpy ((char*)&shared_memory[ 9], (char*)result_array[1] , 16); + strncpy ((char*)&shared_memory[10], "Total time(secs)", 16); + int_to_char((uint8*)&result_array[2], time_in_secs(total_time)); + strncpy ((char*)&shared_memory[11], (char*)result_array[2] , 16); + strncpy ((char*)&shared_memory[12], "Iterations/Sec ", 16); + int_to_char((uint8*)&result_array[3], default_num_contexts * results[0].iterations / time_in_secs(total_time) ); + strncpy ((char*)&shared_memory[13], (char*)result_array[3] , 16); + strncpy ((char*)&shared_memory[14], " ", 16); + strncpy ((char*)&shared_memory[15], " ", 16); + + buf[17] = '\0'; + for(i=0; i<16;++i){ + strncpy(buf, (char*)shared_memory[i], 16); + ee_printf("%s", buf); + print(buf); + if (i != 0) + { + print("\r\n"); + } + } + /* And last call any target specific code for finalizing */ portable_fini(&(results[0].port)); diff --git a/core_util.c b/core_util.c index 67c5d77..48b0c44 100644 --- a/core_util.c +++ b/core_util.c @@ -17,6 +17,7 @@ Original Author: Shay Gal-on */ #include "coremark.h" +#define ee_printf(...) __nop() /* Function: get_seed Get a values that cannot be determined at compile time.