message: Enable burst mode by default in timer initialization. Ensures benchmarks run using the same 96MHz clock frequency as examples.
diff: @@ -27,6 +27,8 @@ limitations under the License.
  #include "tensorflow/lite/micro/micro_time.h"
  +#include "tensorflow/lite/micro/debug_log.h"
  +
  // These are headers from Ambiq's Apollo3 SDK.
  #include "am_bsp.h" // NOLINT
  #include "am_mcu_apollo.h" // NOLINT
  @@ -42,6 +44,27 @@ constexpr int kTimerNum = 1;
  // Clock set to operate at 12MHz.
  constexpr int kClocksPerSecond = 12e6;
  +// Enables 96MHz burst mode on Sparkfun Edge. Enable in timer since most
  +// benchmarks and profilers want maximum performance for debugging.
  +void BurstModeEnable() {
  + am_hal_burst_avail_e eBurstModeAvailable;
  + am_hal_burst_mode_e eBurstMode;
  +
  + // Check that the Burst Feature is available.
  + int status = am_hal_burst_mode_initialize(&eBurstModeAvailable);
  + if (status != AM_HAL_STATUS_SUCCESS ||
  + eBurstModeAvailable != AM_HAL_BURST_AVAIL) {
  + DebugLog("Failed to initialize burst mode.");
  + return;
  + }
  +
  + status = am_hal_burst_mode_enable(&eBurstMode);
  +
  + if (status != AM_HAL_STATUS_SUCCESS || eBurstMode != AM_HAL_BURST_MODE) {
  + DebugLog("Failed to Enable Burst Mode operation\n");
  + }
  +}
  +
  } // namespace
  int32_t ticks_per_second() { return kClocksPerSecond; }
  @@ -53,6 +76,7 @@ int32_t GetCurrentTimeTicks() {
  // TODO(b/150808076): Split out initialization, intialize in interpreter.
  static bool is_initialized = false;
  if (!is_initialized) {
  + BurstModeEnable();
  am_hal_ctimer_config_t timer_config;
  // Operate as a 32-bit timer.
  timer_config.ui32Link = 1;
  