本帖最后由 龙鳞铁碎牙 于 2025-7-7 14:58 编辑
#申请原创# #申请开发板# 很高兴收到了极海APM32F402xB开发板,特地来写下测试帖子,首先看看板子的真容,如下:
映入眼帘的是APM32F402xB开发板,非常的小巧精致,板子上还搭载了一个极海的Llink调试下载器,这个和STlink类似。
只需要插上USB TypeC接口就能供电,同时又能下载调试了,非常的方便灵活。
看到板子上的参数,APM32F402xB是一款基于 Arm Cortex-M4F 内核的 32 位微控制器,内核是带有 FPU 的。所以可以进行浮点运算,
可以跑一些复杂的高性能算法,比如BLDC的FOC算法,卡尔曼滤波等等!
板载128Kflash,32K SRAM,看起来配置很不错。
我迫不及待的想测试一下这款APM32F402xB的coremark跑分性能了,下面就来介绍如何在APM32F402xB上进行coremark移植及测试。
1.首先,从github上下载coremark源代码
https://github.com/eembc/coremark
只需要用上上面的8个文件。
2.打开极海SDK里面的任意一个工程,这里我选择SysTick
添加coremark文件夹路劲和源文件到工程
编译一遍
发现有6出错误,需要进行修改3.先修改core_portme.c文件
按照上图修改代码
接着修改core_portme.h文件
优化等级开到最大 -Omax
4.修改core_main.c文件
5.在main函数中添加头文件
核心代码如下
/*!
* @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_USART USART1
/* 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
打开串口助手,查看
等待10秒钟左右时间,
可以看到,APM32F402xB最终coremark跑分为555分,因为APM32F402xB对标的是STM32F407,
在coremark官网查看一下STM32F407的分数。
可以看到,在168MHZ下,AC6编译器,STM32F407跑分为480分,极海的APM32F402xB最终coremark跑分为555分。
相比较,极海的APM32F402xB性能有提高!!!!
|