123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <wolfssl/wolfcrypt/settings.h>
- #include "wolfcrypt/test/test.h"
- #include <stdio.h>
- #include <time.h>
- #if defined(WOLFSSL_CMSIS_RTOS)
- #include "cmsis_os.h"
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- #include "cmsis_os2.h"
- #endif
- #define RTC_YEAR 2019
- #define RTC_MONTH 1
- #define RTC_DAY 1
- #define RTC_MONTH 1
- #define RTC_DAY 1
- #if defined(STM32F7xx)
- #include "stm32f7xx_hal.h"
- #elif defined(STM32F4xx)
- #include "stm32f4xx_hal.h"
- #elif defined(STM32F2xx)
- #include "stm32f2xx_hal.h"
- #endif
- #warning "write MPU specific Set ups\n"
- static void SystemClock_Config (void) {
- }
- static void MPU_Config (void) {
- }
- static void CPU_CACHE_Enable (void) {
- }
- #if defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
- #if defined(WOLFSSL_CMSIS_RTOS)
- extern uint32_t os_time;
- #endif
- uint32_t HAL_GetTick(void)
- {
- #if defined(WOLFSSL_CMSIS_RTOS)
- return os_time;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return osKernelGetTickCount();
- #endif
- }
- double current_time(int reset)
- {
- if (reset)
- return 0;
- #if defined(WOLFSSL_CMSIS_RTOS)
- return (double)os_time / 1000.0;
- #elif defined(WOLFSSL_CMSIS_RTOSv2)
- return (double)osKernelGetTickCount() / 1000.0;
- #endif
- }
- #else
- #include <stdint.h>
- #define DWT ((DWT_Type *) (0xE0001000UL) )
- typedef struct
- {
- uint32_t CTRL;
- uint32_t CYCCNT;
- } DWT_Type;
- extern uint32_t SystemCoreClock ;
- double current_time(int reset)
- {
- if(reset) DWT->CYCCNT = 0 ;
- return ((double)DWT->CYCCNT/SystemCoreClock) ;
- }
- #endif
- static time_t epochTime;
- time_t time(time_t *t)
- {
- return epochTime;
- }
- void setTime(time_t t)
- {
- epochTime = t;
- }
- #if !defined(NO_FILESYSTEM)
- #include "rl_fs.h"
- static void init_filesystem (void) {
- int32_t retv;
- retv = finit ("M0:");
- if (retv == fsOK) {
- retv = fmount ("M0:");
- if (retv == fsOK) {
- printf ("Drive M0 ready!\n");
- }
- else {
- printf ("Drive M0 mount failed(%d)!\n", retv);
- }
- }
- else {
- printf ("Drive M0 initialization failed!\n");
- }
- }
- #endif
- void benchmark_test(void *arg) ;
- int main()
- {
- void * arg = NULL ;
-
- MPU_Config();
- CPU_CACHE_Enable();
- HAL_Init();
- SystemClock_Config();
- #if !defined(NO_FILESYSTEM)
- init_filesystem ();
- #endif
-
- setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
- printf("=== Start: Crypt Benchmark ===\n") ;
- benchmark_test(arg) ;
- printf("=== End: Crypt Benchmark ===\n") ;
- }
|