From 49b06e1f2bd86114fa3318914b07c0670f19efac Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Mon, 11 May 2020 08:21:43 +0200 Subject: [PATCH] CMSIS-DSP: Improved IPSS support for M55 in test framework. --- .../IPSS/ARMv81MML/LinkScripts/AC6/lnk.sct | 4 ++-- Platforms/IPSS/ARMv81MML/system_ARMv81MML.c | 14 +++-------- Testing/CMakeLists.txt | 3 +++ Testing/FrameworkSource/ArrayMemory.cpp | 14 ++++++++++- Testing/FrameworkSource/IORunner.cpp | 23 ++++++++++++++----- 5 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Platforms/IPSS/ARMv81MML/LinkScripts/AC6/lnk.sct b/Platforms/IPSS/ARMv81MML/LinkScripts/AC6/lnk.sct index 35eefe4e..eb56715e 100755 --- a/Platforms/IPSS/ARMv81MML/LinkScripts/AC6/lnk.sct +++ b/Platforms/IPSS/ARMv81MML/LinkScripts/AC6/lnk.sct @@ -22,8 +22,8 @@ LOAD_REGION 0x0 * (+RW,+ZI) } - ARM_LIB_STACK 0x21000000 ALIGN 64 EMPTY -0x00002000 + ARM_LIB_STACK 0x20100000 ALIGN 64 EMPTY -0x00002000 {} - ARM_LIB_HEAP 0x21000000 ALIGN 64 EMPTY 0x00100000 + ARM_LIB_HEAP 0x20100000 ALIGN 64 EMPTY 0x00100000 {} } diff --git a/Platforms/IPSS/ARMv81MML/system_ARMv81MML.c b/Platforms/IPSS/ARMv81MML/system_ARMv81MML.c index d77ec9fb..82109007 100755 --- a/Platforms/IPSS/ARMv81MML/system_ARMv81MML.c +++ b/Platforms/IPSS/ARMv81MML/system_ARMv81MML.c @@ -243,7 +243,8 @@ typedef struct int stdout_putchar(char txchar) { - SERIAL_DATA = txchar; + SERIAL_DATA = txchar; + return(txchar); } int stderr_putchar(char txchar) @@ -278,26 +279,17 @@ void SystemInit (void) SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; #endif -#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) - // TZ_SAU_Setup(); -#endif - - // SystemCoreClock = SYSTEM_CLOCK; - - //Disable debug - // DEBUG_DEMCR &=~ DEBUG_TRCENA; // enable DL branch cache CCR |= CCR_DL; __ISB(); - + } __attribute__((constructor(255))) void platform_init(void) { - printf("\nMPS3 ARMv81MML Generic Template...\n"); printf("\n_[TEST START]____________________________________________________\n"); } diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index f995bdf1..0a8e236d 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -287,6 +287,9 @@ endif() target_sources(FrameworkLib PRIVATE ${FRAMEWORKSRC}) +if (BENCHMARK) + target_compile_definitions(FrameworkLib PUBLIC BENCHMARK) +endif() if (EXTBENCH) target_compile_definitions(FrameworkLib PUBLIC EXTBENCH) diff --git a/Testing/FrameworkSource/ArrayMemory.cpp b/Testing/FrameworkSource/ArrayMemory.cpp index d76e04fe..3494e289 100644 --- a/Testing/FrameworkSource/ArrayMemory.cpp +++ b/Testing/FrameworkSource/ArrayMemory.cpp @@ -40,7 +40,9 @@ namespace Client { this->m_bufferLength = bufferLength; this->m_generation=0; this->memError=false; + #if !defined(BENCHMARK) memset((void*)ptr, 0, bufferLength); + #endif } // By default there is alignment and tail @@ -54,7 +56,9 @@ namespace Client { this->m_bufferLength = bufferLength; this->m_generation=0; this->memError=false; + #if !defined(BENCHMARK) memset((void*)ptr, 0, bufferLength); + #endif } bool ArrayMemory::HasMemError() @@ -149,7 +153,15 @@ namespace Client { */ void ArrayMemory::FreeMemory() { - memset(this->m_ptr, 0, this->m_bufferLength); + #if !defined(BENCHMARK) + /* + In benchmark mode, memory is not clearer between + tests. It is faster when running on cycle model or RTL. + In benchmark mode, we don't tests so having a memory not + in a clean state is not a problem. + */ + memset(this->m_ptr, 0, this->m_bufferLength); + #endif this->m_currentPtr=this->m_ptr; this->m_generation++; this->memError=false; diff --git a/Testing/FrameworkSource/IORunner.cpp b/Testing/FrameworkSource/IORunner.cpp index b975cdef..2df14803 100644 --- a/Testing/FrameworkSource/IORunner.cpp +++ b/Testing/FrameworkSource/IORunner.cpp @@ -40,11 +40,15 @@ #include "arm_math.h" #include "Calibrate.h" +#define CALIBNB 20 + namespace Client { IORunner::IORunner(IO *io,PatternMgr *mgr, Testing::RunningMode runningMode):m_io(io), m_mgr(mgr) { + Testing::cycles_t current; + this->m_runningMode = runningMode; // Set running mode on PatternMgr. if (runningMode == Testing::kDumpOnly) @@ -70,8 +74,8 @@ a C++ function pointer from the cycle measurements. Calibrate c((Testing::testID_t)0); Client::Suite *s=(Client::Suite *)&c; Client::test t = (Client::test)&Calibrate::empty; - - cycleMeasurementStart(); + calibration = 0; + /* EXTBENCH is set when benchmarking is done through external traces @@ -99,20 +103,26 @@ Indeed, in that case the calibration value can only be measured by parsing the t Otherwise, the calibration is measured below. */ - for(int i=0;i < 20;i++) + for(int i=0;i < CALIBNB;i++) { + cycleMeasurementStart(); if (!m_mgr->HasMemError()) { (s->*t)(); } + #ifndef EXTBENCH + current = getCycles(); + #endif + calibration += current; + cycleMeasurementStop(); } #ifdef EXTBENCH stopSection(); #endif + #ifndef EXTBENCH - calibration=getCycles() / 20; + calibration=calibration / CALIBNB; #endif - cycleMeasurementStop(); } @@ -229,7 +239,8 @@ Otherwise, the calibration is measured below. stopSection(); #endif #ifndef EXTBENCH - cycles=getCycles()-calibration; + cycles=getCycles(); + cycles=cycles-calibration; #endif cycleMeasurementStop(); }