Skip to content

Concepts First

  • Benchmark: quantifies CPU performance with a standard program so results can be compared across chips. The two most common embedded benchmarks are CoreMark and Dhrystone.
  • CoreMark: EEMBC's modern benchmark covering list processing, matrix operations, state machines, and CRC; the score is CoreMark/MHz.
  • Dhrystone: the classic integer benchmark, reporting DMIPS (Dhrystone MIPS) and DMIPS/MHz for integer processing ability.
  • Auto iteration count: CoreMark first probes to pick an iteration count so the total runtime lands in the 10-100 s range for accurate timing.
  • Per-MHz normalization: both benchmarks divide by clock frequency (/MHz), so chips running at different clocks can be compared fairly.

Example Overview

This page is based on the coremark_v1.01 and dhrystone examples in the official Bouffalo SDK:

  • coremark_v1.01/main.c calls core_mark() (implemented in core_main.c) to run the full CoreMark benchmark;
  • dhrystone/main.c calls dhrystone_test() (implemented in dhry_1.c) to run the classic Dhrystone 2.1 benchmark;
  • Both run automatically after flashing — no shell command needed — print the score, then enter a dead loop;
  • Results are useful for chip selection, overclock validation, and comparing compiler optimization flags (-O2/-Os).

Note

Scores depend heavily on compiler optimization: the same chip at -O2 usually scores far higher than at -O0. Keep compiler and optimization level identical when comparing across chips.

Operation Steps

1
Enter the CoreMark Example Directory

Open a terminal and enter the SDK CoreMark example directory (prerequisite: set up the environment as in Quick Start (Linux) or Windows):

cd examples/coremark_v1.01
2
Build CoreMark

Run the build command. The Ai-M62 (BL616) and Ai-M61 (BL618) belong to the same series, so both use bl616:

make CHIP=bl616 BOARD=bl616dk
3
Flash and Run CoreMark

Flash (make flash CHIP=bl616 COMX=/dev/ttyUSB0) and open a serial tool at 2000000 baud. CoreMark auto-runs one full pass (about 10-100 s) and prints CoreMark 1.0 : N / CoreMark/MHz = X.XXX; record the score.

4
Run Dhrystone

Back in the SDK root, enter the Dhrystone example and build/flash it the same way:

cd examples/dhrystone && make CHIP=bl616 BOARD=bl616dk && make flash CHIP=bl616 COMX=/dev/ttyUSB0
5
Compare the Results

Dhrystone prints Dhrystone Benchmark, Version 2.1 and DMIPS per MHz, etc. Higher CoreMark means stronger overall performance; Dhrystone reflects integer throughput. Compare with other chips at the same clock.

Code Execution Flow

CoreMark's flow from boot to printing the score is:

APIs Used by the Example

core_mark()

CoreMark benchmark entry (core_main.c): initializes the portable layer, determines seeds and iterations, runs list/matrix/state machine/CRC tests, and prints the score via ee_printf.

Parameters: none

Returns: none (called directly from main.c)

dhrystone_test()

Dhrystone 2.1 benchmark entry (dhry_1.c): initializes globals, loops through the Proc_0/Proc_1/Proc_2 core procedures, times them, and prints DMIPS and DMIPS/MHz.

Parameters: none

Returns: none

ee_printf / printf(...)

Score output: CoreMark uses ee_printf (mapped in core_portme.h), Dhrystone uses standard printf; both print to serial 0.

Parameters: format string

Returns: number of characters written

Complete Code

The following are the main.c files of both examples, identical to the official SDK, collapsed by default (the benchmark implementations live in core_main.c / dhry_1.c and are not shown here):

📜 Click to expand coremark_v1.01/main.c full code
c
#include "bflb_mtimer.h"
#include "board.h"

extern void core_mark();

int main(void)
{
    board_init();

    core_mark();

    while (1) {
        bflb_mtimer_delay_ms(1000);
    }
}
📜 Click to expand dhrystone/main.c full code
c
/**
 * @file main.c
 * @brief
 *
 * Copyright (c) 2021 Bouffalolab team
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.  The
 * ASF licenses this file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 *
 */
#include "bflb_mtimer.h"
#include "board.h"

extern void dhrystone_test();

int main(void)
{
    board_init();

    dhrystone_test();

    while (1) {
        bflb_mtimer_delay_ms(100);
    }
}

FAQ

CoreMark takes a long time without output?

That's expected — it first probes to set iterations so the total runtime is 10-100 s. If there is no output at all, check the baud rate is 2000000 and the firmware flashed successfully.

What affects the score?

Clock frequency, compiler optimization (-O0/-O2/-Os), DSP extension usage, and running from Flash (XIP) vs RAM all affect it. Keep these conditions identical for meaningful comparisons.

Which is more accurate, CoreMark or Dhrystone?

CoreMark better reflects modern embedded workloads (list/matrix/state machine/CRC) and is the industry-recommended benchmark; Dhrystone emphasizes pure integer work and is older but widely cited (DMIPS). Running both and considering your application is more useful.

Can I use it to validate overclocking?

Yes. Raise the CPU/PSRAM clock and rerun CoreMark; anomalies or resets indicate insufficient timing margin. But benchmarks don't replace long-term stability testing — combine with the "Memory Stress Test" page (memtester).

Released under the MIT License. Build Time 2026-09-11 14:52:23