赞
踩
提起MCU性能测试,最著名的就是CoreMark和Dhrystone。
CoreMark以每秒迭代次数作为性能评价,而Dhrystone的DMIPS与Dhrystone标准相关。
本文讨论CoreMark,先来看看MCU厂家如何宣传自家产品性能。
#define EE_TICKS_PER_SEC 1000
- void start_time(void); //启动计时器;
-
- void stop_time(void); //停止计时器;
-
- CORE_TICKS get_time(void); //获取计时器的计数值。
- //计数变量
-
- unsigned long time_ms_ticks=0;
-
-
-
- //定时器启动
-
- void start_time(void)
-
- {
-
- (&htim1)->State = HAL_TIM_STATE_BUSY;
-
- __HAL_TIM_ENABLE(&htim1);
-
- __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE);
-
- }
-
-
-
- //定时器停止
-
- void stop_time(void)
-
- {
-
- __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE);
-
- __HAL_TIM_DISABLE(&htim1);
-
- (&htim1)->State = HAL_TIM_STATE_READY;
-
- }
-
-
-
- //获取中断计数值
-
- CORE_TICKS get_time(void)
-
- {
-
- return time_ms_ticks;
-
- }
-
-
-
- //中断处理函数
-
- extern unsigned long time_ms_ticks;
-
-
-
- void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
-
- {
-
- HAL_TIM_IRQHandler(&htim1);
-
- time_ms_ticks=time_ms_ticks+1;
-
- }
- //#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
-
-
-
- //static CORETIMETYPE start_time_val, stop_time_val;
volatile ee_s32 seed4_volatile = ITERATIONS;
volatile ee_s32 seed4_volatile = 1200;
- #ifndef COMPILER_FLAGS
-
- #define COMPILER_FLAGS "-Ofast -g3"
-
- #endif
- __io_putchar (int ch)
-
- {
-
- HAL_UART_Transmit (&hlpuart1, (uint8_t*) &ch, 1, 0x0F);
-
- return ch;
-
- }
STM32G071RB,64MHz,108.9分!
---------------------
作者:Litthins
链接:https://bbs.21ic.com/icview-3156690-1-1.html
来源:21ic.com
此文章已获得原创/原创奖标签,著作权归21ic所有,任何人未经允许禁止转载。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。