3939#if defined(WOLFCRYPT_SECURE_MODE )
4040 /* Use secure mode API for time */
4141 #include "wolfboot/wc_secure.h"
42+ #elif defined(TARGET_va416x0 )
43+ /* Use Vorago SDK HAL_time_ms (incremented by SysTick_Handler every 1ms) */
44+ extern volatile uint64_t HAL_time_ms ;
4245#else
4346 /* Simple tick counter fallback */
4447 static volatile unsigned int tick_counter = 0 ;
@@ -54,10 +57,12 @@ unsigned long my_time(unsigned long* timer)
5457 unsigned long t = wolfBoot_nsc_get_time ();
5558 if (timer ) * timer = t ;
5659 return t ;
60+ #elif defined(TARGET_va416x0 )
61+ unsigned long t = (unsigned long )(HAL_time_ms / 1000 );
62+ if (timer ) * timer = t ;
63+ return t ;
5764#else
5865 /* Simple incrementing counter */
59- /* WARNING: This is not real time! Only suitable for basic testing. */
60- /* For production use, implement actual RTC or define NO_ASN_TIME */
6166 tick_counter ++ ;
6267 if (timer ) * timer = tick_counter ;
6368 return tick_counter ;
@@ -75,10 +80,11 @@ double current_time(int reset)
7580
7681#if defined(WOLFCRYPT_SECURE_MODE )
7782 return wolfBoot_nsc_current_time (reset );
83+ #elif defined(TARGET_va416x0 )
84+ /* Use Vorago SDK SysTick-based millisecond counter */
85+ return (double )HAL_time_ms / 1000.0 ;
7886#else
7987 /* Simple counter-based timing */
80- /* WARNING: This will not give accurate benchmark results! */
81- /* For accurate benchmarks, implement hardware timer access */
8288 double timeNow = (double )tick_counter ;
8389 return timeNow ;
8490#endif
0 commit comments