1187 views|1 replies

85

Posts

0

Resources
The OP
 

[Atria AT32A403A automotive MCU development board] + CoreMark running score [Copy link]

Chapter 9: CoreMark

Next, I will give a score to the microcontroller. When choosing an MCU, on the one hand, of course, we must meet the requirements of our own project, and on the other hand, we prefer to choose an MCU with a higher cost performance.

Microcontroller-based performance benchmarks came into being, and common performance tests include CoreMark and Dhrystone.

Dhrystone is a benchmark program proposed by Reinhold P. Weicker in 1984. Its main purpose is to test the performance of integer operations and logical operations of processors. Dhrystone was first released in Ada language. Later, Rick Richardson developed Version 1.1 written in C language for Unix. This version also successfully promoted the widespread application of Dhrystone. The Dhrystone standard test method is very simple, which is how many times the Dhrystone program is run per unit time. The indicator unit is DMIPS/MHz. MIPS is the abbreviation of Million Instructions Per Second, which is the number of machine language instructions processed per second in the millions. The D in DMIPS is the abbreviation of Dhrystone, which represents the MIPS under the Dhrystone standard test method.

But its drawback is that it is easily affected by the compiler. There are a large number of string copy statements in Dhrystone, which are used to measure the performance of string copying. However, the length of the string in Dhrystone remains unchanged, and all start at the naturally aligned boundary, which are two points different from the real program. Therefore, a compiler with good optimization performance can replace the copying of the string with a series of word moves when the loop is removed, which will be much faster. At the same time, the amount of Dhrystone code is too small. In modern CPUs, it can be put into the instruction cache, so it cannot strictly measure the instruction fetch performance. Although the Dhrystone test can be used as a reference, it is more susceptible to other factors.

CoreMark can reflect the actual working ability. It was developed by the Embedded Microprocessor Benchmark Consortium (EEMBC) to replace the outdated Dhrystone standard. ARM officially recommends using CoreMark instead of Dhrystone for benchmarking.

The software is written in C language and is a free and easy-to-port benchmark program. Currently, CoreMark has become the industry standard benchmark for measuring and comparing the performance of various processors. The higher the CoreMark score, the higher the performance. The following figure shows the comparison between CoreMark and Dhrystone

From the Internet

CoreMark's simulated workload mainly includes several commonly used algorithms:

Matrix operations core_matrix.c: simulates common operations;

Linked list operation core_list_join.c: simulates various uses of pointers;

State machine operation core_state.c: simulates program branch running operation;

Cyclic redundancy check core_util.c: Common functions in embedded systems.

Next, we started porting CoreMark.

The first step is to go to the official website to download the source code at the corresponding location. The website is www.eembc.org

The second step is to create a new project, add the necessary components, create a subfolder CoreMark, put core_list_join.c, core_main.c, core_matrix.c, core_state.c, core_util.c, coremark.h into it, create a subfolder CoreMark_Test, put core_portme.c and core_portme.h in the simple folder into it. At the same time, open the project and add the above c files to the project. Don't forget to add the path.

Step 3. Because there is already a main() function in the core_main.c file, we need to block or delete the main function in the original project. I choose to block it here, select main.c, right-click and select the first one, and uncheck include in Target Build, as shown in the figure below.

The most important porting work is to adapt core_portme.c, and other C files remain unchanged.

First, add

-------------------------------------------------- ----------------

#define SysTick_Counter_Disable ((uint32_t)0xFFFFFFFE)

#define SysTick_Counter_Enable ((uint32_t)0x00000001)

#define SysTick_Counter_Clear ((uint32_t)0x00000000)

__IO uint32_t Ticks;

#define ITERATIONS 6666;

-------------------------------------------------- ----------------

The first three lines are the configuration parameters of the system tick timer SysTick. The global variable Ticks ITERATIONS depends on the situation. If ERROR! Must execute for at least 10 secs for a valid result! appears , then you need to change this value to make the program run for at least 10 seconds.

At the same time, block the following code

-------------------------------------------------- ----------------
#define NSECS_PER_SEC CLOCKS_PER_SEC

#define CORETIMETYPE clock_t

#define GETMYTIME(_t) (*_t = clock())

#define MYTIMEDIFF(fin, ini) ((fin) - (ini))

#define TIMER_RES_DIVIDER 1

#define SAMPLE_TIME_IMPLEMENTATION 1

#define EE_TICKS_PER_SEC (NSECS_PER_SEC / TIMER_RES_DIVIDER)

static CORETIMETYPE start_time_val, stop_time_val;

-------------------------------------------------- ----------------

Add to

#define EE_TICKS_PER_SEC 1000.0

Modify the original three functions to the following

-------------------------------------------------- ----------------

void start_time(void)

{

Ticks=0;

SysTick_Config(SystemCoreClock / 1000); //1ms interrupt

}

void stop_time(void)

{

/* Stop the Timer and get the encoding time */

SysTick->CTRL &=SysTick_Counter_Disable;

/* Clear the SysTick Counter */

SysTick->VAL = SysTick_Counter_Clear;

}

CORE_TICKS get_time(void)

{

CORE_TICKS elapsed=(CORE_TICKS) Ticks;//(MYTIMEDIFF(stop_time_val, start_time_val));

return elapsed;

}

-------------------------------------------------- ----------------

At the same time, since the main function in core_main.c first calls the portable_init function in core_portme.c when it is executed, it is necessary to put the initialization function in the original main function into core_portme.c and call it in the portable_init function, as shown in the following figure

Step 4 : Modify core_portme.h and coremark.h. First, we need to adapt the ee_printf printing function. Since our board has implemented the printf function, keep the following code block in coremark.h unchanged.

-------------------------------------------------- ----------------

#if HAS_PRINTF

#define ee_printf printf

#endif

-------------------------------------------------- ----------------

In this way, when the program is called, ee_printf will be replaced with printf to implement the printing function

If the board does not have a printf function, you have to implement the print function yourself and make corresponding replacements.

At the same time, change the following functions in core_portme.h to your corresponding compiler version and optimization level

-------------------------------------------------- ----------------

#ifndef COMPILER_VERSION

#ifdef __GNUC__

#define COMPILER_VERSION "GCC"__VERSION__

#else

#define COMPILER_VERSION "ARM Compiler 5.06 update 7 (build 960)"//changed

#endif

#endif

#ifndef COMPILER_FLAGS

#define COMPILER_FLAGS "-g -O3 -Otime"//changed /* "Please put compiler flags here (eg -o3)" */

#endif

#ifndef MEM_LOCATION

#define MEM_LOCATION "STACK"

#endif

-------------------------------------------------- ----------------

Finally , because we use the system tick timer for timing, which is the timing reference required by start_time, stop_time, and get_time, we need to add the following SysTick_Handler code to the at32a403a_int.c file and add the declaration: extern uint32_t Ticks;

-------------------------------------------------- ----------------

void SysTick_Handler(void)

{

Ticks++;

}

-------------------------------------------------- ----------------

The last step is to change the Optimization level to Level 3, and check the Optimize for time optimization option of MDK 5. When it is checked, the CoreMark score will be higher. The reason is probably that in Keil, when the "Optimize for time" compilation option is not selected, the local float variable occupies 8 bytes (the compiler automatically expands to double type by default). Once you use the "Optimize for time" compilation option, the local float variable will only occupy 4 bytes. That is, many unnecessary and cumbersome variable definitions are optimized, which can greatly optimize the compilation speed.

One thing to note here is that if the following error occurs, you can try to check " Use MicroLIB " in Target , which will most likely solve the error.

After compiling and downloading, if everything is normal, the following information will appear when you use the serial port assistant to observe

The final CoreMark score is 469 points . Here we try to overclock the score. This is just for demonstration. Overclocking is not recommended for stable operation. There will be hidden dangers. Overclocking is done by changing CRM_PLL_MULT_50 in the crm_pll_config function to CRM_PLL_MULT_64, that is, changing the main frequency from 200MHz to 256MHz. The final CoreMark score is 601 points, which is consistent with the increase in the main frequency.

This post is from Automotive Electronics

Latest reply

The CoreMark score is 469 points.   Details Published on 2024-2-12 10:09

6570

Posts

0

Resources
2
 

The CoreMark score is 469 points.

This post is from Automotive Electronics
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list