ameba micropython sdk first commit

This commit is contained in:
xidameng 2020-07-31 22:16:12 +08:00
commit 8508ee6139
5619 changed files with 1874619 additions and 0 deletions

View file

@ -0,0 +1,179 @@
PLEASE READ THIS EEMBC COREMARK SOFTWARE LICENSE AGREEMENT
("LICENSE") BEFORE USING THE EEMBC COREMARK SOFTWARE. BY
USING THE EEMBC COREMARK SOFTWARE, YOU ARE AGREEING TO BE
BOUND BY THE TERMS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE
TERMS OF THIS LICENSE, DO NOT DOWNLOAD OR USE THE EEMBC
COREMARK SOFTWARE.
1. General. The software and documentation accompanying this License whether on
disk, in read only memory, on any other media or in any other form (collectively the
"Software") are licensed, not sold, to you by Embedded Microprocessor Benchmark
Consortium ("EEMBC") for use only under the terms of this License, and EEMBC
reserves all rights not expressly granted to you. The rights granted herein are limited to
EEMBC's members and its licensors' intellectual property rights in the EEMBC
COREMARK Software and do not include any other patents or intellectual property
rights. The terms of this License will govern any software upgrades provided by EEMBC
that replace and/or supplement the original EEMBC COREMARK SOFTWARE
product, unless such upgrade is accompanied by a separate license in which case the terms
of that license will govern.
2. Permitted License Uses and Restrictions. This License allows you to download, install,
and use the EEMBC COREMARK Software only as expressly permitted under this
License. For the avoidance of doubt you may make only that number of copies of the
EEMBC COREMARK Software as are reasonably necessary in order to effectuate the
purposes for which the EEMBC COREMARK Software is intended. You may not make
the EEMBC COREMARK Software available over a network where it could be used by
multiple platforms or multiple users at the same time or for use via data hosting, time
sharing or service bureau usage. Except as and only to the extent expressly permitted in
this License or by applicable law, you may not copy or create derivative works of the
EEMBC COREMARK Software or any part thereof. The EEMBC COREMARK
SOFTWARE is not intended for any inherently dangerous use, including without
limitation for use in the operation of nuclear facilities, aircraft navigation or
communication systems, air traffic control systems, life support machines or other
equipment in which the failure of the EEMBC COREMARK SOFTWARE COULD
LEAD TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR
ENVIRONMENTAL DAMAGE.
3. Transfer. You may not rent, lease, lend, license, sublicense or otherwise transfer any
rights to use or possess the EEMBC COREMARK Software.
4. Enhancements by EEMBC. In the event that at any time EEMBC makes any
enhancement, update, or modification to the EEMBC COREMARK Software or
becomes the owner of any new enhancement, update, or modification to the EEMBC
COREMARK Software, then upon notice to you, EEMBC may in its absolute discretion,
require that you migrate to any such enhancement, update, or modification which shall
automatically and without further action by either EEMBC or you become incorporated
into this Agreement without further consideration, and you shall have the same right and
license to use and exploit the same as it is granted hereunder with respect to the original
EEMBC COREMARK Software. You agree that all rights in and to enhancements,
updates, and modifications effected by EEMBC, if any, to the EEMBC COREMARK
Software, shall remain the sole and exclusive property of EEMBC. Nothing contained
herein shall obligate EEMBC to create any new enhancement, update or modifications to
the EEMBC COREMARK Software, to make such enhancement, update or
modifications available free of charge or to provide any maintenance and technical
support services.
5. Enhancements by Licensee. The Licensee shall have the right, in its discretion, to
independently modify, improve, or enhance the EEMBC COREMARK Software. The
parties agree that all rights in and to the modifications, improvements, and enhancements
solely made by Licensee, if any, to the EEMBC COREMARK Software, shall remain the
sole and exclusive property of Licensee, subject to EEMBCs ownership of the EEMBC
COREMARK Software which underlies the Licensees modifications, improvements,
and enhancements.
6. Use of Trademark. You agree that you will not, without the prior written consent of
EEMBC, use in advertising, publicity, packaging, labeling, or otherwise any trade name,
trademark, service mark, symbol, or any other identification owned by EEMBC to
identify any of its products or services.
7. Delivery. The EEMBC COREMARK Software will only be available by
downloading from EEMBCs website, specifically at www.coremark.org, in accordance
with the current policies and procedures of EEMBC. EEMBC reserves the right to
modify such procedures in its sole and absolute discretion.
8. Term and Termination.
a. Term. The term of this Agreement shall continue so long as you are not in
Default as set forth in Section 8(b).
b. Termination. This Agreement and the License granted herein will
automatically terminate if you commit an act of or are subject to any Default. A Default
means you breach a term or condition of this Agreement, including, but not limited to you
assigning or purporting to assign any of the rights granted herein without the prior written
approval of EEMBC. Upon the occurrence of a Default, this Agreement shall
immediately terminate. EEMBCs rights as set forth in this Section 8(b) are cumulative
and, except as provided herein, are in addition to any other rights EEMBC may have at
law or in equity.
c. Effect of Termination. Upon the expiration or termination of this Agreement,
the rights granted to you hereunder shall immediately cease and discontinue, and you
shall be required to immediately return any and all materials and deliverables provided to
you under this Agreement, including without limitation, the EEMBC COREMARK
Software. The provisions contained in Sections 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, and
16 shall survive any such termination or expiration.
9. No Warranty. EEMBC provides no warranty for the EEMBC COREMARK
Software.
10. Disclaimer of Warranties. You expressly acknowledge and agree that use of the
EEMBC COREMARK SOFTWARE is at your sole risk and that the entire risk as to
satisfactory quality, performance, accuracy and effort is with you. The EEMBC
COREMARK SOFTWARE is provided "as is", with all faults and without warranty of
any kind, and EEMBC and EEMBC'S licensors (collectively referred to as "EEMBC" for
the purposes of sections 10 and 11) hereby disclaim all warranties and conditions with
respect to the EEMBC COREMARK SOFTWARE, either express, implied or statutory,
including, but not limited to, the implied warranties and/or conditions of merchantability,
of satisfactory quality, of fitness for a particular purpose, of accuracy, of quiet enjoyment,
and non-infringement of third party rights. EEMBC does not warrant against
interference with your enjoyment of the EEMBC COREMARK SOFTWARE, that the
functions contained in the EEMBC COREMARK SOFTWARE will meet your
requirements, that the operation of the EEMBC COREMARK SOFTWARE will be
uninterrupted or error-free, or that defects in the EEMBC COREMARK SOFTWARE
will be corrected. no oral or written information or advice given by EEMBC or an
EEMBC authorized representative shall create a warranty. Should the EEMBC
COREMARK SOFTWARE prove defective, you assume the entire cost of all necessary
servicing, repair or correction. Some jurisdictions do not allow the exclusion of implied
warranties or limitations on applicable statutory rights of a consumer, so the above
exclusion and limitations may not apply to you. to the extent not prohibited by law, in no
event shall EEMBC be liable for personal injury, or any incidental, special, indirect or
consequential damages whatsoever, including, without limitation, damages for loss of
profits, loss of data, business interruption or any other commercial damages or losses,
arising out of or related to your use or inability to use the EEMBC COREMARK
SOFTWARE, however caused, regardless of the theory of liability (contract, tort or
otherwise) and even if EEMBC has been advised of the possibility of such damages.
some jurisdictions do not allow the limitation of liability for personal injury, or of
incidental or consequential damages, so this limitation may not apply to you. In no event
shall EEMBC's total liability to you for all damages (other than as may be required by
applicable law in cases involving personal injury) exceed the amount of fifty dollars
($50.00). The foregoing limitations will apply even if the above stated remedy fails of its
essential purpose.
11. POTENTIAL MISUSE OF EEMBC COREMARK SOFTWARE. you hereby
acknowledge and represent that you have been expressly warned by EEMBC that the
EEMBC COREMARK SOFTWARE may be incompatible with those microprocessors,
microcontrollers, or digital signal processors that are part of an application or end-user
product, and that such misuse of the EEMBC COREMARK SOFTWARE could result in
significant property damage and/or bodily harm.
12. Publication of Results. You expressly agree that this license permits you to
publicize any benchmark scores obtained using or with respect to the EEMBC
COREMARK SOFTWARE, whether for the related microprocessor, microcontroller, or
DSP platforms ONLY if you comply with the run and reporting rules as indicated in the
readme-txt file included in the EEMBC COREMARK SOFTWARE release package
available at www.coremark.org.
13. Export Law Assurances. You may not use or otherwise export or reexport the
EEMBC COREMARK SOFTWARE except as authorized by United States law and the
laws of the jurisdiction in which the EEMBC COREMARK Software was obtained. In
particular, but without limitation, the EEMBC COREMARK SOFTWARE may not be
exported or re-exported (a) into (or to a national or resident of) any U.S. embargoed
countries (currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria), or (b) to
anyone on the U.S. Treasury Department's list of Specially Designated Nationals or the
U.S. Department of Commerce Denied Person's List or Entity List. By using the
EEMBC COREMARK SOFTWARE, you represent and warrant that you are not located
in, under control of, or a national or resident of any such country or on any such list.
13. Relationship of Parties. Neither this Agreement, nor any terms and conditions
contained herein, may be construed as creating or constituting a partnership, joint venture,
or agency relationship between the parties. Neither party will have the power to bind the
other or incur obligations on the other party's behalf without the other party's prior written
consent.
14. Waiver. No failure of either party to exercise or enforce any of its rights under this
Agreement will act as a waiver of such rights.
15. Controlling Law and Severability. This License will be governed by and construed in
accordance with the laws of the State of California, as applied to agreements entered into
and to be performed entirely within California between California residents. This License
shall not be governed by the United Nations Convention on Contracts for the
International Sale of Goods, the application of which is expressly excluded. If for any
reason a court of competent jurisdiction finds any provision, or portion thereof, to be
unenforceable, the remainder of this License shall continue in full force and effect.
16. Complete Agreement; Governing Language. This License constitutes the entire
agreement between the parties with respect to the use of the EEMBC COREMARK
Software licensed hereunder and supersedes all prior or contemporaneous understandings
regarding such subject matter. No amendment to or modification of this License will be
binding unless in writing and signed by EEMBC. Any translation of this License is done
for local requirements and in the event of a dispute between the English and any non-
English versions, the English version of this License shall govern.

View file

@ -0,0 +1,202 @@
/* File : core_portme.h */
/*
Author : Shay Gal-On, EEMBC
Legal : TODO!
*/
/* Topic : Description
This file contains configuration constants required to execute on different platforms
*/
/* Realtek define */
#include "ameba_soc.h"
#define ITERATIONS 3000
#define HAS_STDIO 0
#define MAIN_HAS_NOARGC 1
#define MAIN_HAS_NORETURN 1
#define PERFORMANCE_RUN 1
#define CORE_DEBUG 0
#include "rtl_lib.h"
#include <_ansi.h>
#include <reent.h>
#include <stdio.h>
//#include <stdarg.h>
#define HAS_FLOAT 0
#ifndef CORE_PORTME_H
#define CORE_PORTME_H
/************************/
/* Data types and settings */
/************************/
/* Configuration : HAS_FLOAT
Define to 1 if the platform supports floating point.
*/
#ifndef HAS_FLOAT
#define HAS_FLOAT 1
#endif
/* Configuration : HAS_TIME_H
Define to 1 if platform has the time.h header file,
and implementation of functions thereof.
*/
#ifndef HAS_TIME_H
#define HAS_TIME_H 1
#endif
/* Configuration : USE_CLOCK
Define to 1 if platform has the time.h header file,
and implementation of functions thereof.
*/
#ifndef USE_CLOCK
#define USE_CLOCK 1
#endif
/* Configuration : HAS_STDIO
Define to 1 if the platform has stdio.h.
*/
#ifndef HAS_STDIO
#define HAS_STDIO 1
#endif
/* Configuration : HAS_PRINTF
Define to 1 if the platform has stdio.h and implements the printf function.
*/
#ifndef HAS_PRINTF
#define HAS_PRINTF 1
#endif
/* Configuration : CORE_TICKS
Define type of return from the timing functions.
*/
#include <time.h>
typedef clock_t CORE_TICKS;
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
Initialize these strings per platform
*/
#ifndef COMPILER_VERSION
#ifdef __GNUC__
#define COMPILER_VERSION "GCC"__VERSION__
#else
#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
#endif
#endif
#ifndef COMPILER_FLAGS
#define COMPILER_FLAGS "-O2" /* "Please put compiler flags here (e.g. -o3)" */
#endif
#ifndef MEM_LOCATION
#define MEM_LOCATION "STACK"
#endif
/* Data Types :
To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
*Imprtant* :
ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
*/
typedef signed short ee_s16;
typedef unsigned short ee_u16;
typedef signed int ee_s32;
typedef double ee_f32;
typedef unsigned char ee_u8;
typedef unsigned int 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.
*/
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
/* Configuration : SEED_METHOD
Defines method to get seed values that cannot be computed at compile time.
Valid values :
SEED_ARG - from command line.
SEED_FUNC - from a system function.
SEED_VOLATILE - from volatile variables.
*/
#ifndef SEED_METHOD
#define SEED_METHOD SEED_VOLATILE
#endif
/* Configuration : MEM_METHOD
Defines method to get a block of memry.
Valid values :
MEM_MALLOC - for platforms that implement malloc and have malloc.h.
MEM_STATIC - to use a static memory array.
MEM_STACK - to allocate the data block on the stack (NYI).
*/
#ifndef MEM_METHOD
#define MEM_METHOD MEM_STACK
#endif
/* Configuration : MULTITHREAD
Define for parallel execution
Valid values :
1 - only one context (default).
N>1 - will execute N copies in parallel.
Note :
If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
to fit a particular architecture.
*/
#ifndef MULTITHREAD
#define MULTITHREAD 1
#define USE_PTHREAD 0
#define USE_FORK 0
#define USE_SOCKET 0
#endif
/* Configuration : MAIN_HAS_NOARGC
Needed if platform does not support getting arguments to main.
Valid values :
0 - argc/argv to main is supported
1 - argc/argv to main is not supported
Note :
This flag only matters if MULTITHREAD has been defined to a value greater then 1.
*/
#ifndef MAIN_HAS_NOARGC
#define MAIN_HAS_NOARGC 0
#endif
/* Configuration : MAIN_HAS_NORETURN
Needed if platform does not support returning a value from main.
Valid values :
0 - main returns an int, and return value will be 0.
1 - platform does not support returning a value from main
*/
#ifndef MAIN_HAS_NORETURN
#define MAIN_HAS_NORETURN 0
#endif
/* Variable : default_num_contexts
Not used for this simple port, must cintain the value 1.
*/
extern ee_u32 default_num_contexts;
typedef struct CORE_PORTABLE_S {
ee_u8 portable_id;
} core_portable;
/* target specific init/fini */
void portable_init(core_portable *p, int *argc, char *argv[]);
void portable_fini(core_portable *p);
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
#if (TOTAL_DATA_SIZE==1200)
#define PROFILE_RUN 1
#elif (TOTAL_DATA_SIZE==2000)
#define PERFORMANCE_RUN 1
#else
#define VALIDATION_RUN 1
#endif
#endif
#endif /* CORE_PORTME_H */

View file

@ -0,0 +1,175 @@
/*
Author : Shay Gal-On, EEMBC
This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009
All rights reserved.
EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the
CoreMark License that is distributed with the official EEMBC COREMARK Software release.
If you received this EEMBC CoreMark Software without the accompanying CoreMark License,
you must discontinue use and download the official release from www.coremark.org.
Also, if you are publicly displaying scores generated from the EEMBC CoreMark software,
make sure that you are in compliance with Run and Reporting rules specified in the accompanying readme.txt file.
EEMBC
4354 Town Center Blvd. Suite 114-200
El Dorado Hills, CA, 95762
*/
/* Topic: Description
This file contains declarations of the various benchmark functions.
*/
/* Configuration: TOTAL_DATA_SIZE
Define total size for data algorithms will operate on
*/
#ifndef TOTAL_DATA_SIZE
#define TOTAL_DATA_SIZE 2*1000
#endif
#define SEED_ARG 0
#define SEED_FUNC 1
#define SEED_VOLATILE 2
#define MEM_STATIC 0
#define MEM_MALLOC 1
#define MEM_STACK 2
#include "core_portme.h"
#if HAS_STDIO
#include <stdio.h>
#endif
#if HAS_PRINTF
#define ee_printf DBG_8195A
#endif
#define COREMARK_TEXT_SECTION //IMAGE2_RAM_TEXT_SECTION
/* Actual benchmark execution in iterate */
void *iterate(void *pres);
/* Typedef: secs_ret
For machines that have floating point support, get number of seconds as a double.
Otherwise an unsigned int.
*/
#if HAS_FLOAT
typedef float secs_ret;
#else
typedef ee_u32 secs_ret;
#endif
#if MAIN_HAS_NORETURN
#define MAIN_RETURN_VAL
#define MAIN_RETURN_TYPE void
#else
#define MAIN_RETURN_VAL 0
#define MAIN_RETURN_TYPE int
#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 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);
ee_u8 check_data_types();
void *portable_malloc(ee_size_t size);
void portable_free(void *p);
ee_s32 parseval(char *valstring);
/* Algorithm IDS */
#define ID_LIST (1<<0)
#define ID_MATRIX (1<<1)
#define ID_STATE (1<<2)
#define ALL_ALGORITHMS_MASK (ID_LIST|ID_MATRIX|ID_STATE)
#define NUM_ALGORITHMS 3
/* list data structures */
typedef struct list_data_s {
ee_s16 data16;
ee_s16 idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
/*matrix benchmark related stuff */
#define MATDAT_INT 1
#if MATDAT_INT
typedef ee_s16 MATDAT;
typedef ee_s32 MATRES;
#else
typedef ee_f16 MATDAT;
typedef ee_f32 MATRES;
#endif
typedef struct MAT_PARAMS_S {
int N;
MATDAT *A;
MATDAT *B;
MATRES *C;
} mat_params;
/* state machine related stuff */
/* List of all the possible states for the FSM */
typedef enum CORE_STATE {
CORE_START=0,
CORE_INVALID,
CORE_S1,
CORE_S2,
CORE_INT,
CORE_FLOAT,
CORE_EXPONENT,
CORE_SCIENTIFIC,
NUM_CORE_STATES
} core_state_e ;
/* Helper structure to hold results */
typedef struct RESULTS_S {
/* inputs */
ee_s16 seed1; /* Initializing seed */
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 iterations; /* Number of iterations to execute */
ee_u32 execs; /* Bitmask of operations to execute */
struct list_head_s *list;
mat_params mat;
/* outputs */
ee_u16 crc;
ee_u16 crclist;
ee_u16 crcmatrix;
ee_u16 crcstate;
ee_s16 err;
/* ultithread specific */
core_portable port;
} core_results;
/* Multicore execution handling */
#if (MULTITHREAD>1)
ee_u8 core_start_parallel(core_results *res);
ee_u8 core_stop_parallel(core_results *res);
#endif
/* list benchmark functions */
list_head *core_list_init(ee_u32 blksize, list_head *memblock, ee_s16 seed);
ee_u16 core_bench_list(core_results *res, ee_s16 finder_idx);
/* state benchmark functions */
void core_init_state(ee_u32 size, ee_s16 seed, ee_u8 *p);
ee_u16 core_bench_state(ee_u32 blksize, ee_u8 *memblock,
ee_s16 seed1, ee_s16 seed2, ee_s16 step, ee_u16 crc);
/* matrix benchmark functions */
ee_u32 core_init_matrix(ee_u32 blksize, void *memblk, ee_s32 seed, mat_params *p);
ee_u16 core_bench_matrix(mat_params *p, ee_s16 seed, ee_u16 crc);

View file

@ -0,0 +1,227 @@
File: CoreMark
Topic: Welcome
Copyright © 2009 EEMBC All rights reserved.
CoreMark is a trademark of EEMBC and EEMBC is a registered trademark of the Embedded Microprocessor Benchmark Consortium.
CoreMarks primary goals are simplicity and providing a method for testing only a processors core features.
For more information about EEMBC's comprehensive embedded benchmark suites, please see www.eembc.org.
Topic: Building and running
Download the release files from the www.coremark.org.
You can verify the download using the coremark_<version>.md5 file
> md5sum -c coremark_<version>.md5
Unpack the distribution (tar -vzxf coremark_<version>.tgz && tar -vzxf coremark_<version>_docs.tgz)
then change to the coremark_<version> folder.
To build and run the benchmark, type
> make
Full results are available in the files run1.log and run2.log.
CoreMark result can be found in run1.log.
For self hosted Linux or Cygwin platforms, a simple make should work.
Cross Compile:
For cross compile platforms please adjust <core_portme.mak>, <core_portme.h> (and possibly <core_portme.c>)
according to the specific platform used.
When porting to a new platform, it is recommended to copy one of the default port folders
(e.g. mkdir <platform> && cp linux/* <platform>), adjust the porting files, and run
> make PORT_DIR=<platform>
Systems without make:
The following files need to be compiled:
- <core_list_join.c>
- <core_main.c>
- <core_matrix.c>
- <core_state.c>
- <core_util.c>
- <PORT_DIR>/<core_portme.c>
For example
> gcc -O2 -o coremark.exe core_list_join.c core_main.c core_matrix.c core_state.c core_util.c simple/core_portme.c -DPERFORMANCE_RUN=1 -DITERATIONS=1000
> ./coremark.exe > run1.log
The above will compile the benchmark for a performance run and 1000 iterations. Output is redirected to run1.log.
Make targets:
run - Default target, creates run1.log and run2.log.
run1.log - Run the benchmark with performance parameters, and output to run1.log
run2.log - Run the benchmark with validation parameters, and output to run2.log
run3.log - Run the benchmark with profile generation parameters, and output to run3.log
compile - compile the benchmark executable
link - link the benchmark executable
check - test MD5 of sources that may not be modified
clean - clean temporary files
ITERATIONS:
By default, the benchmark will run between 10-100 seconds.
To override, use ITERATIONS=N
> make ITERATIONS=10
Will run the benchmark for 10 iterations.
It is recommended to set a specific number of iterations in certain situations e.g.:
- Running with a simulator
- Measuring power/energy
- Timing cannot be restarted
Minimum required run time:
Results are only valid for reporting if the benchmark ran for at least 10 secs!
XCFLAGS:
To add compiler flags from the command line, use XCFLAGS e.g.
> make XCFLAGS="-g -DMULTITHREAD=4 -DUSE_FORK=1"
o CORE_DEBUG
Define to compile for a debug run if you get incorrect CRC.
> make XCFLAGS="-DCORE_DEBUG=1"
o Parallel Execution
Use XCFLAGS=-DMULTITHREAD=N where N is number of threads to run in parallel.
Several implementations are available to execute in multiple contexts,
or you can implement your own in <core_portme.c>.
> make XCFLAGS="-DMULTITHREAD=4 -DUSE_PTHREAD"
Above will compile the benchmark for execution on 4 cores, using POSIX Threads API.
REBUILD:
To force rebuild, add the flag REBUILD to the command line
> make REBUILD=1
Check core_portme.mak for more important options.
Run parameters for the benchmark executable:
Coremark executable takes several parameters as follows (if main accepts arguments).
1st - A seed value used for initialization of data.
2nd - A seed value used for initialization of data.
3rd - A seed value used for initialization of data.
4th - Number of iterations (0 for auto : default value)
5th - Reserved for internal use.
6th - Reserved for internal use.
7th - For malloc users only, ovreride the size of the input data buffer.
The run target from make will run coremark with 2 different data initialization seeds.
Alternative parameters:
If not using malloc or command line arguments are not supported, the buffer size
for the algorithms must be defined via the compiler define TOTAL_DATA_SIZE.
TOTAL_DATA_SIZE must be set to 2000 bytes (default) for standard runs.
The default for such a target when testing different configurations could be ...
> make XCFLAGS="-DTOTAL_DATA_SIZE=6000 -DMAIN_HAS_NOARGC=1"
Topic: Documentation
When you unpack the documentation (tar -vzxf coremark_<version>_docs.tgz) a docs folder will be created.
Check the file docs/html/index.html and the website http://www.coremark.org for more info.
Topic: Submitting results
CoreMark results can be submitted on the web.
Open a web browser and go to http://www.coremark.org/benchmark/index.php?pg=benchmark
Select the link to add a new score and follow the instructions.
Topic: Run rules
What is and is not allowed.
Required:
1 - The benchmark needs to run for at least 10 seconds.
2 - All validation must succeed for seeds 0,0,0x66 and 0x3415,0x3415,0x66,
buffer size of 2000 bytes total.
o If not using command line arguments to main:
> make XCFLAGS="-DPERFORMANCE_RUN=1" REBUILD=1 run1.log
> make XCFLAGS="-DVALIDATION_RUN=1" REBUILD=1 run2.log
3 - If using profile guided optimization, profile must be generated using seeds of 8,8,8,
and buffer size of 1200 bytes total.
> make XCFLAGS="-DTOTAL_DATA_SIZE=1200 -DPROFILE_RUN=1" REBUILD=1 run3.log
4 - All source files must be compiled with the same flags.
5 - All data type sizes must match size in bits such that:
o ee_u8 is an 8 bits datatype.
o ee_s16 is an 16 bits datatype.
o ee_u16 is an 16 bits datatype.
o ee_s32 is an 32 bits datatype.
o ee_u32 is an 32 bits datatype.
Allowed:
- Changing number of iterations
- Changing toolchain and build/load/run options
- Changing method of acquiring a data memory block
- Changing the method of acquiring seed values
- Changing implementation in core_portme.c
- Changing configuration values in core_portme.h
- Changing core_portme.mak
Not allowed:
- Changing of source file other then core_portme* (use make check to validate)
Topic: Reporting rules
How to report results on a data sheet?
CoreMark 1.0 : N / C [/ P] [/ M]
N - Number of iterations per second with seeds 0,0,0x66,size=2000)
C - Compiler version and flags
P - Parameters such as data and code allocation specifics
- This parameter *may* be omitted if all data was allocated on the heap in RAM.
- This parameter *may not* be omitted when reporting CoreMark/MHz
M - Type of parallel execution (if used) and number of contexts
This parameter may be omitted if parallel execution was not used.
e.g.
> CoreMark 1.0 : 128 / GCC 4.1.2 -O2 -fprofile-use / Heap in TCRAM / FORK:2
or
> CoreMark 1.0 : 1400 / GCC 3.4 -O4
If reporting scaling results, the results must be reported as follows:
CoreMark/MHz 1.0 : N / C / P [/ M]
P - When reporting scaling results, memory parameter must also indicate memory frequency:core frequency ratio.
- If the core has cache and cache frequency to core frequency ratio is configurable, that must also be included.
e.g.
> CoreMark/MHz 1.0 : 1.47 / GCC 4.1.2 -O2 / DDR3(Heap) 30:1 Memory 1:1 Cache
Topic: Log File Format
The log files have the following format
(start example)
2K performance run parameters for coremark. (Run type)
CoreMark Size : 666 (Buffer size)
Total ticks : 25875 (platform dependent value)
Total time (secs) : 25.875000 (actual time in seconds)
Iterations/Sec : 3864.734300 (Performance value to report)
Iterations : 100000 (number of iterations used)
Compiler version : GCC3.4.4 (Compiler and version)
Compiler flags : -O2 (Compiler and linker flags)
Memory location : Code in flash, data in on chip RAM
seedcrc : 0xe9f5 (identifier for the input seeds)
[0]crclist : 0xe714 (validation for list part)
[0]crcmatrix : 0x1fd7 (validation for matrix part)
[0]crcstate : 0x8e3a (validation for state part)
[0]crcfinal : 0x33ff (iteration dependent output)
Correct operation validated. See readme.txt for run and reporting rules. (*Only when run is successful*)
CoreMark 1.0 : 6508.490622 / GCC3.4.4 -O2 / Heap (*Only on a successful performance run*)
(end example)
Topic: Legal
See LICENSE.txt or the word document file under docs/LICENSE.doc.
For more information on your legal rights to use this benchmark, please see
http://www.coremark.org/download/register.php?pg=register
Topic: Credits
Many thanks to all of the individuals who helped with the development or testing of CoreMark including (Sorted by company name)
o Alan Anderson, ADI
o Adhikary Rajiv, ADI
o Elena Stohr, ARM
o Ian Rickards, ARM
o Andrew Pickard, ARM
o Trent Parker, CAVIUM
o Shay Gal-On, EEMBC
o Markus Levy, EEMBC
o Ron Olson, IBM
o Eyal Barzilay, MIPS
o Jens Eltze, NEC
o Hirohiko Ono, NEC
o Ulrich Drees, NEC
o Frank Roscheda, NEC
o Rob Cosaro, NXP
o Shumpei Kawasaki, RENESAS

View file

@ -0,0 +1,59 @@
File: Release Notes
Version: 1.01
History:
Version 1.01
- Added validation testing the sizes of datatypes.
Version 1.00
- First public version.
Validation:
This release was tested on the following platforms
o x86 cygwin and gcc 3.4 (Quad, dual and single core systems)
o x86 linux (Ubuntu/Fedora) and gcc (4.2/4.1) (Quad and single core systems)
o MIPS64 BE linux and gcc 3.4 16 cores system
o MIPS32 BE linux with CodeSourcery compiler 4.2-177 on Malta/Linux with a 1004K 3-core system
o PPC simulator with gcc 4.2.2 (No OS)
o PPC 64b BE linux (yellowdog) with gcc 3.4 and 4.1 (Dual core system)
o BF533 with VDSP50
o Renesas R8C/H8 MCU with HEW 4.05
o NXP LPC1700 armcc v4.0.0.524
o NEC 78K with IAR v4.61
o ARM simulator with armcc v4
Coverage:
GCOV results can be found on SVN under cover.
Memory analysis:
Valgrind 3.4.0 used and no errors reported.
Balance analysis:
Number of instructions executed for each function tested with cachegrind and found balanced with gcc and -O0.
Statistics:
Lines:
(start table)
Lines Blank Cmnts Source AESL
===== ===== ===== ===== ========== =======================================
469 66 170 251 627.5 core_list_join.c (C)
330 18 54 268 670.0 core_main.c (C)
256 32 80 146 365.0 core_matrix.c (C)
240 16 51 186 465.0 core_state.c (C)
165 11 20 134 335.0 core_util.c (C)
150 23 36 98 245.0 coremark.h (C)
1610 166 411 1083 2707.5 ----- Benchmark ----- (6 files)
293 15 74 212 530.0 linux/core_portme.c (C)
235 30 104 104 260.0 linux/core_portme.h (C)
528 45 178 316 790.0 ----- Porting ----- (2 files)
* For comparison, here are the stats for Dhrystone
Lines Blank Cmnts Source AESL
===== ===== ===== ===== ========== =======================================
311 15 242 54 135.0 dhry.h (C)
789 132 119 553 1382.5 dhry_1.c (C)
186 26 68 107 267.5 dhry_2.c (C)
1286 173 429 714 1785.0 ----- C ----- (3 files)
(end table)

View file

@ -0,0 +1,451 @@
/*
****************************************************************************
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry.h (part 1 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
* Siemens AG, E STE 35
* Postfach 3240
* 8520 Erlangen
* Germany (West)
* Phone: [xxx-49]-9131-7-20330
* (8-17 Central European Time)
* Usenet: ..!mcvax!unido!estevax!weicker
*
* Original Version (in Ada) published in
* "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
* pp. 1013 - 1030, together with the statistics
* on which the distribution of statements etc. is based.
*
* In this C version, the following C library functions are used:
* - strcpy, strcmp (inside the measurement loop)
* - printf, scanf (outside the measurement loop)
* In addition, Berkeley UNIX system calls "times ()" or "time ()"
* are used for execution time measurement. For measurements
* on other systems, these calls have to be changed.
*
* Collection of Results:
* Reinhold Weicker (address see above) and
*
* Rick Richardson
* PC Research. Inc.
* 94 Apple Orchard Drive
* Tinton Falls, NJ 07724
* Phone: (201) 389-8963 (9-17 EST)
* Usenet: ...!uunet!pcrat!rick
*
* Please send results to Rick Richardson and/or Reinhold Weicker.
* Complete information should be given on hardware and software used.
* Hardware information includes: Machine type, CPU, type and size
* of caches; for microprocessors: clock frequency, memory speed
* (number of wait states).
* Software information includes: Compiler (and runtime library)
* manufacturer and version, compilation switches, OS version.
* The Operating System version may give an indication about the
* compiler; Dhrystone itself performs no OS calls in the measurement loop.
*
* The complete output generated by the program should be mailed
* such that at least some checks for correctness can be made.
*
***************************************************************************
*
* History: This version C/2.1 has been made for two reasons:
*
* 1) There is an obvious need for a common C version of
* Dhrystone, since C is at present the most popular system
* programming language for the class of processors
* (microcomputers, minicomputers) where Dhrystone is used most.
* There should be, as far as possible, only one C version of
* Dhrystone such that results can be compared without
* restrictions. In the past, the C versions distributed
* by Rick Richardson (Version 1.1) and by Reinhold Weicker
* had small (though not significant) differences.
*
* 2) As far as it is possible without changes to the Dhrystone
* statistics, optimizing compilers should be prevented from
* removing significant statements.
*
* This C version has been developed in cooperation with
* Rick Richardson (Tinton Falls, NJ), it incorporates many
* ideas from the "Version 1.1" distributed previously by
* him over the UNIX network Usenet.
* I also thank Chaim Benedelac (National Semiconductor),
* David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
* Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
* for their help with comments on earlier versions of the
* benchmark.
*
* Changes: In the initialization part, this version follows mostly
* Rick Richardson's version distributed via Usenet, not the
* version distributed earlier via floppy disk by Reinhold Weicker.
* As a concession to older compilers, names have been made
* unique within the first 8 characters.
* Inside the measurement loop, this version follows the
* version previously distributed by Reinhold Weicker.
*
* At several places in the benchmark, code has been added,
* but within the measurement loop only in branches that
* are not executed. The intention is that optimizing compilers
* should be prevented from moving code out of the measurement
* loop, or from removing code altogether. Since the statements
* that are executed within the measurement loop have NOT been
* changed, the numbers defining the "Dhrystone distribution"
* (distribution of statements, operand types and locality)
* still hold. Except for sophisticated optimizing compilers,
* execution times for this version should be the same as
* for previous versions.
*
* Since it has proven difficult to subtract the time for the
* measurement loop overhead in a correct way, the loop check
* has been made a part of the benchmark. This does have
* an impact - though a very minor one - on the distribution
* statistics which have been updated for this version.
*
* All changes within the measurement loop are described
* and discussed in the companion paper "Rationale for
* Dhrystone version 2".
*
* Because of the self-imposed limitation that the order and
* distribution of the executed statements should not be
* changed, there are still cases where optimizing compilers
* may not generate code for some statements. To a certain
* degree, this is unavoidable for small synthetic benchmarks.
* Users of the benchmark are advised to check code listings
* whether code is generated for all statements of Dhrystone.
*
* Version 2.1 is identical to version 2.0 distributed via
* the UNIX network Usenet in March 1988 except that it corrects
* some minor deficiencies that were found by users of version 2.0.
* The only change within the measurement loop is that a
* non-executed "else" part was added to the "if" statement in
* Func_3, and a non-executed "else" part removed from Proc_3.
*
***************************************************************************
*
* Defines: The following "Defines" are possible:
* -DREG=register (default: Not defined)
* As an approximation to what an average C programmer
* might do, the "register" storage class is applied
* (if enabled by -DREG=register)
* - for local variables, if they are used (dynamically)
* five or more times
* - for parameters if they are used (dynamically)
* six or more times
* Note that an optimal "register" strategy is
* compiler-dependent, and that "register" declarations
* do not necessarily lead to faster execution.
* -DNOSTRUCTASSIGN (default: Not defined)
* Define if the C compiler does not support
* assignment of structures.
* -DNOENUMS (default: Not defined)
* Define if the C compiler does not support
* enumeration types.
* -DTIMES (default)
* -DTIME
* The "times" function of UNIX (returning process times)
* or the "time" function (returning wallclock time)
* is used for measurement.
* For single user machines, "time ()" is adequate. For
* multi-user machines where you cannot get single-user
* access, use the "times ()" function. If you have
* neither, use a stopwatch in the dead of night.
* "printf"s are provided marking the points "Start Timer"
* and "Stop Timer". DO NOT use the UNIX "time(1)"
* command, as this will measure the total time to
* run this program, which will (erroneously) include
* the time to allocate storage (malloc) and to perform
* the initialization.
* -DHZ=nnn
* In Berkeley UNIX, the function "times" returns process
* time in 1/HZ seconds, with HZ = 60 for most systems.
* CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY
* A VALUE.
*
***************************************************************************
*
* Compilation model and measurement (IMPORTANT):
*
* This C version of Dhrystone consists of three files:
* - dhry.h (this file, containing global definitions and comments)
* - dhry_1.c (containing the code corresponding to Ada package Pack_1)
* - dhry_2.c (containing the code corresponding to Ada package Pack_2)
*
* The following "ground rules" apply for measurements:
* - Separate compilation
* - No procedure merging
* - Otherwise, compiler optimizations are allowed but should be indicated
* - Default results are those without register declarations
* See the companion paper "Rationale for Dhrystone Version 2" for a more
* detailed discussion of these ground rules.
*
* For 16-Bit processors (e.g. 80186, 80286), times for all compilation
* models ("small", "medium", "large" etc.) should be given if possible,
* together with a definition of these models for the compiler system used.
*
**************************************************************************
*
* Dhrystone (C version) statistics:
*
* [Comment from the first distribution, updated for version 2.
* Note that because of language differences, the numbers are slightly
* different from the Ada version.]
*
* The following program contains statements of a high level programming
* language (here: C) in a distribution considered representative:
*
* assignments 52 (51.0 %)
* control statements 33 (32.4 %)
* procedure, function calls 17 (16.7 %)
*
* 103 statements are dynamically executed. The program is balanced with
* respect to the three aspects:
*
* - statement type
* - operand type
* - operand locality
* operand global, local, parameter, or constant.
*
* The combination of these three aspects is balanced only approximately.
*
* 1. Statement Type:
* ----------------- number
*
* V1 = V2 9
* (incl. V1 = F(..)
* V = Constant 12
* Assignment, 7
* with array element
* Assignment, 6
* with record component
* --
* 34 34
*
* X = Y +|-|"&&"|"|" Z 5
* X = Y +|-|"==" Constant 6
* X = X +|- 1 3
* X = Y *|/ Z 2
* X = Expression, 1
* two operators
* X = Expression, 1
* three operators
* --
* 18 18
*
* if .... 14
* with "else" 7
* without "else" 7
* executed 3
* not executed 4
* for ... 7 | counted every time
* while ... 4 | the loop condition
* do ... while 1 | is evaluated
* switch ... 1
* break 1
* declaration with 1
* initialization
* --
* 34 34
*
* P (...) procedure call 11
* user procedure 10
* library procedure 1
* X = F (...)
* function call 6
* user function 5
* library function 1
* --
* 17 17
* ---
* 103
*
* The average number of parameters in procedure or function calls
* is 1.82 (not counting the function values aX *
*
* 2. Operators
* ------------
* number approximate
* percentage
*
* Arithmetic 32 50.8
*
* + 21 33.3
* - 7 11.1
* * 3 4.8
* / (int div) 1 1.6
*
* Comparison 27 42.8
*
* == 9 14.3
* /= 4 6.3
* > 1 1.6
* < 3 4.8
* >= 1 1.6
* <= 9 14.3
*
* Logic 4 6.3
*
* && (AND-THEN) 1 1.6
* | (OR) 1 1.6
* ! (NOT) 2 3.2
*
* -- -----
* 63 100.1
*
*
* 3. Operand Type (counted once per operand reference):
* ---------------
* number approximate
* percentage
*
* Integer 175 72.3 %
* Character 45 18.6 %
* Pointer 12 5.0 %
* String30 6 2.5 %
* Array 2 0.8 %
* Record 2 0.8 %
* --- -------
* 242 100.0 %
*
* When there is an access path leading to the final operand (e.g. a record
* component), only the final data type on the access path is counted.
*
*
* 4. Operand Locality:
* -------------------
* number approximate
* percentage
*
* local variable 114 47.1 %
* global variable 22 9.1 %
* parameter 45 18.6 %
* value 23 9.5 %
* reference 22 9.1 %
* function result 6 2.5 %
* constant 55 22.7 %
* --- -------
* 242 100.0 %
*
*
* The program does not compute anything meaningful, but it is syntactically
* and semantically correct. All variables have a value assigned to them
* before they are used as a source operand.
*
* There has been no explicit effort to account for the effects of a
* cache, or to balance the use of long or short displacements for code or
* data.
*
***************************************************************************
*/
/* Compiler and system dependent definitions: */
#include <stdio.h> // avoid conflicting types
#include <stdlib.h> // avoid conflicting types
#include <string.h> // avoid conflicting types
#include "diag.h"
#include "strproc.h"
#include "basic_types.h"
#include "memproc.h"
#include "FreeRTOS.h"
#include "task.h"
#include "section_config.h"
//RAM or FLASH RUN
#ifndef FLASH_TEXT_SECTION
#define FLASH_TEXT_SECTION
#endif
#define DHRYSTONE_TEXT_SECTION //IMAGE2_RAM_TEXT_SECTION
#define printf DiagPrintf
#ifndef TIME
#undef TIMES
#define TIMES
#endif
/* Use times(2) time function unless */
/* explicitly defined otherwise */
#ifdef MSC_CLOCK
#undef HZ
#undef TIMES
#include <time.h>
#define HZ CLK_TCK
#endif
#define HZ 1
/* Use Microsoft C hi-res clock */
#ifdef TIMES
//#include <sys/types.h>
//#include <sys/times.h>
/* for "times" */
#endif
#define Mic_secs_Per_Second 1000000
/* Berkeley UNIX C returns process times in seconds/HZ */
#ifdef NOSTRUCTASSIGN
#define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
#else
#define structassign(d, s) d = s
#endif
#ifdef NOENUM
#define Ident_1 0
#define Ident_2 1
#define Ident_3 2
#define Ident_4 3
#define Ident_5 4
typedef int Enumeration;
#else
typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
Enumeration;
#endif
/* for boolean and enumeration types in Ada, Pascal */
/* General definitions: */
#include <stdio.h>
/* for strcpy, strcmp */
#define Null 0
/* Value of a Null pointer */
#define true 1
#define false 0
typedef int One_Thirty;
typedef int One_Fifty;
typedef char Capital_Letter;
typedef int Boolean;
typedef char Str_30 [31];
typedef int Arr_1_Dim [50];
typedef int Arr_2_Dim [50] [50];
typedef struct record
{
struct record *Ptr_Comp;
Enumeration Discr;
union {
struct {
Enumeration Enum_Comp;
int Int_Comp;
char Str_Comp [31];
} var_1;
struct {
Enumeration E_Comp_2;
char Str_2_Comp [31];
} var_2;
struct {
char Ch_1_Comp;
char Ch_2_Comp;
} var_3;
} variant;
} Rec_Type, *Rec_Pointer;

View file

@ -0,0 +1,3 @@
1. add dhry_1.c & dhry_2.c into you project
2. add component\common\test\dhrystone\include into include directories
3. call dhrystone(); use command or other methord you want.

View file

@ -0,0 +1,21 @@
//----------------------------------------------------------------------------//
#ifndef __WLAN_SOCKET_TEST_H
#define __WLAN_SOCKET_TEST_H
#ifdef __cplusplus
extern "C" {
#endif
/* Exported test functions ------------------------------------------------------- */
void reset_socket_test_cb();
void do_socket_test(int task_num, int rw_num, int non_stop);
void reset_socket_test_status();
void do_socket_test(int task_num, int rw_num, int non_stop);
void do_socket_connect(void);
#ifdef __cplusplus
}
#endif
#endif // __WLAN_SOCKET_TEST_H
//----------------------------------------------------------------------------//

View file

@ -0,0 +1,23 @@
//----------------------------------------------------------------------------//
#ifndef __MAIN_TEST_H
#define __MAIN_TEST_H
#ifdef __cplusplus
extern "C" {
#endif
/* Exported test functions ------------------------------------------------------- */
void do_ping_test(char *ip, int size, int count, int interval);
void do_ping_call(char *ip, int loop, int count);
void do_deinit_test(int mode, int ap_started);
void interactive_question(char *question, char *choice, char *buf, int buf_size);
void start_interactive_mode(void);
void post_init(unsigned int config_start_ap);
#ifdef __cplusplus
}
#endif
#endif // __MAIN_TEST_H
//----------------------------------------------------------------------------//