From b01025c5831effdc8da8c94e740f27075afea1d6 Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:54:15 +0100 Subject: [PATCH 1/9] Change to issue 71 using suggestion from Philipp Klaus Krause --- barebones/core_portme.c | 2 +- posix/core_portme.c | 2 +- simple/core_portme.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/barebones/core_portme.c b/barebones/core_portme.c index 30112ff..b5c946c 100644 --- a/barebones/core_portme.c +++ b/barebones/core_portme.c @@ -135,7 +135,7 @@ portable_init(core_portable *p, int *argc, char *argv[]) (void)argc; // prevent unused warning (void)argv; // prevent unused warning - if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) + if (sizeof(ee_ptr_int) < sizeof(ee_u8 *)) { ee_printf( "ERROR! Please define ee_ptr_int to a type that holds a " diff --git a/posix/core_portme.c b/posix/core_portme.c index 7fef9c9..76dcac4 100644 --- a/posix/core_portme.c +++ b/posix/core_portme.c @@ -219,7 +219,7 @@ portable_init(core_portable *p, int *argc, char *argv[]) (void)argc; // prevent unused warning (void)argv; // prevent unused warning - if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) + if (sizeof(ee_ptr_int) < sizeof(ee_u8 *)) { ee_printf( "ERROR! Please define ee_ptr_int to a type that holds a " diff --git a/simple/core_portme.c b/simple/core_portme.c index 7326990..0bd3e59 100644 --- a/simple/core_portme.c +++ b/simple/core_portme.c @@ -131,7 +131,7 @@ portable_init(core_portable *p, int *argc, char *argv[]) (void)argc; // prevent unused warning (void)argv; // prevent unused warning - if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) + if (sizeof(ee_ptr_int) < sizeof(ee_u8 *)) { ee_printf( "ERROR! Please define ee_ptr_int to a type that holds a " From a869958b214f307d18f626c6bc65a0329c40e6aa Mon Sep 17 00:00:00 2001 From: Joseph <77114984+joseph-yiu@users.noreply.github.com> Date: Tue, 7 Jul 2026 09:32:33 +0100 Subject: [PATCH 2/9] Align description with the fix for MCS51 --- barebones_porting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barebones_porting.md b/barebones_porting.md index 3d08882..453f9dc 100644 --- a/barebones_porting.md +++ b/barebones_porting.md @@ -156,7 +156,7 @@ portable_init(core_portable *p, int *argc, char *argv[]) cache_init(); timer_config(); - if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) + if (sizeof(ee_ptr_int) < sizeof(ee_u8 *)) { ee_printf( "ERROR! Please define ee_ptr_int to a type that holds a " From 03295afe1fd0f35424a59eee7ae8efb223507504 Mon Sep 17 00:00:00 2001 From: Joseph <77114984+joseph-yiu@users.noreply.github.com> Date: Tue, 7 Jul 2026 09:41:32 +0100 Subject: [PATCH 3/9] Add header for size_t in barebones/core_portme.h --- barebones/core_portme.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/barebones/core_portme.h b/barebones/core_portme.h index ef285df..7d3fb81 100644 --- a/barebones/core_portme.h +++ b/barebones/core_portme.h @@ -84,6 +84,9 @@ Original Author: Shay Gal-on ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! */ + +#include /* Note: Required for size_t */ + typedef signed short ee_s16; typedef unsigned short ee_u16; typedef signed int ee_s32; From a0a29fd6ef8ef8e8ff8d3e0718b9d2643513ef7d Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:48:06 +0100 Subject: [PATCH 4/9] Add changes to match updates in https://github.com/joseph-yiu/coremark_mcs51 --- README.md | 37 +++++++++++++++++++++++++++++++++++++ barebones/core_portme.h | 30 ++++++++++++++++++++++++++++-- core_list_join.c | 32 ++++++++++++++++++-------------- core_main.c | 29 ++++++++++++++++++++--------- core_util.c | 8 ++++---- coremark.h | 15 +++++++++++++-- simple/core_portme.h | 2 +- 7 files changed, 121 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index bc1abed..c7bc0b7 100644 --- a/README.md +++ b/README.md @@ -397,6 +397,43 @@ Many thanks to all of the individuals who helped with the development or testing * Rob Cosaro, NXP * Shumpei Kawasaki, RENESAS +# Code changes Q3-2026 + +- coremark.h + - "size" element in typedef struct core_results is renamed to datasize to workaround a limitation in Keil C51 compiler. + In this compiler, "size", "data", "pdata" are considered reserved keywords and cannot be used by the program code + as names for variables. + - Update function prototype for crcu8 function from core_util.c due to change in input parameter name. + - Add HAS_C99 macro, and add inttypes.h if the compiler supports C99 (HAS_C99 set to 1) +- core_main.c: + - Various code changes in main() due to "size" renamed to "datasize" in core_results structure. + - Adding STATIC_MEMBLK_ATTR macro for sttribute of the static_memblk[TOTAL_DATA_SIZE] + - This allows static_memblk[] to be declared as xdata when using MCS51 architecture. + - This also addressed the request in https://github.com/eembc/coremark/pull/58 + - Update result report to use the new HAS_C99 macro to select if PRIu32 format specifier can be used. +- core_util.c: + - crcu8 function: input parameter is renamed from "data" to "newval" to allow the code to be compiled by Keil C51 + - This change also align crcu8 function with other crc functions where the first parameters are named as "newval" + - check_data_types function: update the comparison between size of pointer and size of integer ee_ptr_int + - This change remove the error message. +- core_list_join.c + - Adding __COREMARK_REENTRANT macro + - This macro is added to support MCS51 architecture. When using MCS51 architecture, by default the C compiler allocate + variables in functions with fixed address. This causes problems to functions that can be reentrant. + This problem can be worked around by adding a reentrant function attribute, and this attribute is compiler specific. + By declaring the __COREMARK_REENTRANT macro, users can define the compiler specific reentrant attribute easily. + The __COREMARK_REENTRANT macro is defined for function pointers "*list_cmp" and "*core_list_mergesort". + - clac_func function: Several variable/parameter names are changed to work around the limitations in Keil C51 compiler. + The name changes incuded: + - parameter *pdata changed to *ptr_data + - variable data changed to curr_data + - res->size changed to res->datasize +- barebones/core_portme.h + - Add stdint.h and change the following mapping. + - ee_s32 to int32_t (it was "signed int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) + - ee_u32 to uint32_t (it was "unsigned int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) + + # Legal Please refer to LICENSE.md in this repository for a description of your rights to use this code. diff --git a/barebones/core_portme.h b/barebones/core_portme.h index 7d3fb81..6b3267d 100644 --- a/barebones/core_portme.h +++ b/barebones/core_portme.h @@ -76,20 +76,36 @@ Original Author: Shay Gal-on #define MEM_LOCATION "STACK" #endif +#ifdef __C51__ +/* Example: Additional settings for Keil C51 Compiler */ +#define __COREMARK_REENTRANT reentrant +#define MEM_METHOD MEM_STATIC +#define MEM_STATIC_ATTR xdata +#define HAS_C99 0 +#endif + +#ifdef __SDCC +/* Example: Additional settings for SDCC Compiler */ +#define __COREMARK_REENTRANT __reentrant +#define MEM_METHOD MEM_STATIC +#define MEM_STATIC_ATTR __xdata +#endif + /* Data Types : To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in . - *Imprtant* : + *Important* : ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! */ #include /* Note: Required for size_t */ +#include typedef signed short ee_s16; typedef unsigned short ee_u16; -typedef signed int ee_s32; +typedef int32_t ee_s32; typedef float ee_f32; typedef unsigned char ee_u8; typedef unsigned int ee_u32; @@ -99,9 +115,19 @@ typedef size_t ee_size_t; /* align_mem : 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. + + Example for Keil C51 + #define align_mem(x) \ + ((void xdata *)((((unsigned int)(void xdata *)(x)) + 3u) & 0xFFFCu)) + + Example for SDCC + #define align_mem(x) \ + ((void __xdata *)((((unsigned int)(void __xdata *)(x)) + 3u) & 0xFFFCu)) + */ #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x)-1) & ~3)) + /* Configuration : CORE_TICKS Define type of return from the timing functions. */ diff --git a/core_list_join.c b/core_list_join.c index 5d76b4d..f2bf040 100644 --- a/core_list_join.c +++ b/core_list_join.c @@ -48,6 +48,10 @@ input for the operation. */ +#ifndef __COREMARK_REENTRANT +#define __COREMARK_REENTRANT +#endif + /* local functions */ list_head *core_list_find(list_head *list, list_data *info); @@ -61,26 +65,26 @@ list_head *core_list_insert_new(list_head * insert_point, list_data **datablock, list_head * memblock_end, list_data * datablock_end); -typedef ee_s32 (*list_cmp)(list_data *a, list_data *b, core_results *res); +typedef ee_s32 (*list_cmp)(list_data *a, list_data *b, core_results *res) __COREMARK_REENTRANT; list_head *core_list_mergesort(list_head * list, list_cmp cmp, - core_results *res); + core_results *res) __COREMARK_REENTRANT; ee_s16 -calc_func(ee_s16 *pdata, core_results *res) +calc_func(ee_s16 *ptr_data, core_results *res) { - ee_s16 data = *pdata; + ee_s16 curr_data = *ptr_data; ee_s16 retval; ee_u8 optype - = (data >> 7) + = (curr_data >> 7) & 1; /* bit 7 indicates if the function result has been cached */ if (optype) /* if cached, use cache */ - return (data & 0x007f); + return (curr_data & 0x007f); else { /* otherwise calculate and cache the result */ - ee_s16 flag = data & 0x7; /* bits 0-2 is type of function to perform */ + ee_s16 flag = curr_data & 0x7; /* bits 0-2 is type of function to perform */ ee_s16 dtype - = ((data >> 3) + = ((curr_data >> 3) & 0xf); /* bits 3-6 is specific data for the operation */ dtype |= dtype << 4; /* replicate the lower 4 bits to get an 8b value */ switch (flag) @@ -88,7 +92,7 @@ calc_func(ee_s16 *pdata, core_results *res) case 0: if (dtype < 0x22) /* set min period for bit corruption */ dtype = 0x22; - retval = core_bench_state(res->size, + retval = core_bench_state(res->datasize, res->memblock[3], res->seed1, res->seed2, @@ -103,12 +107,12 @@ calc_func(ee_s16 *pdata, core_results *res) res->crcmatrix = retval; break; default: - retval = data; + retval = curr_data; break; } res->crc = crcu16(retval, res->crc); retval &= 0x007f; - *pdata = (data & 0xff00) | 0x0080 | retval; /* cache the result */ + *ptr_data = (curr_data & 0xff00) | 0x0080 | retval; /* cache the result */ return retval; } } @@ -118,7 +122,7 @@ calc_func(ee_s16 *pdata, core_results *res) Can be used by mergesort. */ ee_s32 -cmp_complex(list_data *a, list_data *b, core_results *res) +cmp_complex(list_data *a, list_data *b, core_results *res) __COREMARK_REENTRANT { ee_s16 val1 = calc_func(&(a->data16), res); ee_s16 val2 = calc_func(&(b->data16), res); @@ -131,7 +135,7 @@ cmp_complex(list_data *a, list_data *b, core_results *res) Can be used by mergesort. */ ee_s32 -cmp_idx(list_data *a, list_data *b, core_results *res) +cmp_idx(list_data *a, list_data *b, core_results *res) __COREMARK_REENTRANT { if (res == NULL) { @@ -497,7 +501,7 @@ core_list_reverse(list_head *list) */ list_head * -core_list_mergesort(list_head *list, list_cmp cmp, core_results *res) +core_list_mergesort(list_head *list, list_cmp cmp, core_results *res) __COREMARK_REENTRANT { list_head *p, *q, *e, *tail; ee_s32 insize, nmerges, psize, qsize, i; diff --git a/core_main.c b/core_main.c index 0190abd..70eef4e 100644 --- a/core_main.c +++ b/core_main.c @@ -82,8 +82,12 @@ ee_s32 get_seed_32(int i); #endif #if (MEM_METHOD == MEM_STATIC) +#ifdef STATIC_MEMBLK_ATTR +STATIC_MEMBLK_ATTR ee_u8 static_memblk[TOTAL_DATA_SIZE]; +#else ee_u8 static_memblk[TOTAL_DATA_SIZE]; #endif +#endif char *mem_name[3] = { "Static", "Heap", "Stack" }; /* Function: main Main entry routine for the benchmark. @@ -160,7 +164,7 @@ main(int argc, char *argv[]) } #if (MEM_METHOD == MEM_STATIC) results[0].memblock[0] = (void *)static_memblk; - results[0].size = TOTAL_DATA_SIZE; + results[0].datasize = TOTAL_DATA_SIZE; results[0].err = 0; #if (MULTITHREAD > 1) #error "Cannot use a static data area with multiple contexts!" @@ -202,7 +206,7 @@ for (i = 0; i < MULTITHREAD; i++) num_algorithms++; } for (i = 0; i < MULTITHREAD; i++) - results[i].size = results[i].size / num_algorithms; + results[i].datasize = results[i].datasize / num_algorithms; /* Assign pointers */ for (i = 0; i < NUM_ALGORITHMS; i++) { @@ -211,7 +215,7 @@ for (i = 0; i < MULTITHREAD; i++) { for (ctx = 0; ctx < MULTITHREAD; ctx++) results[ctx].memblock[i + 1] - = (char *)(results[ctx].memblock[0]) + results[0].size * j; + = (char *)(results[ctx].memblock[0]) + results[0].datasize * j; j++; } } @@ -221,11 +225,11 @@ for (i = 0; i < MULTITHREAD; i++) if (results[i].execs & ID_LIST) { results[i].list = core_list_init( - results[0].size, results[i].memblock[1], results[i].seed1); + results[0].datasize, results[i].memblock[1], results[i].seed1); } if (results[i].execs & ID_MATRIX) { - core_init_matrix(results[0].size, + core_init_matrix(results[0].datasize, results[i].memblock[2], (ee_s32)results[i].seed1 | (((ee_s32)results[i].seed2) << 16), @@ -234,7 +238,7 @@ for (i = 0; i < MULTITHREAD; i++) if (results[i].execs & ID_STATE) { core_init_state( - results[0].size, results[i].seed1, results[i].memblock[3]); + results[0].datasize, results[i].seed1, results[i].memblock[3]); } } @@ -287,8 +291,7 @@ for (i = 0; i < MULTITHREAD; i++) seedcrc = crc16(results[0].seed1, seedcrc); seedcrc = crc16(results[0].seed2, seedcrc); seedcrc = crc16(results[0].seed3, seedcrc); - seedcrc = crc16(results[0].size, seedcrc); - + seedcrc = crc16(results[0].datasize, seedcrc); switch (seedcrc) { /* test known output for common seeds */ case 0x8a02: /* seed1=0, seed2=0, seed3=0x66, size 2000 per algorithm */ @@ -355,7 +358,7 @@ for (i = 0; i < MULTITHREAD; i++) } total_errors += check_data_types(); /* and report results */ - ee_printf("CoreMark Size : %lu\n", (long unsigned)results[0].size); + ee_printf("CoreMark Size : %lu\n", (long unsigned)results[0].datasize); ee_printf("Total ticks : %lu\n", (long unsigned)total_time); #if HAS_FLOAT ee_printf("Total time (secs): %f\n", time_in_secs(total_time)); @@ -364,11 +367,19 @@ for (i = 0; i < MULTITHREAD; i++) default_num_contexts * results[0].iterations / time_in_secs(total_time)); #else +#if HAS_C99 ee_printf("Total time (secs): %"PRIu32"\n", time_in_secs(total_time)); if (time_in_secs(total_time) > 0) ee_printf("Iterations/Sec : %"PRIu32"\n", default_num_contexts * results[0].iterations / time_in_secs(total_time)); +#else + ee_printf("Total time (secs): %d\n", (int)time_in_secs(total_time)); + if (time_in_secs(total_time) > 0) + ee_printf("Iterations/Sec : %d\n", (int) ( + default_num_contexts * results[0].iterations + / time_in_secs(total_time))); +#endif #endif if (time_in_secs(total_time) < 10) { diff --git a/core_util.c b/core_util.c index 67c5d77..2ab019e 100644 --- a/core_util.c +++ b/core_util.c @@ -162,14 +162,14 @@ get_seed_32(int i) */ ee_u16 -crcu8(ee_u8 data, ee_u16 crc) +crcu8(ee_u8 newval, ee_u16 crc) { ee_u8 i = 0, x16 = 0, carry = 0; for (i = 0; i < 8; i++) { - x16 = (ee_u8)((data & 1) ^ ((ee_u8)crc & 1)); - data >>= 1; + x16 = (ee_u8)((newval & 1) ^ ((ee_u8)crc & 1)); + newval >>= 1; if (x16 == 1) { @@ -235,7 +235,7 @@ check_data_types() ee_printf("ERROR: ee_u32 is not a 32b datatype!\n"); retval++; } - if (sizeof(ee_ptr_int) != sizeof(int *)) + if (sizeof(ee_ptr_int) < sizeof(int *)) { ee_printf( "ERROR: ee_ptr_int is not a datatype that holds an int pointer!\n"); diff --git a/coremark.h b/coremark.h index 2a9a3ac..258e091 100644 --- a/coremark.h +++ b/coremark.h @@ -41,8 +41,15 @@ Original Author: Shay Gal-on #include #endif #if HAS_PRINTF +#ifndef HAS_C99 +/* Support C99 by default */ +#define HAS_C99 1 +#endif + +#if HAS_C99 /* Adding inttypes.h (C99) to support PRIu32 in printf */ #include +#endif #define ee_printf printf #endif @@ -67,13 +74,17 @@ typedef ee_u32 secs_ret; #define MAIN_RETURN_TYPE int #endif +#ifndef __COREMARK_REENTRANT +#define __COREMARK_REENTRANT +#endif + void start_time(void); void stop_time(void); CORE_TICKS get_time(void); secs_ret time_in_secs(CORE_TICKS ticks); /* Misc useful functions */ -ee_u16 crcu8(ee_u8 data, ee_u16 crc); +ee_u16 crcu8(ee_u8 newval, ee_u16 crc); ee_u16 crc16(ee_s16 newval, ee_u16 crc); ee_u16 crcu16(ee_u16 newval, ee_u16 crc); ee_u16 crcu32(ee_u32 newval, ee_u16 crc); @@ -143,7 +154,7 @@ typedef struct RESULTS_S ee_s16 seed2; /* Initializing seed */ ee_s16 seed3; /* Initializing seed */ void * memblock[4]; /* Pointer to safe memory location */ - ee_u32 size; /* Size of the data */ + ee_u32 datasize; /* Size of the data */ ee_u32 iterations; /* Number of iterations to execute */ ee_u32 execs; /* Bitmask of operations to execute */ struct list_head_s *list; diff --git a/simple/core_portme.h b/simple/core_portme.h index bc937ec..ce5abc8 100644 --- a/simple/core_portme.h +++ b/simple/core_portme.h @@ -87,7 +87,7 @@ typedef clock_t CORE_TICKS; To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in . - *Imprtant* : + *Important* : ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! */ From 543f0a119f0ad706f278c615f82e40ee8d109b9b Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Fri, 14 Aug 2026 08:06:03 +0100 Subject: [PATCH 5/9] Update data type for ee_u32 to ensure it is 32-bit --- barebones/core_portme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barebones/core_portme.h b/barebones/core_portme.h index 6b3267d..9cfd679 100644 --- a/barebones/core_portme.h +++ b/barebones/core_portme.h @@ -108,7 +108,7 @@ typedef unsigned short ee_u16; typedef int32_t ee_s32; typedef float ee_f32; typedef unsigned char ee_u8; -typedef unsigned int ee_u32; +typedef uint32_t ee_u32; typedef ee_u32 ee_ptr_int; typedef size_t ee_size_t; #define NULL ((void *)0) From d89da023201beb4ae37091d5d685690568e7e7d2 Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Fri, 14 Aug 2026 08:55:35 +0100 Subject: [PATCH 6/9] Fix typo in comment --- posix/core_portme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posix/core_portme.h b/posix/core_portme.h index dcde840..78fef91 100644 --- a/posix/core_portme.h +++ b/posix/core_portme.h @@ -105,7 +105,7 @@ typedef clock_t CORE_TICKS; To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in . - *Imprtant*: + *Important*: ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! */ From 60e4f1ba64c354084a862544c07b74a571c63ae1 Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Fri, 14 Aug 2026 08:58:02 +0100 Subject: [PATCH 7/9] Use int32_t and uint32_t for ee_s32, ee_u32 --- barebones/core_portme.h | 2 +- posix/core_portme.h | 7 ++++--- simple/core_portme.h | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/barebones/core_portme.h b/barebones/core_portme.h index 9cfd679..5a83557 100644 --- a/barebones/core_portme.h +++ b/barebones/core_portme.h @@ -101,7 +101,7 @@ Original Author: Shay Gal-on */ #include /* Note: Required for size_t */ -#include +#include /* Note: Required for int32_t and uint32_t */ typedef signed short ee_s16; typedef unsigned short ee_u16; diff --git a/posix/core_portme.h b/posix/core_portme.h index 78fef91..981b95b 100644 --- a/posix/core_portme.h +++ b/posix/core_portme.h @@ -99,7 +99,8 @@ typedef clock_t CORE_TICKS; #define MEM_LOCATION_UNSPEC 1 #endif -#include +#include /* Note: Required for size_t */ +#include /* Note: Required for int32_t and uint32_t */ /* Data Types: To avoid compiler issues, define the data types that need ot be used for @@ -111,10 +112,10 @@ typedef clock_t CORE_TICKS; */ typedef signed short ee_s16; typedef unsigned short ee_u16; -typedef signed int ee_s32; +typedef int32_t ee_s32; typedef float ee_f32; typedef unsigned char ee_u8; -typedef unsigned int ee_u32; +typedef uint32_t ee_u32; typedef uintptr_t ee_ptr_int; typedef size_t ee_size_t; /* align an offset to point to a 32b value */ diff --git a/simple/core_portme.h b/simple/core_portme.h index ce5abc8..adb2749 100644 --- a/simple/core_portme.h +++ b/simple/core_portme.h @@ -91,17 +91,29 @@ typedef clock_t CORE_TICKS; ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! */ +#include /* Note: Required for size_t */ +#include /* Note: Required for int32_t and uint32_t */ + typedef signed short ee_s16; typedef unsigned short ee_u16; -typedef signed int ee_s32; +typedef int32_t ee_s32; typedef float ee_f32; typedef unsigned char ee_u8; -typedef unsigned int ee_u32; +typedef uint32_t ee_u32; typedef ee_u32 ee_ptr_int; typedef size_t ee_size_t; /* align_mem : 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. + + Example for Keil C51 + #define align_mem(x) \ + ((void xdata *)((((unsigned int)(void xdata *)(x)) + 3u) & 0xFFFCu)) + + Example for SDCC + #define align_mem(x) \ + ((void __xdata *)((((unsigned int)(void __xdata *)(x)) + 3u) & 0xFFFCu)) + */ #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x)-1) & ~3)) From e392b3282407dbe1387d5588f21f78ff82d0c75c Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Fri, 14 Aug 2026 09:13:07 +0100 Subject: [PATCH 8/9] Update code change decription in README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c7bc0b7..9b19945 100644 --- a/README.md +++ b/README.md @@ -428,10 +428,10 @@ Many thanks to all of the individuals who helped with the development or testing - parameter *pdata changed to *ptr_data - variable data changed to curr_data - res->size changed to res->datasize -- barebones/core_portme.h - - Add stdint.h and change the following mapping. - - ee_s32 to int32_t (it was "signed int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) - - ee_u32 to uint32_t (it was "unsigned int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) +- core_portme.h in barebones, simple and posix + - Data type : Added stdint.h and changed the following mapping. + - Maps ee_s32 to int32_t (it was "signed int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) + - Maps ee_u32 to uint32_t (it was "unsigned int" but this could maps to 16-bit integer in 8-bit and 16-bit architectures) # Legal From 2aefd37299f0f08b69f733321eef061f9d72a3b0 Mon Sep 17 00:00:00 2001 From: Joseph Yiu <77114984+joseph-yiu@users.noreply.github.com> Date: Tue, 18 Aug 2026 10:07:28 +0100 Subject: [PATCH 9/9] Fix left over size variable rename issues --- core_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core_main.c b/core_main.c index 70eef4e..861624e 100644 --- a/core_main.c +++ b/core_main.c @@ -174,10 +174,10 @@ main(int argc, char *argv[]) { ee_s32 malloc_override = get_seed(7); if (malloc_override != 0) - results[i].size = malloc_override; + results[i].datasize = malloc_override; else - results[i].size = TOTAL_DATA_SIZE; - results[i].memblock[0] = portable_malloc(results[i].size); + results[i].datasize = TOTAL_DATA_SIZE; + results[i].memblock[0] = portable_malloc(results[i].datasize); results[i].seed1 = results[0].seed1; results[i].seed2 = results[0].seed2; results[i].seed3 = results[0].seed3; @@ -188,7 +188,7 @@ main(int argc, char *argv[]) for (i = 0; i < MULTITHREAD; i++) { results[i].memblock[0] = stack_memblock + i * TOTAL_DATA_SIZE; - results[i].size = TOTAL_DATA_SIZE; + results[i].datasize = TOTAL_DATA_SIZE; results[i].seed1 = results[0].seed1; results[i].seed2 = results[0].seed2; results[i].seed3 = results[0].seed3;