未验证 提交 4c5b014c 编写于 作者: M Måns Nilsson 提交者: GitHub

Flag out DWT counters for certain build variants

DWT counters are not available for Arm Cortex-M0 CPU.

BUG=Fixes https://github.com/tensorflow/tflite-micro/issues/1346
上级 445c1fea
......@@ -35,7 +35,7 @@ constexpr uint32_t kClocksPerSecond = 25e6;
uint32_t ticks_per_second() { return kClocksPerSecond; }
uint32_t GetCurrentTimeTicks() {
#ifndef TF_LITE_STRIP_ERROR_STRINGS
#if (!defined(TF_LITE_STRIP_ERROR_STRINGS) && !defined(ARMCM0))
#ifdef ARMCM55
return ARM_PMU_Get_CCNTR();
#else
......@@ -43,7 +43,7 @@ uint32_t GetCurrentTimeTicks() {
#endif
#else
return 0;
#endif // TF_LITE_STRIP_ERROR_STRINGS
#endif
}
#ifdef ETHOS_U
......@@ -67,7 +67,7 @@ void uart_init(void);
void InitializeTarget() {
uart_init();
#ifndef TF_LITE_STRIP_ERROR_STRINGS
#if (!defined(TF_LITE_STRIP_ERROR_STRINGS) && !defined(ARMCM0))
#ifdef ARMCM55
ARM_PMU_Enable();
DCB->DEMCR |= DCB_DEMCR_TRCENA_Msk;
......@@ -83,7 +83,7 @@ void InitializeTarget() {
DWT->CTRL |= 1UL;
#endif
#endif // TF_LITE_STRIP_ERROR_STRINGS
#endif
#ifdef ETHOS_U
constexpr int ethosu_base_address = 0x48102000;
......
......@@ -29,7 +29,8 @@ uint32_t GetCurrentTimeTicks() {
static bool is_initialized = false;
if (!is_initialized) {
#ifndef TF_LITE_STRIP_ERROR_STRINGS
#if (!defined(TF_LITE_STRIP_ERROR_STRINGS) && !defined(ARMCM0) && \
!defined(ARMCM0plus))
#ifdef ARM_MODEL_USE_PMU_COUNTERS
ARM_PMU_Enable();
DCB->DEMCR |= DCB_DEMCR_TRCENA_Msk;
......@@ -48,12 +49,13 @@ uint32_t GetCurrentTimeTicks() {
DWT->CTRL |= 1UL;
#endif
#endif // TF_LITE_STRIP_ERROR_STRINGS
#endif
is_initialized = true;
}
#ifndef TF_LITE_STRIP_ERROR_STRINGS
#if (!defined(TF_LITE_STRIP_ERROR_STRINGS) && !defined(ARMCM0) && \
!defined(ARMCM0plus))
#ifdef ARM_MODEL_USE_PMU_COUNTERS
return ARM_PMU_Get_CCNTR();
#else
......@@ -61,7 +63,7 @@ uint32_t GetCurrentTimeTicks() {
#endif
#else
return 0;
#endif // TF_LITE_STRIP_ERROR_STRINGS
#endif
}
} // namespace tflite
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册