clock difference between debug, release through JTAG and start from SPI flash on BF518 EZboard

Hi,

I am running a very simple program during test.

It simply toggles the output line periodically.

The code doing the main work is at the end of the post.

When I run the program in debug mode through JTAG, the output frequency is about 266Hz.

When I run in release mode through JTAG, the output frequency is about 961Hz.

Then I downloaded the application to external SPI flash.

When using the ldr file generated in debug folder, the frequency is about 108Hz.

When using the ldr file generated in release folder, the frequency is about 352Hz.

The output toggle frequency should be related to the clock frequency, as there are not a lot going on.

Why do I get four different frequencies here?

Thanks,

Guang

int count = 0;

while(true)
{
count++;
if (count%10000 == 0)
{
adi_gpio_Toggle(OUTPUT1_PORT, OUTPUT1_PIN);
}
}