龙鳞铁碎牙 发表于 2025-7-26 20:20

极海APM32E030移植coremark跑分测试

本帖最后由 龙鳞铁碎牙 于 2025-7-26 20:29 编辑

#申请开发板# #申请原创# 很荣幸收到极海赠送的APM32E030开发板,今天来测试一下跑分性能。首先从github上下载coremark源代码库
coremark

我只需要其中这几个文件,把它们放在一个文件夹里

然后添加到KEIL工程里面
开始修改
1.首先修改启动文件的堆栈空间,设大一些

2.修改portme文件


//#define NSECS_PER_SEC            CLOCKS_PER_SEC
//#define CORETIMETYPE               clock_t
//#define GETMYTIME(_t)            (*_t = clock())
#include "hal_systick.h"
#define NSECS_PER_SEC            TICKS_PER_SECOND
#define CORETIMETYPE               uint32_t
#define GETMYTIME(_t)            (*_t = hal_systick_get())

#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)

/** Define Host specific (POSIX), or target specific global time variables. */
static CORETIMETYPE start_time_val, stop_time_val;



#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 "-Omax" /* "Please put compiler flags here (e.g. -o3)" */
#endif
#ifndef MEM_LOCATION
#define MEM_LOCATION "STACK"
#endif

#define ITERATIONS 10000    // 这个值需要保证能够运行至少10秒,可以先写一个值,运行不足10秒会报错,再回来修改




#if MAIN_HAS_NOARGC
MAIN_RETURN_TYPE
coremark_main(void)
{
    int   argc = 0;
    char *argv;
#else
MAIN_RETURN_TYPE
coremark_main(int argc, char *argv[])


主函数添加核心功能函数
/*!
* @file      main.c
*
* @brief       Main program body
*
* @version   V1.0.4
*
* @date      2025-02-15
*
* @attention
*
*Copyright (C) 2021-2025 Geehy Semiconductor
*
*You may not use this file except in compliance with the
*GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
*
*The program is only for reference, which is distributed in the hope
*that it will be useful and instructional for customers to develop
*their software. Unless required by applicable law or agreed to in
*writing, the program is distributed on an "AS IS" BASIS, WITHOUT
*ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
*See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
*and limitations under the License.
*/

/* Includes ***************************************************************/
#include "main.h"
#include "Board.h"
#include <stdio.h>
#include "hal_systick.h"

/* Private includes *******************************************************/
#include "coremark.h"

/* Private macro **********************************************************/

/* printf using USART1*/
#define DEBUG_USARTUSART1

/* Private typedef ********************************************************/

/* Private variables ******************************************************/

static __IO u32 TimingDelay;

/* Private function prototypes ********************************************/

void SysTick_Init(void);
void SysTick_Delay_ms(__IO u32 nTime);
void TimingDelay_Decrement(void);

/* External variables *****************************************************/
void coremark_main(void);

/* External functions *****************************************************/

/*!
* @brief       Main program
*
* @param       None
*
* @retval      None
*/
int main(void)
{
    USART_Config_T usartConfigStruct;

    usartConfigStruct.baudRate = 115200;
    usartConfigStruct.hardwareFlow = USART_HARDWARE_FLOW_NONE;
    usartConfigStruct.mode = USART_MODE_TX;
    usartConfigStruct.parity = USART_PARITY_NONE;
    usartConfigStruct.stopBits = USART_STOP_BIT_1;
    usartConfigStruct.wordLength = USART_WORD_LEN_8B;
    BOARD_COMInit(COM1, &usartConfigStruct);

    BOARD_LEDInit(LED2);
    BOARD_LEDInit(LED3);

    printf("\r\nDelay Time = 1000ms\r\n");

    /* SysTick Initialization */
    SysTick_Init();

        printf("极海APM32F402 EVAL评估板 coremark跑分:\r\n");
        coremark_main();

    while (1)
    {
      BOARD_LEDToggle(LED2);
      BOARD_LEDToggle(LED3);

      /* Precise Delay 1ms */
      SysTick_Delay_ms(1000);
    }
}

/*!
* @brief       Start SysTick
*
* @param       None
*
* @retval      None
*/
void SysTick_Init(void)
{
    SystemCoreClock = RCM_ReadSYSCLKFreq();
    /* SystemFrequency / 1000 = 1ms */
    if (SysTick_Config(SystemCoreClock / 1000))
    {
      /* Capture error */
      while (1);
    }
}

/*!
* @brief       Precise Delay
*
* @param       nTime in milliseconds
*
* @retval      None
*/
void SysTick_Delay_ms(__IO u32 nTime)
{
    TimingDelay = nTime;
    while(TimingDelay != 0);
}

/*!
* @brief       Decrements the TimingDelay
*
* @param       None
*
* @retval      None
*/
void TimingDelay_Decrement(void)
{
    if(TimingDelay != 0)
    {
      TimingDelay--;
    }
}

#if defined (__CC_ARM) || defined (__ICCARM__) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))

/*!
* @brief       Redirect C Library function printf to serial port.
*            After Redirection, you can use printf function.
*
* @param       ch:The characters that need to be send.
*
* @param       *f:pointer to a FILE that can recording all information
*            needed to control a stream
*
* @retval      The characters that need to be send.
*
* @note
*/
int fputc(int ch, FILE* f)
{
    /* send a byte of data to the serial port */
    USART_TxData(DEBUG_USART, (uint8_t)ch);

    /* wait for the data to be send */
    while (USART_ReadStatusFlag(DEBUG_USART, USART_FLAG_TXBE) == RESET);

    return (ch);
}

#elif defined (__GNUC__)

/*!
* @brief       Redirect C Library function printf to serial port.
*            After Redirection, you can use printf function.
*
* @param       ch:The characters that need to be send.
*
* @retval      The characters that need to be send.
*
* @note
*/
int __io_putchar(int ch)
{
    /* send a byte of data to the serial port */
    USART_TxData(DEBUG_USART, ch);

    /* wait for the data to be send */
    while (USART_ReadStatusFlag(DEBUG_USART, USART_FLAG_TXBE) == RESET);

    return ch;
}

/*!
* @brief       Redirect C Library function printf to serial port.
*            After Redirection, you can use printf function.
*
* @param       file:Meaningless in this function.
*
* @param       *ptr:Buffer pointer for data to be sent.
*
* @param       len:Length of data to be sent.
*
* @retval      The characters that need to be send.
*
* @note
*/
int _write(int file, char* ptr, int len)
{
    UNUSED(file);
    int i;
    for (i = 0; i < len; i++)
    {
      __io_putchar(*ptr++);
    }

    return len;
}

#else
#warning Not supported compiler type
#endif


编译后烧录代码

打开串口助手,115200波特率

等待10S左右时间会出现跑分结果

可以看到,APM32E030 EVAL评估板 coremark跑分:
153.699548 分,在开最大优化等级 -Omax条件下
这个分数在Cortex M0中很强了

lemonboard 发表于 2025-7-28 22:27

我感觉现在MCU的性能还是比较过剩的

和谐智者 发表于 2025-7-30 19:02

刚刚查询了一下,xx32F030才76+的分数。
APM32E030的性能优势明显啊
页: [1]
查看完整版本: 极海APM32E030移植coremark跑分测试